diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2024-11-08 12:22:28 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2024-11-15 16:56:59 +0100 |
commit | afcfb89e3901c303f0fb104a9f91193052f5595b (patch) | |
tree | ac68c308b504df3390ef988bfe5777e256d6cd0f | |
parent | bf0374b64edac86402e295a38f0faa655d91abc6 (diff) |
Related tdf#105112: use XDatabaseMetadata3 in Firebird + implement getFunctions
Firebird query for getFunctions comes from Jaybird (Firebird JDBC client).
Change-Id: I427cc1a103ed6fe2b1ad3554bb7c3e2f7a903d87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176273
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r-- | connectivity/source/drivers/firebird/DatabaseMetaData.cxx | 186 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/DatabaseMetaData.hxx | 35 |
2 files changed, 219 insertions, 2 deletions
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx index 840e60b1e66e..4da972912cd2 100644 --- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx @@ -774,6 +774,192 @@ uno::Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection() return m_pConnection; } +::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL ODatabaseMetaData::getConnectionInfo() +{ + // TODO IMPLEMENT + return Sequence< ::css::beans::PropertyValue >(); +} + +sal_Bool SAL_CALL ODatabaseMetaData::autoCommitFailureClosesAllResultSets() +{ + // TODO IMPLEMENT + return false; +} + +sal_Bool SAL_CALL ODatabaseMetaData::generatedKeyAlwaysReturned() +{ + // TODO IMPLEMENT + return false; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getAttributes( const ::rtl::OUString& /* catalog */, + const ::rtl::OUString& /* schemaPattern */, + const ::rtl::OUString& /* typeNamePattern */, + const ::rtl::OUString& /* attributeNamePattern */) +{ + // TODO IMPLEMENT + return nullptr; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getClientInfoProperties() +{ + // TODO IMPLEMENT + return nullptr; +} + +::sal_Int32 SAL_CALL ODatabaseMetaData::getDatabaseMajorVersion() +{ + // TODO IMPLEMENT + return 0; +} + +::sal_Int32 SAL_CALL ODatabaseMetaData::getDatabaseMinorVersion() +{ + // TODO IMPLEMENT + return 0; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getFunctions( const ::rtl::OUString& /* catalog */, const ::rtl::OUString& /* schemaPattern */, const ::rtl::OUString& functionNamePattern ) +{ + OUString strQuery( + "SELECT " + " null as FUNCTION_CAT," + "RDB$FUNCTION_NAME as FUNCTION_NAME," + "RDB$DESCRIPTION as REMARKS," + "cast(null as blob sub_type text) as JB_FUNCTION_SOURCE," + "'UDF' as JB_FUNCTION_KIND," + "trim(trailing from RDB$MODULE_NAME) as JB_MODULE_NAME," + "trim(trailing from RDB$ENTRYPOINT) as JB_ENTRYPOINT," + "cast(null as varchar(255)) as JB_ENGINE_NAME" + "FROM RDB$FUNCTIONS" + "WHERE RDB$FUNCTION_NAME = " + functionNamePattern); + + uno::Reference< XStatement > statement = m_pConnection->createStatement(); + uno::Reference< XResultSet > rs = statement->executeQuery(strQuery); + return rs; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getFunctionColumns( const ::rtl::OUString& /* catalog */, const ::rtl::OUString& /* schemaPattern */, const ::rtl::OUString& /* functionNamePattern */, const ::rtl::OUString& /* columnNamePattern */ ) +{ + // TODO IMPLEMENT + return nullptr; +} + +::sal_Int32 SAL_CALL ODatabaseMetaData::getMaxLogicalLobSize() +{ + // TODO IMPLEMENT + return 0; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPseudoColumns( const ::rtl::OUString& /* catalog */, + const ::rtl::OUString& /* schemaPattern */, + const ::rtl::OUString& /* tableNamePattern */, + const ::rtl::OUString& /* columnNamePattern */) +{ + // TODO IMPLEMENT + return nullptr; +} + +::sal_Int32 SAL_CALL ODatabaseMetaData::getResultSetHoldability() +{ + // TODO IMPLEMENT + return 0; +} + +::sal_Int32 SAL_CALL ODatabaseMetaData::getRowIdLifetime() +{ + // TODO IMPLEMENT + return 0; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemasFiltered( const ::css::beans::Optional< ::rtl::OUString >& /* catalog */, + const ::css::beans::Optional< ::rtl::OUString >& /* schemaPattern */) +{ + // TODO IMPLEMENT + return nullptr; +} + +::sal_Int32 SAL_CALL ODatabaseMetaData::getSQLStateType() +{ + // TODO IMPLEMENT + return 0; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSuperTables( const ::rtl::OUString& /* catalog */, + const ::rtl::OUString& /* schemaPattern */, const ::rtl::OUString& /* tableNamePattern */) +{ + // TODO IMPLEMENT + return nullptr; +} + +uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSuperTypes( const ::rtl::OUString& /* catalog */, + const ::rtl::OUString& /* schemaPattern */, + const ::rtl::OUString& /* typeNamePattern */) +{ + // TODO IMPLEMENT + return nullptr; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::locatorsUpdateCopy() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsConvertInGeneral() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsGetGeneratedKeys() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleOpenResults() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsNamedParameters() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsRefCursors() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsSavepoints() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsSharding() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsStatementPooling() +{ + // TODO IMPLEMENT + return false; +} + +::sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredFunctionsUsingCallSyntax() +{ + // TODO IMPLEMENT + return false; +} + // here follow all methods which return a resultset // the first methods is an example implementation how to use this resultset // of course you could implement it on your and you should do this because diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx index c577f594d245..bf038fe17a6f 100644 --- a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx +++ b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx @@ -25,7 +25,7 @@ #include "Connection.hxx" -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <com/sun/star/sdbc/XDatabaseMetaData3.hpp> #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> @@ -35,7 +35,7 @@ namespace connectivity::firebird //************ Class: ODatabaseMetaData - typedef ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData> ODatabaseMetaData_BASE; + typedef ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData3> ODatabaseMetaData_BASE; class ODatabaseMetaData : public ODatabaseMetaData_BASE { @@ -198,6 +198,37 @@ namespace connectivity::firebird virtual sal_Bool SAL_CALL supportsBatchUpdates( ) override; virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getUDTs( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const css::uno::Sequence< sal_Int32 >& types ) override; virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; + + // XDatabaseMetaData2 + virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL getConnectionInfo() override; + + // XDatabaseMetaData3 + virtual sal_Bool SAL_CALL autoCommitFailureClosesAllResultSets() override; + virtual sal_Bool SAL_CALL generatedKeyAlwaysReturned() override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getAttributes( const ::rtl::OUString& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::rtl::OUString& attributeNamePattern ) override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getClientInfoProperties() override; + virtual ::sal_Int32 SAL_CALL getDatabaseMajorVersion() override; + virtual ::sal_Int32 SAL_CALL getDatabaseMinorVersion() override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getFunctions( const ::rtl::OUString& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& functionNamePattern ) override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getFunctionColumns( const ::rtl::OUString& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& functionNamePattern, const ::rtl::OUString& columnNamePattern ) override; + virtual ::sal_Int32 SAL_CALL getMaxLogicalLobSize() override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getPseudoColumns( const ::rtl::OUString& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) override; + virtual ::sal_Int32 SAL_CALL getResultSetHoldability() override; + virtual ::sal_Int32 SAL_CALL getRowIdLifetime() override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getSchemasFiltered( const ::css::beans::Optional< ::rtl::OUString >& catalog, const ::css::beans::Optional< ::rtl::OUString >& schemaPattern ) override; + virtual ::sal_Int32 SAL_CALL getSQLStateType() override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getSuperTables( const ::rtl::OUString& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) override; + virtual ::css::uno::Reference< ::css::sdbc::XResultSet > SAL_CALL getSuperTypes( const ::rtl::OUString& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern ) override; + virtual ::sal_Bool SAL_CALL locatorsUpdateCopy() override; + virtual ::sal_Bool SAL_CALL supportsConvertInGeneral() override; + virtual ::sal_Bool SAL_CALL supportsGetGeneratedKeys() override; + virtual ::sal_Bool SAL_CALL supportsMultipleOpenResults() override; + virtual ::sal_Bool SAL_CALL supportsNamedParameters() override; + virtual ::sal_Bool SAL_CALL supportsRefCursors() override; + virtual ::sal_Bool SAL_CALL supportsSavepoints() override; + virtual ::sal_Bool SAL_CALL supportsSharding() override; + virtual ::sal_Bool SAL_CALL supportsStatementPooling() override; + virtual ::sal_Bool SAL_CALL supportsStoredFunctionsUsingCallSyntax() override; }; } |