diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2025-03-06 14:22:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2025-03-07 16:14:01 +0100 |
commit | f4ba2e1c5a1ee9243a9d5df80d1a7f216653c960 (patch) | |
tree | 80a74c5116d63e195061fc11d741db5161be8171 | |
parent | b1b6f4f706492c0889025786f6b3736782dd9194 (diff) |
trim excessive leading whitespace in connectivity
Change-Id: I5629ca3ac7503c1cab848f65fcd25d15a1e3dcaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182580
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
Reviewed-by: Lionel Mamane <lionel@mamane.lu>
177 files changed, 11202 insertions, 11202 deletions
diff --git a/connectivity/inc/sdbcx/VCatalog.hxx b/connectivity/inc/sdbcx/VCatalog.hxx index 3c87a08700b6..bc699d0b8a01 100644 --- a/connectivity/inc/sdbcx/VCatalog.hxx +++ b/connectivity/inc/sdbcx/VCatalog.hxx @@ -36,80 +36,80 @@ namespace com::sun::star::sdbc { class XResultSet; } namespace com::sun::star::sdbc { class XRow; } namespace connectivity::sdbcx - { +{ + + class OCollection; + // OCatalog is a general catalog class + // other drivers can be derived their catalog from this class when they want to support sdbcx + // it holds already tables, views, groups and users + + typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XTablesSupplier, + css::sdbcx::XViewsSupplier, + css::sdbcx::XUsersSupplier, + css::sdbcx::XGroupsSupplier, + css::lang::XServiceInfo> OCatalog_BASE; - class OCollection; - // OCatalog is a general catalog class - // other drivers can be derived their catalog from this class when they want to support sdbcx - // it holds already tables, views, groups and users - - typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XTablesSupplier, - css::sdbcx::XViewsSupplier, - css::sdbcx::XUsersSupplier, - css::sdbcx::XGroupsSupplier, - css::lang::XServiceInfo> OCatalog_BASE; - - - class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog : - public OCatalog_BASE, - public IRefreshableGroups, - public IRefreshableUsers - { - protected: - - ::osl::Mutex m_aMutex; - - // this members are deleted when the dtor is called - // they are hold weak - std::unique_ptr<OCollection> m_pTables; - std::unique_ptr<OCollection> m_pViews; - std::unique_ptr<OCollection> m_pGroups; - std::unique_ptr<OCollection> m_pUsers; - - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier - - /** builds the name which should be used to access the object later on in the collection. - Will only be called in fillNames. - @param _xRow - The current row from the resultset given to fillNames. - */ - virtual OUString buildName( const css::uno::Reference< css::sdbc::XRow >& _xRow); - - /** fills a vector with the necessary names which can be used in combination with the collections. - For each row buildName will be called. - @param _xResult - The resultset which should be used to fill the names. Will be disposed after return and set to NULL. - @param _rNames - The vector who will be filled. - */ - void fillNames(css::uno::Reference< css::sdbc::XResultSet >& _xResult,::std::vector< OUString>& _rNames); - - public: - OCatalog(const css::uno::Reference< css::sdbc::XConnection> &_xConnection); - virtual ~OCatalog() override; - - DECLARE_SERVICE_INFO(); - - // refreshTables is called when the method getTables had been called - // the member m_pTables has to be created - virtual void refreshTables() = 0; - // refreshViews is called when the method getViews had been called - virtual void refreshViews() = 0; - - // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XTablesSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( ) override; - // XViewsSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getViews( ) override; - // XUsersSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override; - // XGroupsSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override; - - }; + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog : + public OCatalog_BASE, + public IRefreshableGroups, + public IRefreshableUsers + { + protected: + + ::osl::Mutex m_aMutex; + + // this members are deleted when the dtor is called + // they are hold weak + std::unique_ptr<OCollection> m_pTables; + std::unique_ptr<OCollection> m_pViews; + std::unique_ptr<OCollection> m_pGroups; + std::unique_ptr<OCollection> m_pUsers; + + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier + + /** builds the name which should be used to access the object later on in the collection. + Will only be called in fillNames. + @param _xRow + The current row from the resultset given to fillNames. + */ + virtual OUString buildName( const css::uno::Reference< css::sdbc::XRow >& _xRow); + + /** fills a vector with the necessary names which can be used in combination with the collections. + For each row buildName will be called. + @param _xResult + The resultset which should be used to fill the names. Will be disposed after return and set to NULL. + @param _rNames + The vector who will be filled. + */ + void fillNames(css::uno::Reference< css::sdbc::XResultSet >& _xResult,::std::vector< OUString>& _rNames); + + public: + OCatalog(const css::uno::Reference< css::sdbc::XConnection> &_xConnection); + virtual ~OCatalog() override; + + DECLARE_SERVICE_INFO(); + + // refreshTables is called when the method getTables had been called + // the member m_pTables has to be created + virtual void refreshTables() = 0; + // refreshViews is called when the method getViews had been called + virtual void refreshViews() = 0; + + // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XTablesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( ) override; + // XViewsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getViews( ) override; + // XUsersSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override; + // XGroupsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override; + + }; } diff --git a/connectivity/inc/sdbcx/VGroup.hxx b/connectivity/inc/sdbcx/VGroup.hxx index 9c292adc6d02..feb0baae443b 100644 --- a/connectivity/inc/sdbcx/VGroup.hxx +++ b/connectivity/inc/sdbcx/VGroup.hxx @@ -32,62 +32,62 @@ #include <com/sun/star/lang/XServiceInfo.hpp> namespace connectivity::sdbcx - { - typedef OCollection OUsers; +{ + typedef OCollection OUsers; - typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XUsersSupplier, - css::sdbcx::XAuthorizable, - css::container::XNamed, - css::lang::XServiceInfo> OGroup_BASE; + typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XUsersSupplier, + css::sdbcx::XAuthorizable, + css::container::XNamed, + css::lang::XServiceInfo> OGroup_BASE; - class OOO_DLLPUBLIC_DBTOOLS OGroup : - public cppu::BaseMutex, - public OGroup_BASE, - public IRefreshableUsers, - public ::comphelper::OPropertyArrayUsageHelper<OGroup>, - public ODescriptor - { - protected: - // no Reference! see OCollection::acquire - std::unique_ptr<OUsers> m_pUsers; + class OOO_DLLPUBLIC_DBTOOLS OGroup : + public cppu::BaseMutex, + public OGroup_BASE, + public IRefreshableUsers, + public ::comphelper::OPropertyArrayUsageHelper<OGroup>, + public ODescriptor + { + protected: + // no Reference! see OCollection::acquire + std::unique_ptr<OUsers> m_pUsers; - using OGroup_BASE::rBHelper; + using OGroup_BASE::rBHelper; - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OGroup(bool _bCase); - OGroup( const OUString& Name, bool _bCase); - virtual ~OGroup() override; - DECLARE_SERVICE_INFO(); + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OGroup(bool _bCase); + OGroup( const OUString& Name, bool _bCase); + virtual ~OGroup() override; + DECLARE_SERVICE_INFO(); - // XInterface - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; + // XInterface + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XUsersSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override; - // XAuthorizable - virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XUsersSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - // XNamed - virtual OUString SAL_CALL getName( ) override; - virtual void SAL_CALL setName( const OUString& aName ) override; - }; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + }; } diff --git a/connectivity/inc/sdbcx/VIndex.hxx b/connectivity/inc/sdbcx/VIndex.hxx index fd9bebe73ec2..2591ef6efdbd 100644 --- a/connectivity/inc/sdbcx/VIndex.hxx +++ b/connectivity/inc/sdbcx/VIndex.hxx @@ -31,68 +31,68 @@ #include <cppuhelper/implbase1.hxx> namespace connectivity::sdbcx - { - class OCollection; - class OIndex; - typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OIndex_BASE; - typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP; +{ + class OCollection; + class OIndex; + typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OIndex_BASE; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP; - class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OIndex : - public cppu::BaseMutex, - public ODescriptor_BASE, - public IRefreshableColumns, - public OIndex_PROP, - public ODescriptor, - public OIndex_BASE - { - protected: - OUString m_Catalog; - bool m_IsUnique; - bool m_IsPrimaryKeyIndex; - bool m_IsClustered; + class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OIndex : + public cppu::BaseMutex, + public ODescriptor_BASE, + public IRefreshableColumns, + public OIndex_PROP, + public ODescriptor, + public OIndex_BASE + { + protected: + OUString m_Catalog; + bool m_IsUnique; + bool m_IsPrimaryKeyIndex; + bool m_IsClustered; - // no Reference! see OCollection::acquire - std::unique_ptr<OCollection> m_pColumns; + // no Reference! see OCollection::acquire + std::unique_ptr<OCollection> m_pColumns; - using ODescriptor_BASE::rBHelper; - virtual void refreshColumns() override; - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; - public: - OIndex(bool _bCase); - OIndex( const OUString& Name, - OUString Catalog, - bool _isUnique, - bool _isPrimaryKeyIndex, - bool _isClustered, - bool _bCase); + using ODescriptor_BASE::rBHelper; + virtual void refreshColumns() override; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + public: + OIndex(bool _bCase); + OIndex( const OUString& Name, + OUString Catalog, + bool _isUnique, + bool _isPrimaryKeyIndex, + bool _isClustered, + bool _bCase); - virtual ~OIndex( ) override; + virtual ~OIndex( ) override; - DECLARE_SERVICE_INFO(); + DECLARE_SERVICE_INFO(); - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // ODescriptor - virtual void construct() override; - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XColumnsSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override; + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // ODescriptor + virtual void construct() override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XColumnsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override; - // XNamed - virtual OUString SAL_CALL getName( ) override; - virtual void SAL_CALL setName( const OUString& aName ) override; - // XDataDescriptorFactory - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; - }; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + // XDataDescriptorFactory + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; + }; } diff --git a/connectivity/inc/sdbcx/VIndexColumn.hxx b/connectivity/inc/sdbcx/VIndexColumn.hxx index 8b9083c7ec75..d4b6c00e21d3 100644 --- a/connectivity/inc/sdbcx/VIndexColumn.hxx +++ b/connectivity/inc/sdbcx/VIndexColumn.hxx @@ -24,35 +24,35 @@ #include <connectivity/sdbcx/VColumn.hxx> namespace connectivity::sdbcx - { - class OIndexColumn; - typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP; +{ + class OIndexColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP; - class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OIndexColumn : - public OColumn, public OIndexColumn_PROP - { - bool m_IsAscending; - protected: - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; - public: - OIndexColumn( bool _bCase); - OIndexColumn( bool IsAscending, - const OUString& Name, - const OUString& TypeName, - const OUString& DefaultValue, - sal_Int32 IsNullable, - sal_Int32 Precision, - sal_Int32 Scale, - sal_Int32 Type, - bool _bCase, - const OUString& CatalogName, - const OUString& SchemaName, - const OUString& TableName); + class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OIndexColumn : + public OColumn, public OIndexColumn_PROP + { + bool m_IsAscending; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + public: + OIndexColumn( bool _bCase); + OIndexColumn( bool IsAscending, + const OUString& Name, + const OUString& TypeName, + const OUString& DefaultValue, + sal_Int32 IsNullable, + sal_Int32 Precision, + sal_Int32 Scale, + sal_Int32 Type, + bool _bCase, + const OUString& CatalogName, + const OUString& SchemaName, + const OUString& TableName); - virtual void construct() override; - DECLARE_SERVICE_INFO(); - }; + virtual void construct() override; + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/inc/sdbcx/VKey.hxx b/connectivity/inc/sdbcx/VKey.hxx index df17eba8729f..7ee7dc563b04 100644 --- a/connectivity/inc/sdbcx/VKey.hxx +++ b/connectivity/inc/sdbcx/VKey.hxx @@ -33,76 +33,76 @@ #include <utility> namespace connectivity::sdbcx - { +{ - struct OOO_DLLPUBLIC_DBTOOLS KeyProperties - { - ::std::vector< OUString> m_aKeyColumnNames; - OUString m_ReferencedTable; - sal_Int32 m_Type; - sal_Int32 m_UpdateRule; - sal_Int32 m_DeleteRule; - KeyProperties(OUString ReferencedTable, - sal_Int32 Type, - sal_Int32 UpdateRule, - sal_Int32 DeleteRule) - :m_ReferencedTable(std::move(ReferencedTable)), - m_Type(Type), - m_UpdateRule(UpdateRule), - m_DeleteRule(DeleteRule) - {} - KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){} - }; - typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OKey_BASE; - class OCollection; + struct OOO_DLLPUBLIC_DBTOOLS KeyProperties + { + ::std::vector< OUString> m_aKeyColumnNames; + OUString m_ReferencedTable; + sal_Int32 m_Type; + sal_Int32 m_UpdateRule; + sal_Int32 m_DeleteRule; + KeyProperties(OUString ReferencedTable, + sal_Int32 Type, + sal_Int32 UpdateRule, + sal_Int32 DeleteRule) + :m_ReferencedTable(std::move(ReferencedTable)), + m_Type(Type), + m_UpdateRule(UpdateRule), + m_DeleteRule(DeleteRule) + {} + KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){} + }; + typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OKey_BASE; + class OCollection; - class OOO_DLLPUBLIC_DBTOOLS OKey : - public cppu::BaseMutex, - public ODescriptor_BASE, - public IRefreshableColumns, - public ::comphelper::OIdPropertyArrayUsageHelper<OKey>, - public ODescriptor, - public OKey_BASE - { - protected: - std::shared_ptr<KeyProperties> m_aProps; - // no Reference! see OCollection::acquire - std::unique_ptr<OCollection> m_pColumns; + class OOO_DLLPUBLIC_DBTOOLS OKey : + public cppu::BaseMutex, + public ODescriptor_BASE, + public IRefreshableColumns, + public ::comphelper::OIdPropertyArrayUsageHelper<OKey>, + public ODescriptor, + public OKey_BASE + { + protected: + std::shared_ptr<KeyProperties> m_aProps; + // no Reference! see OCollection::acquire + std::unique_ptr<OCollection> m_pColumns; - using ODescriptor_BASE::rBHelper; - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OKey(bool _bCase); - OKey(const OUString& Name,std::shared_ptr<KeyProperties> _xProps,bool _bCase); + using ODescriptor_BASE::rBHelper; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OKey(bool _bCase); + OKey(const OUString& Name,std::shared_ptr<KeyProperties> _xProps,bool _bCase); - virtual ~OKey( ) override; + virtual ~OKey( ) override; - DECLARE_SERVICE_INFO(); - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // ODescriptor - virtual void construct() override; + DECLARE_SERVICE_INFO(); + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // ODescriptor + virtual void construct() override; - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XColumnsSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XColumnsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override; - // XNamed - virtual OUString SAL_CALL getName( ) override; - virtual void SAL_CALL setName( const OUString& aName ) override; - // XDataDescriptorFactory - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; - }; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + // XDataDescriptorFactory + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; + }; } diff --git a/connectivity/inc/sdbcx/VKeyColumn.hxx b/connectivity/inc/sdbcx/VKeyColumn.hxx index 59b26131db9f..76e9b9062a20 100644 --- a/connectivity/inc/sdbcx/VKeyColumn.hxx +++ b/connectivity/inc/sdbcx/VKeyColumn.hxx @@ -22,37 +22,37 @@ #include <connectivity/sdbcx/VColumn.hxx> namespace connectivity::sdbcx - { - class OKeyColumn; - typedef ::comphelper::OIdPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP; +{ + class OKeyColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP; - class OKeyColumn : - public OColumn, public OKeyColumn_PROP - { - OUString m_ReferencedColumn; - protected: - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; - public: - OKeyColumn(bool _bCase); - OKeyColumn( OUString ReferencedColumn, - const OUString& Name, - const OUString& TypeName, - const OUString& DefaultValue, - sal_Int32 IsNullable, - sal_Int32 Precision, - sal_Int32 Scale, - sal_Int32 Type, - bool _bCase, - const OUString& CatalogName, - const OUString& SchemaName, - const OUString& TableName); - // just to make it not inline - virtual ~OKeyColumn() override; + class OKeyColumn : + public OColumn, public OKeyColumn_PROP + { + OUString m_ReferencedColumn; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + public: + OKeyColumn(bool _bCase); + OKeyColumn( OUString ReferencedColumn, + const OUString& Name, + const OUString& TypeName, + const OUString& DefaultValue, + sal_Int32 IsNullable, + sal_Int32 Precision, + sal_Int32 Scale, + sal_Int32 Type, + bool _bCase, + const OUString& CatalogName, + const OUString& SchemaName, + const OUString& TableName); + // just to make it not inline + virtual ~OKeyColumn() override; - virtual void construct() override; - DECLARE_SERVICE_INFO(); - }; + virtual void construct() override; + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/inc/sdbcx/VTypeDef.hxx b/connectivity/inc/sdbcx/VTypeDef.hxx index 92a1f3c9c104..02b31da1d4fe 100644 --- a/connectivity/inc/sdbcx/VTypeDef.hxx +++ b/connectivity/inc/sdbcx/VTypeDef.hxx @@ -26,9 +26,9 @@ namespace connectivity::sdbcx { - typedef cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier, - css::container::XNamed, - css::lang::XServiceInfo> ODescriptor_BASE; + typedef cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier, + css::container::XNamed, + css::lang::XServiceInfo> ODescriptor_BASE; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VUser.hxx b/connectivity/inc/sdbcx/VUser.hxx index 7086cb04f2e3..b63371acb12f 100644 --- a/connectivity/inc/sdbcx/VUser.hxx +++ b/connectivity/inc/sdbcx/VUser.hxx @@ -33,62 +33,62 @@ namespace connectivity::sdbcx { - typedef OCollection OGroups; + typedef OCollection OGroups; - typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XUser, - css::sdbcx::XGroupsSupplier, - css::container::XNamed, - css::lang::XServiceInfo> OUser_BASE; + typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XUser, + css::sdbcx::XGroupsSupplier, + css::container::XNamed, + css::lang::XServiceInfo> OUser_BASE; - class OOO_DLLPUBLIC_DBTOOLS OUser : - public cppu::BaseMutex, - public OUser_BASE, - public IRefreshableGroups, - public ::comphelper::OPropertyArrayUsageHelper<OUser>, - public ODescriptor - { - protected: - // no Reference! see OCollection::acquire - std::unique_ptr<OGroups> m_pGroups; + class OOO_DLLPUBLIC_DBTOOLS OUser : + public cppu::BaseMutex, + public OUser_BASE, + public IRefreshableGroups, + public ::comphelper::OPropertyArrayUsageHelper<OUser>, + public ODescriptor + { + protected: + // no Reference! see OCollection::acquire + std::unique_ptr<OGroups> m_pGroups; - using OUser_BASE::rBHelper; + using OUser_BASE::rBHelper; - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OUser(bool _bCase); - OUser(const OUString& Name,bool _bCase); + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OUser(bool _bCase); + OUser(const OUString& Name,bool _bCase); - virtual ~OUser( ) override; + virtual ~OUser( ) override; - DECLARE_SERVICE_INFO(); + DECLARE_SERVICE_INFO(); - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XUser - virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; - // XAuthorizable - virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - // XGroupsSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XUser + virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + // XGroupsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override; - // XNamed - virtual OUString SAL_CALL getName( ) override; - virtual void SAL_CALL setName( const OUString& aName ) override; - }; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + }; } diff --git a/connectivity/source/drivers/evoab2/NCatalog.hxx b/connectivity/source/drivers/evoab2/NCatalog.hxx index b2bd8084474c..2b794c81202e 100644 --- a/connectivity/source/drivers/evoab2/NCatalog.hxx +++ b/connectivity/source/drivers/evoab2/NCatalog.hxx @@ -23,21 +23,21 @@ namespace connectivity::evoab { - class OEvoabConnection; - class OEvoabCatalog : public connectivity::sdbcx::OCatalog - { - OEvoabConnection *m_pConnection; - public: - explicit OEvoabCatalog(OEvoabConnection *_pCon); - OEvoabConnection* getConnection() const { return m_pConnection; } - virtual void refreshTables() override; - virtual void refreshViews() override {} - virtual void refreshGroups() override {} - virtual void refreshUsers() override {} - // XTablesSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( - ) override; - }; + class OEvoabConnection; + class OEvoabCatalog : public connectivity::sdbcx::OCatalog + { + OEvoabConnection *m_pConnection; + public: + explicit OEvoabCatalog(OEvoabConnection *_pCon); + OEvoabConnection* getConnection() const { return m_pConnection; } + virtual void refreshTables() override; + virtual void refreshViews() override {} + virtual void refreshGroups() override {} + virtual void refreshUsers() override {} +// XTablesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( + ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/evoab2/NColumns.hxx b/connectivity/source/drivers/evoab2/NColumns.hxx index 14ab99f19f42..0f070e5ca8c8 100644 --- a/connectivity/source/drivers/evoab2/NColumns.hxx +++ b/connectivity/source/drivers/evoab2/NColumns.hxx @@ -24,21 +24,21 @@ namespace connectivity::evoab { - class OEvoabColumns final : public sdbcx::OCollection - { - OEvoabTable* m_pTable; + class OEvoabColumns final : public sdbcx::OCollection + { + OEvoabTable* m_pTable; - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; - public: - OEvoabColumns( OEvoabTable* _pTable, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector - ) : sdbcx::OCollection(*_pTable,true,_rMutex,_rVector), - m_pTable(_pTable) - { } - }; + public: + OEvoabColumns( OEvoabTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector + ) : sdbcx::OCollection(*_pTable,true,_rMutex,_rVector), + m_pTable(_pTable) + { } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx index 8dd8714bc2fe..77e3ea30b335 100644 --- a/connectivity/source/drivers/evoab2/NConnection.hxx +++ b/connectivity/source/drivers/evoab2/NConnection.hxx @@ -32,74 +32,74 @@ namespace connectivity::evoab { - namespace SDBCAddress { - typedef enum { - Unknown = 0, - EVO_LOCAL = 1, - EVO_LDAP = 2, - EVO_GWISE = 3 - } sdbc_address_type; - } + namespace SDBCAddress { + typedef enum { + Unknown = 0, + EVO_LOCAL = 1, + EVO_LDAP = 2, + EVO_GWISE = 3 + } sdbc_address_type; + } - typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding + typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding - class OEvoabConnection final :public OConnection_BASE - { - private: - const OEvoabDriver& m_rDriver; - SDBCAddress::sdbc_address_type m_eSDBCAddressType; - css::uno::Reference< css::sdbcx::XTablesSupplier > - m_xCatalog; - OString m_aPassword; - ::dbtools::WarningsContainer m_aWarnings; + class OEvoabConnection final :public OConnection_BASE + { + private: + const OEvoabDriver& m_rDriver; + SDBCAddress::sdbc_address_type m_eSDBCAddressType; + css::uno::Reference< css::sdbcx::XTablesSupplier > + m_xCatalog; + OString m_aPassword; + ::dbtools::WarningsContainer m_aWarnings; - virtual ~OEvoabConnection() override; + virtual ~OEvoabConnection() override; - public: - explicit OEvoabConnection( OEvoabDriver const & _rDriver ); - /// @throws css::sdbc::SQLException - void construct(const OUString& _rUrl,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ); + public: + explicit OEvoabConnection( OEvoabDriver const & _rDriver ); + /// @throws css::sdbc::SQLException + void construct(const OUString& _rUrl,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ); - void setPassword( OString const & aStr ) { m_aPassword = aStr; } - // own methods - const OEvoabDriver& getDriver() const { return m_rDriver; } + void setPassword( OString const & aStr ) { m_aPassword = aStr; } + // own methods + const OEvoabDriver& getDriver() const { return m_rDriver; } - SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;} - void setSDBCAddressType(SDBCAddress::sdbc_address_type _eSDBCAddressType) {m_eSDBCAddressType = _eSDBCAddressType;} + SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;} + void setSDBCAddressType(SDBCAddress::sdbc_address_type _eSDBCAddressType) {m_eSDBCAddressType = _eSDBCAddressType;} - // OComponentHelper - virtual void SAL_CALL disposing() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XServiceInfo - DECLARE_SERVICE_INFO(); + // XServiceInfo + DECLARE_SERVICE_INFO(); - // XConnection - css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; - virtual sal_Bool SAL_CALL getAutoCommit( ) override; - virtual void SAL_CALL commit( ) override; - virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual void SAL_CALL setCatalog( const OUString& catalog ) override; - virtual OUString SAL_CALL getCatalog( ) override; - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; - virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + // XConnection + css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; + virtual sal_Bool SAL_CALL getAutoCommit( ) override; + virtual void SAL_CALL commit( ) override; + virtual void SAL_CALL rollback( ) override; + virtual sal_Bool SAL_CALL isClosed( ) override; + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual void SAL_CALL setCatalog( const OUString& catalog ) override; + virtual OUString SAL_CALL getCatalog( ) override; + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; + virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - }; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx index a64c234e6a52..333594bf3741 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx @@ -31,187 +31,187 @@ namespace connectivity::evoab { - //************ Class: OEvoabDatabaseMetaData - - typedef struct{ - gboolean bIsSplittedValue; - GParamSpec *pField; - }ColumnProperty; - - typedef enum { - DEFAULT_ADDR_LINE1=1,DEFAULT_ADDR_LINE2,DEFAULT_CITY,DEFAULT_STATE,DEFAULT_COUNTRY,DEFAULT_ZIP, - WORK_ADDR_LINE1,WORK_ADDR_LINE2,WORK_CITY,WORK_STATE,WORK_COUNTRY,WORK_ZIP, - HOME_ADDR_LINE1,HOME_ADDR_LINE2,HOME_CITY,HOME_STATE,HOME_COUNTRY,HOME_ZIP, - OTHER_ADDR_LINE1,OTHER_ADDR_LINE2,OTHER_CITY,OTHER_STATE,OTHER_COUNTRY,OTHER_ZIP - }ColumnNumber; - - typedef struct { - const gchar *pColumnName; - ColumnNumber value; - }SplitEvoColumns; - - const SplitEvoColumns* get_evo_addr(); - - const ColumnProperty *getField(guint n); - GType getGFieldType(guint nCol) ; - sal_Int32 getFieldType(guint nCol) ; - OUString getFieldTypeName(guint nCol) ; - OUString getFieldName(guint nCol) ; - guint findEvoabField(std::u16string_view aColName); - - void free_column_resources(); - - class OEvoabDatabaseMetaData : public ODatabaseMetaDataBase - { - OEvoabConnection* m_pConnection; - - protected: - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - // cached database information - virtual OUString impl_getIdentifierQuoteString_throw( ) override; - virtual bool impl_isCatalogAtStart_throw( ) override; - virtual OUString impl_getCatalogSeparator_throw( ) override; - virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; - virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ; - virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; - virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ; - virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override ; - virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; - virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; - virtual sal_Int32 impl_getMaxStatements_throw( ) override; - virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; - virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; - - virtual ~OEvoabDatabaseMetaData() override; - public: - explicit OEvoabDatabaseMetaData(OEvoabConnection* _pCon); - - // as I mentioned before this interface is really BIG - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual OUString SAL_CALL getUserName( ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; - virtual OUString SAL_CALL getDatabaseProductName( ) override; - virtual OUString SAL_CALL getDatabaseProductVersion( ) override; - virtual OUString SAL_CALL getDriverName( ) override; - virtual OUString SAL_CALL getDriverVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; - virtual sal_Bool SAL_CALL usesLocalFiles( ) override; - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; - - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; - - virtual OUString SAL_CALL getSQLKeywords( ) override; - virtual OUString SAL_CALL getNumericFunctions( ) override; - virtual OUString SAL_CALL getStringFunctions( ) override; - virtual OUString SAL_CALL getSystemFunctions( ) override; - virtual OUString SAL_CALL getTimeDateFunctions( ) override; - virtual OUString SAL_CALL getSearchStringEscape( ) override; - virtual OUString SAL_CALL getExtraNameCharacters( ) override; - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; - virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupBy( ) override; - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; - virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; - virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; - virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; - virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; - virtual OUString SAL_CALL getSchemaTerm( ) override; - virtual OUString SAL_CALL getProcedureTerm( ) override; - virtual OUString SAL_CALL getCatalogTerm( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; - virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; - virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; - virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; - virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; - virtual sal_Bool SAL_CALL supportsUnion( ) override; - virtual sal_Bool SAL_CALL supportsUnionAll( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - virtual sal_Int32 SAL_CALL getMaxConnections( ) override; - virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; - virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; - virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; - virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; - virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; - virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; - virtual sal_Bool SAL_CALL supportsTransactions( ) override; - virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; - virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; - virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; - virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; - virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; - virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; - 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; - }; + //************ Class: OEvoabDatabaseMetaData + + typedef struct{ + gboolean bIsSplittedValue; + GParamSpec *pField; + }ColumnProperty; + + typedef enum { + DEFAULT_ADDR_LINE1=1,DEFAULT_ADDR_LINE2,DEFAULT_CITY,DEFAULT_STATE,DEFAULT_COUNTRY,DEFAULT_ZIP, + WORK_ADDR_LINE1,WORK_ADDR_LINE2,WORK_CITY,WORK_STATE,WORK_COUNTRY,WORK_ZIP, + HOME_ADDR_LINE1,HOME_ADDR_LINE2,HOME_CITY,HOME_STATE,HOME_COUNTRY,HOME_ZIP, + OTHER_ADDR_LINE1,OTHER_ADDR_LINE2,OTHER_CITY,OTHER_STATE,OTHER_COUNTRY,OTHER_ZIP + }ColumnNumber; + + typedef struct { + const gchar *pColumnName; + ColumnNumber value; + }SplitEvoColumns; + + const SplitEvoColumns* get_evo_addr(); + + const ColumnProperty *getField(guint n); + GType getGFieldType(guint nCol) ; + sal_Int32 getFieldType(guint nCol) ; + OUString getFieldTypeName(guint nCol) ; + OUString getFieldName(guint nCol) ; + guint findEvoabField(std::u16string_view aColName); + + void free_column_resources(); + + class OEvoabDatabaseMetaData : public ODatabaseMetaDataBase + { + OEvoabConnection* m_pConnection; + + protected: + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + // cached database information + virtual OUString impl_getIdentifierQuoteString_throw( ) override; + virtual bool impl_isCatalogAtStart_throw( ) override; + virtual OUString impl_getCatalogSeparator_throw( ) override; + virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; + virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ; + virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; + virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ; + virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override ; + virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; + virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; + virtual sal_Int32 impl_getMaxStatements_throw( ) override; + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; + virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; + + virtual ~OEvoabDatabaseMetaData() override; + public: + explicit OEvoabDatabaseMetaData(OEvoabConnection* _pCon); + + // as I mentioned before this interface is really BIG + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual OUString SAL_CALL getUserName( ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; + virtual OUString SAL_CALL getDatabaseProductName( ) override; + virtual OUString SAL_CALL getDatabaseProductVersion( ) override; + virtual OUString SAL_CALL getDriverName( ) override; + virtual OUString SAL_CALL getDriverVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; + virtual sal_Bool SAL_CALL usesLocalFiles( ) override; + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; + + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; + + virtual OUString SAL_CALL getSQLKeywords( ) override; + virtual OUString SAL_CALL getNumericFunctions( ) override; + virtual OUString SAL_CALL getStringFunctions( ) override; + virtual OUString SAL_CALL getSystemFunctions( ) override; + virtual OUString SAL_CALL getTimeDateFunctions( ) override; + virtual OUString SAL_CALL getSearchStringEscape( ) override; + virtual OUString SAL_CALL getExtraNameCharacters( ) override; + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; + virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupBy( ) override; + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; + virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; + virtual OUString SAL_CALL getSchemaTerm( ) override; + virtual OUString SAL_CALL getProcedureTerm( ) override; + virtual OUString SAL_CALL getCatalogTerm( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; + virtual sal_Bool SAL_CALL supportsUnion( ) override; + virtual sal_Bool SAL_CALL supportsUnionAll( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + virtual sal_Int32 SAL_CALL getMaxConnections( ) override; + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; + virtual sal_Bool SAL_CALL supportsTransactions( ) override; + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; + 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; + }; } diff --git a/connectivity/source/drivers/evoab2/NDriver.hxx b/connectivity/source/drivers/evoab2/NDriver.hxx index 4e4e77e8b476..e144e61d2987 100644 --- a/connectivity/source/drivers/evoab2/NDriver.hxx +++ b/connectivity/source/drivers/evoab2/NDriver.hxx @@ -32,45 +32,45 @@ inline constexpr OUString EVOAB_DRIVER_IMPL_NAME = u"com.sun.star.comp.sdbc.evoab.OEvoabDriver"_ustr; namespace connectivity::evoab - { - class OEvoabConnection; +{ + class OEvoabConnection; - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, - css::lang::XServiceInfo > ODriver_BASE; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, + css::lang::XServiceInfo > ODriver_BASE; - class OEvoabDriver final : public ODriver_BASE - { - ::osl::Mutex m_aMutex; - std::vector<unotools::WeakReference<OEvoabConnection>> m_xConnections; - css::uno::Reference< css::uno::XComponentContext > m_xContext; + class OEvoabDriver final : public ODriver_BASE + { + ::osl::Mutex m_aMutex; + std::vector<unotools::WeakReference<OEvoabConnection>> m_xConnections; + css::uno::Reference< css::uno::XComponentContext > m_xContext; - public: - explicit OEvoabDriver(const css::uno::Reference< css::uno::XComponentContext >& ); - virtual ~OEvoabDriver() override; + public: + explicit OEvoabDriver(const css::uno::Reference< css::uno::XComponentContext >& ); + virtual ~OEvoabDriver() override; - // OComponentHelper - virtual void SAL_CALL disposing() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Int32 SAL_CALL getMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getMinorVersion( ) override; + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Int32 SAL_CALL getMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getMinorVersion( ) override; - public: - const css::uno::Reference< css::uno::XComponentContext >& getComponentContext( ) const { return m_xContext; } + public: + const css::uno::Reference< css::uno::XComponentContext >& getComponentContext( ) const { return m_xContext; } - // static methods - static bool acceptsURL_Stat( std::u16string_view url ); - }; + // static methods + static bool acceptsURL_Stat( std::u16string_view url ); + }; } diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx index 076216e0cf42..22463c0ee2d4 100644 --- a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx +++ b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx @@ -33,75 +33,75 @@ namespace connectivity::evoab { - typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement, - css::sdbc::XParameters, - css::sdbc::XResultSetMetaDataSupplier, - css::sdbc::XMultipleResults, - css::lang::XServiceInfo> OPreparedStatement_BASE; + typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement, + css::sdbc::XParameters, + css::sdbc::XResultSetMetaDataSupplier, + css::sdbc::XMultipleResults, + css::lang::XServiceInfo> OPreparedStatement_BASE; - class OEvoabPreparedStatement final:public OCommonStatement - ,public OPreparedStatement_BASE - { - // our SQL statement - OUString m_sSqlStatement; - // the EBookQuery we're working with - QueryData m_aQueryData; - // our meta data - rtl::Reference<OEvoabResultSetMetaData> m_xMetaData; + class OEvoabPreparedStatement final:public OCommonStatement + ,public OPreparedStatement_BASE + { + // our SQL statement + OUString m_sSqlStatement; + // the EBookQuery we're working with + QueryData m_aQueryData; + // our meta data + rtl::Reference<OEvoabResultSetMetaData> m_xMetaData; - virtual ~OEvoabPreparedStatement() override; + virtual ~OEvoabPreparedStatement() override; - public: - explicit OEvoabPreparedStatement( OEvoabConnection* _pConnection ); + public: + explicit OEvoabPreparedStatement( OEvoabConnection* _pConnection ); - void construct( const OUString& _sql ); + void construct( const OUString& _sql ); - DECLARE_SERVICE_INFO(); - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + DECLARE_SERVICE_INFO(); + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPreparedStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; - virtual sal_Int32 SAL_CALL executeUpdate( ) override; - virtual sal_Bool SAL_CALL execute( ) override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; - // XParameters - virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; - virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; - virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; - virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; - virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; - virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; - virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; - virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; - virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; - virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; - virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; - virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; - virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; - virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; - virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; - virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; - virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; - virtual void SAL_CALL clearParameters( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XMultipleResults - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; - virtual sal_Int32 SAL_CALL getUpdateCount( ) override; - virtual sal_Bool SAL_CALL getMoreResults( ) override; - }; + // XPreparedStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; + virtual sal_Int32 SAL_CALL executeUpdate( ) override; + virtual sal_Bool SAL_CALL execute( ) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; + virtual void SAL_CALL clearParameters( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XMultipleResults + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; + virtual sal_Int32 SAL_CALL getUpdateCount( ) override; + virtual sal_Bool SAL_CALL getMoreResults( ) override; + }; } diff --git a/connectivity/source/drivers/evoab2/NResultSet.hxx b/connectivity/source/drivers/evoab2/NResultSet.hxx index 3eeeab244ab3..659fa4ff4b20 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.hxx +++ b/connectivity/source/drivers/evoab2/NResultSet.hxx @@ -43,139 +43,139 @@ namespace connectivity::evoab { - struct ComparisonData; - - class OEvoabVersionHelper - { - public: - virtual EBook* openBook(const char *abname) = 0; - virtual void executeQuery (EBook* pBook, EBookQuery* pQuery) = 0; - virtual void freeContacts() = 0; - virtual bool isLDAP( EBook *pBook ) = 0; - virtual bool isLocal( EBook *pBook ) = 0; - virtual EContact *getContact(sal_Int32 nIndex) = 0; - virtual sal_Int32 getNumContacts() = 0; - virtual bool hasContacts() = 0; - virtual void sortContacts( const ComparisonData& _rCompData ) = 0; - OString getUserName( EBook *pBook ); - virtual ~OEvoabVersionHelper() {} - }; - - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet - , css::sdbc::XRow - , css::sdbc::XResultSetMetaDataSupplier - , css::util::XCancellable - , css::sdbc::XWarningsSupplier - , css::sdbc::XCloseable - , css::sdbc::XColumnLocate - , css::lang::XServiceInfo - > OResultSet_BASE; - - - class OEvoabResultSet final : public cppu::BaseMutex - ,public OResultSet_BASE - ,public ::comphelper::OPropertyContainer - ,public ::comphelper::OPropertyArrayUsageHelper<OEvoabResultSet> + struct ComparisonData; + + class OEvoabVersionHelper + { + public: + virtual EBook* openBook(const char *abname) = 0; + virtual void executeQuery (EBook* pBook, EBookQuery* pQuery) = 0; + virtual void freeContacts() = 0; + virtual bool isLDAP( EBook *pBook ) = 0; + virtual bool isLocal( EBook *pBook ) = 0; + virtual EContact *getContact(sal_Int32 nIndex) = 0; + virtual sal_Int32 getNumContacts() = 0; + virtual bool hasContacts() = 0; + virtual void sortContacts( const ComparisonData& _rCompData ) = 0; + OString getUserName( EBook *pBook ); + virtual ~OEvoabVersionHelper() {} + }; + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet + , css::sdbc::XRow + , css::sdbc::XResultSetMetaDataSupplier + , css::util::XCancellable + , css::sdbc::XWarningsSupplier + , css::sdbc::XCloseable + , css::sdbc::XColumnLocate + , css::lang::XServiceInfo + > OResultSet_BASE; + + + class OEvoabResultSet final : public cppu::BaseMutex + ,public OResultSet_BASE + ,public ::comphelper::OPropertyContainer + ,public ::comphelper::OPropertyArrayUsageHelper<OEvoabResultSet> + { + private: + std::unique_ptr<OEvoabVersionHelper> m_pVersionHelper; + + OCommonStatement* m_pStatement; + OEvoabConnection* m_pConnection; + rtl::Reference<OEvoabResultSetMetaData> m_xMetaData; + ::dbtools::WarningsContainer m_aWarnings; + + bool m_bWasNull; + // <properties> + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + // </properties> + + // Data & iteration + sal_Int32 m_nIndex; + sal_Int32 m_nLength; + EContact *getCur() { - private: - std::unique_ptr<OEvoabVersionHelper> m_pVersionHelper; - - OCommonStatement* m_pStatement; - OEvoabConnection* m_pConnection; - rtl::Reference<OEvoabResultSetMetaData> m_xMetaData; - ::dbtools::WarningsContainer m_aWarnings; - - bool m_bWasNull; - // <properties> - sal_Int32 m_nFetchSize; - sal_Int32 m_nResultSetType; - sal_Int32 m_nFetchDirection; - sal_Int32 m_nResultSetConcurrency; - // </properties> - - // Data & iteration - sal_Int32 m_nIndex; - sal_Int32 m_nLength; - EContact *getCur() - { - return m_pVersionHelper->getContact(m_nIndex); - } - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - // you can't delete objects of this type - virtual ~OEvoabResultSet() override; - public: - DECLARE_SERVICE_INFO(); - - OEvoabResultSet( OCommonStatement *pStmt, OEvoabConnection *pConnection ); - void construct( const QueryData& _rData ); - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XResultSet - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - }; + return m_pVersionHelper->getContact(m_nIndex); + } + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // you can't delete objects of this type + virtual ~OEvoabResultSet() override; + public: + DECLARE_SERVICE_INFO(); + + OEvoabResultSet( OCommonStatement *pStmt, OEvoabConnection *pConnection ); + void construct( const QueryData& _rData ); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XResultSet + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + }; } diff --git a/connectivity/source/drivers/evoab2/NStatement.hxx b/connectivity/source/drivers/evoab2/NStatement.hxx index 02bed5ea318b..302c6d8ac1ad 100644 --- a/connectivity/source/drivers/evoab2/NStatement.hxx +++ b/connectivity/source/drivers/evoab2/NStatement.hxx @@ -45,231 +45,231 @@ namespace connectivity::evoab { - class OEvoabResultSet; - - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier - , css::sdbc::XCloseable - > OCommonStatement_IBase; - - struct FieldSort + class OEvoabResultSet; + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier + , css::sdbc::XCloseable + > OCommonStatement_IBase; + + struct FieldSort + { + sal_Int32 nField; + bool bAscending; + + FieldSort( const sal_Int32 _nField, const bool _bAscending ) : nField( _nField ), bAscending( _bAscending ) { } + }; + typedef std::vector< FieldSort > SortDescriptor; + + enum QueryFilterType + { + eFilterAlwaysFalse, + eFilterNone, + eFilterOther + }; + + class EBookQueryWrapper + { + private: + EBookQuery* mpQuery; + public: + EBookQueryWrapper() + : mpQuery(nullptr) { - sal_Int32 nField; - bool bAscending; - - FieldSort( const sal_Int32 _nField, const bool _bAscending ) : nField( _nField ), bAscending( _bAscending ) { } - }; - typedef std::vector< FieldSort > SortDescriptor; - - enum QueryFilterType + } + EBookQueryWrapper(const EBookQueryWrapper& rhs) + : mpQuery(rhs.mpQuery) { - eFilterAlwaysFalse, - eFilterNone, - eFilterOther - }; - - class EBookQueryWrapper + if (mpQuery) + e_book_query_ref(mpQuery); + } + EBookQueryWrapper(EBookQueryWrapper&& rhs) noexcept + : mpQuery(rhs.mpQuery) + { + rhs.mpQuery = nullptr; + } + void reset(EBookQuery* pQuery) + { + if (mpQuery) + e_book_query_unref(mpQuery); + mpQuery = pQuery; + if (mpQuery) + e_book_query_ref(mpQuery); + } + EBookQueryWrapper& operator=(const EBookQueryWrapper& rhs) { - private: - EBookQuery* mpQuery; - public: - EBookQueryWrapper() - : mpQuery(nullptr) - { - } - EBookQueryWrapper(const EBookQueryWrapper& rhs) - : mpQuery(rhs.mpQuery) - { - if (mpQuery) - e_book_query_ref(mpQuery); - } - EBookQueryWrapper(EBookQueryWrapper&& rhs) noexcept - : mpQuery(rhs.mpQuery) - { - rhs.mpQuery = nullptr; - } - void reset(EBookQuery* pQuery) - { - if (mpQuery) - e_book_query_unref(mpQuery); - mpQuery = pQuery; - if (mpQuery) - e_book_query_ref(mpQuery); - } - EBookQueryWrapper& operator=(const EBookQueryWrapper& rhs) - { - if (this != &rhs) - reset(rhs.mpQuery); - return *this; - } - EBookQueryWrapper& operator=(EBookQueryWrapper&& rhs) - { - if (mpQuery) - e_book_query_unref(mpQuery); - mpQuery = rhs.mpQuery; - rhs.mpQuery = nullptr; - return *this; - } - ~EBookQueryWrapper() - { - if (mpQuery) - e_book_query_unref(mpQuery); - } - EBookQuery* getQuery() const - { - return mpQuery; - } - }; - - struct QueryData + if (this != &rhs) + reset(rhs.mpQuery); + return *this; + } + EBookQueryWrapper& operator=(EBookQueryWrapper&& rhs) { - private: - EBookQueryWrapper aQuery; - - public: - OUString sTable; - QueryFilterType eFilterType; - rtl::Reference<connectivity::OSQLColumns> xSelectColumns; - SortDescriptor aSortOrder; - - QueryData() - : sTable() - , eFilterType( eFilterOther ) - , xSelectColumns() - , aSortOrder() - { - } - - EBookQuery* getQuery() const { return aQuery.getQuery(); } - void setQuery(EBookQuery* pQuery) { aQuery.reset(pQuery); } - }; - - //************ Class: OCommonStatement - // is a base class for the normal statement and for the prepared statement - - class OCommonStatement :public cppu::BaseMutex - ,public OCommonStatement_IBase - ,public ::comphelper::OPropertyContainer - ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement > + if (mpQuery) + e_book_query_unref(mpQuery); + mpQuery = rhs.mpQuery; + rhs.mpQuery = nullptr; + return *this; + } + ~EBookQueryWrapper() { - private: - unotools::WeakReference< OEvoabResultSet> m_xResultSet; // The last ResultSet created - rtl::Reference<OEvoabConnection> m_xConnection; - connectivity::OSQLParser m_aParser; - connectivity::OSQLParseTreeIterator m_aSQLIterator; - connectivity::OSQLParseNode *m_pParseTree; - - // <properties> - OUString m_aCursorName; - sal_Int32 m_nMaxFieldSize; - sal_Int32 m_nMaxRows; - sal_Int32 m_nQueryTimeOut; - sal_Int32 m_nFetchSize; - sal_Int32 m_nResultSetType; - sal_Int32 m_nFetchDirection; - sal_Int32 m_nResultSetConcurrency; - bool m_bEscapeProcessing; - // </properties> - - protected: - - void disposeResultSet(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - virtual ~OCommonStatement() override; - - protected: - void parseSql( const OUString& sql, QueryData& _out_rQueryData ); - EBookQuery *whereAnalysis( const OSQLParseNode* parseTree ); - void orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort ); - OUString getTableName() const; - - public: - - // other methods - OEvoabConnection* getOwnConnection() const { return m_xConnection.get(); } - - using OCommonStatement_IBase::operator css::uno::Reference< css::uno::XInterface >; - - protected: - explicit OCommonStatement( OEvoabConnection* _pConnection ); - - // OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual void SAL_CALL release() noexcept override; - virtual void SAL_CALL acquire() noexcept override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - - // XCloseable - virtual void SAL_CALL close( ) override; - - protected: - /** will return the EBookQuery representing the statement WHERE condition, or throw - - Also, all statement dependent members (such as the parser/iterator) will be inited afterwards. - */ - QueryData - impl_getEBookQuery_throw( const OUString& _rSql ); - - css::uno::Reference< css::sdbc::XResultSet > - impl_executeQuery_throw( const OUString& _rSql ); - - css::uno::Reference< css::sdbc::XResultSet > - impl_executeQuery_throw( const QueryData& _rData ); - - css::uno::Reference< css::sdbc::XConnection > - impl_getConnection() { return css::uno::Reference< css::sdbc::XConnection >( m_xConnection ); } - - OUString - impl_getColumnRefColumnName_throw( const ::connectivity::OSQLParseNode& _rColumnRef ); - }; - - typedef ::cppu::ImplHelper2 < css::lang::XServiceInfo - , css::sdbc::XStatement - > OStatement_IBase; - class OStatement :public OCommonStatement - ,public OStatement_IBase + if (mpQuery) + e_book_query_unref(mpQuery); + } + EBookQuery* getQuery() const { - protected: - virtual ~OStatement() override {} - - public: - explicit OStatement( OEvoabConnection* _pConnection) - :OCommonStatement( _pConnection) - { - } - - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - DECLARE_SERVICE_INFO(); - - // XStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ; - virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ; - virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ; - }; + return mpQuery; + } + }; + + struct QueryData + { + private: + EBookQueryWrapper aQuery; + + public: + OUString sTable; + QueryFilterType eFilterType; + rtl::Reference<connectivity::OSQLColumns> xSelectColumns; + SortDescriptor aSortOrder; + + QueryData() + : sTable() + , eFilterType( eFilterOther ) + , xSelectColumns() + , aSortOrder() + { + } + + EBookQuery* getQuery() const { return aQuery.getQuery(); } + void setQuery(EBookQuery* pQuery) { aQuery.reset(pQuery); } + }; + + //************ Class: OCommonStatement + // is a base class for the normal statement and for the prepared statement + + class OCommonStatement :public cppu::BaseMutex + ,public OCommonStatement_IBase + ,public ::comphelper::OPropertyContainer + ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement > + { + private: + unotools::WeakReference< OEvoabResultSet> m_xResultSet; // The last ResultSet created + rtl::Reference<OEvoabConnection> m_xConnection; + connectivity::OSQLParser m_aParser; + connectivity::OSQLParseTreeIterator m_aSQLIterator; + connectivity::OSQLParseNode *m_pParseTree; + + // <properties> + OUString m_aCursorName; + sal_Int32 m_nMaxFieldSize; + sal_Int32 m_nMaxRows; + sal_Int32 m_nQueryTimeOut; + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + bool m_bEscapeProcessing; + // </properties> + + protected: + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual ~OCommonStatement() override; + + protected: + void parseSql( const OUString& sql, QueryData& _out_rQueryData ); + EBookQuery *whereAnalysis( const OSQLParseNode* parseTree ); + void orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort ); + OUString getTableName() const; + + public: + + // other methods + OEvoabConnection* getOwnConnection() const { return m_xConnection.get(); } + + using OCommonStatement_IBase::operator css::uno::Reference< css::uno::XInterface >; + + protected: + explicit OCommonStatement( OEvoabConnection* _pConnection ); + + // OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual void SAL_CALL release() noexcept override; + virtual void SAL_CALL acquire() noexcept override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + + // XCloseable + virtual void SAL_CALL close( ) override; + + protected: + /** will return the EBookQuery representing the statement WHERE condition, or throw + + Also, all statement dependent members (such as the parser/iterator) will be inited afterwards. + */ + QueryData + impl_getEBookQuery_throw( const OUString& _rSql ); + + css::uno::Reference< css::sdbc::XResultSet > + impl_executeQuery_throw( const OUString& _rSql ); + + css::uno::Reference< css::sdbc::XResultSet > + impl_executeQuery_throw( const QueryData& _rData ); + + css::uno::Reference< css::sdbc::XConnection > + impl_getConnection() { return css::uno::Reference< css::sdbc::XConnection >( m_xConnection ); } + + OUString + impl_getColumnRefColumnName_throw( const ::connectivity::OSQLParseNode& _rColumnRef ); + }; + + typedef ::cppu::ImplHelper2 < css::lang::XServiceInfo + , css::sdbc::XStatement + > OStatement_IBase; + class OStatement :public OCommonStatement + ,public OStatement_IBase + { + protected: + virtual ~OStatement() override {} + + public: + explicit OStatement( OEvoabConnection* _pConnection) + :OCommonStatement( _pConnection) + { + } + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ; + virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ; + virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ; + }; } diff --git a/connectivity/source/drivers/evoab2/NTable.hxx b/connectivity/source/drivers/evoab2/NTable.hxx index 0aa30815b9b5..d28f55404799 100644 --- a/connectivity/source/drivers/evoab2/NTable.hxx +++ b/connectivity/source/drivers/evoab2/NTable.hxx @@ -24,29 +24,29 @@ namespace connectivity::evoab { - typedef connectivity::sdbcx::OTable OEvoabTable_TYPEDEF; + typedef connectivity::sdbcx::OTable OEvoabTable_TYPEDEF; - class OEvoabTable : public OEvoabTable_TYPEDEF - { - OEvoabConnection* m_pConnection; + class OEvoabTable : public OEvoabTable_TYPEDEF + { + OEvoabConnection* m_pConnection; - public: - OEvoabTable( sdbcx::OCollection* _pTables, - OEvoabConnection* _pConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description, - const OUString& SchemaName, - const OUString& CatalogName - ); + public: + OEvoabTable( sdbcx::OCollection* _pTables, + OEvoabConnection* _pConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description, + const OUString& SchemaName, + const OUString& CatalogName + ); - OEvoabConnection* getConnection() { return m_pConnection;} + OEvoabConnection* getConnection() { return m_pConnection;} - virtual void refreshColumns() override; + virtual void refreshColumns() override; - OUString const & getTableName() const { return m_Name; } - OUString const & getSchema() const { return m_SchemaName; } - }; + OUString const & getTableName() const { return m_Name; } + OUString const & getSchema() const { return m_SchemaName; } + }; } diff --git a/connectivity/source/drivers/evoab2/NTables.hxx b/connectivity/source/drivers/evoab2/NTables.hxx index f540ad2833e1..3e81e4d0497a 100644 --- a/connectivity/source/drivers/evoab2/NTables.hxx +++ b/connectivity/source/drivers/evoab2/NTables.hxx @@ -24,21 +24,21 @@ namespace connectivity::evoab { - class OEvoabTables : public sdbcx::OCollection - { - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - public: - OEvoabTables(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, - ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : - sdbcx::OCollection(_rParent,true,_rMutex,_rVector), - m_xMetaData(std::move(_xMetaData)) - {} - virtual void disposing() override; - }; + class OEvoabTables : public sdbcx::OCollection + { + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + public: + OEvoabTables(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, + ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : + sdbcx::OCollection(_rParent,true,_rMutex,_rVector), + m_xMetaData(std::move(_xMetaData)) + {} + virtual void disposing() override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/Blob.hxx b/connectivity/source/drivers/firebird/Blob.hxx index 990108934bf2..80a23459288e 100644 --- a/connectivity/source/drivers/firebird/Blob.hxx +++ b/connectivity/source/drivers/firebird/Blob.hxx @@ -19,81 +19,81 @@ #include <vector> namespace connectivity::firebird +{ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XBlob, + css::io::XInputStream > + Blob_BASE; + + class Blob : + public Blob_BASE { - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XBlob, - css::io::XInputStream > - Blob_BASE; - - class Blob : - public Blob_BASE - { - protected: - ::osl::Mutex m_aMutex; - - isc_db_handle* m_pDatabaseHandle; - isc_tr_handle* m_pTransactionHandle; - // We store our own copy of the blob id as typically the statement - // manages its own blob id, and blobs are independent of a statement - // in firebird. - ISC_QUAD m_blobID; - isc_blob_handle m_blobHandle; - - bool m_bBlobOpened; - sal_Int64 m_nBlobLength; - sal_uInt16 m_nMaxSegmentSize; - sal_Int64 m_nBlobPosition; - - ISC_STATUS_ARRAY m_statusVector; - - /// @throws css::sdbc::SQLException - void ensureBlobIsOpened(); - /** - * Closes the blob and cleans up resources -- can be used to reset - * the blob if we e.g. want to read from the beginning again. - * - * @throws css::sdbc::SQLException - */ - void closeBlob(); - sal_uInt16 getMaximumSegmentSize(); - - public: - Blob(isc_db_handle* pDatabaseHandle, - isc_tr_handle* pTransactionHandle, - ISC_QUAD const & aBlobID); - - bool readOneSegment(std::vector<char>& rDataOut); - - // ---- XBlob ---------------------------------------------------- - virtual sal_Int64 SAL_CALL - length() override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL - getBytes(sal_Int64 aPosition, sal_Int32 aLength) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL - getBinaryStream() override; - virtual sal_Int64 SAL_CALL - position(const css::uno::Sequence< sal_Int8 >& rPattern, - sal_Int64 aStart) override; - virtual sal_Int64 SAL_CALL - positionOfBlob(const css::uno::Reference< css::sdbc::XBlob >& rPattern, - sal_Int64 aStart) override; - - // ---- XInputStream ---------------------------------------------- - virtual sal_Int32 SAL_CALL - readBytes(css::uno::Sequence< sal_Int8 >& rDataOut, - sal_Int32 nBytes) override; - virtual sal_Int32 SAL_CALL - readSomeBytes(css::uno::Sequence< sal_Int8 >& rDataOut, - sal_Int32 nMaximumBytes) override; - virtual void SAL_CALL - skipBytes(sal_Int32 nBytes) override; - virtual sal_Int32 SAL_CALL - available() override; - virtual void SAL_CALL - closeInput() override; - - // ---- OComponentHelper ------------------------------------------ - virtual void SAL_CALL disposing() override; - }; + protected: + ::osl::Mutex m_aMutex; + + isc_db_handle* m_pDatabaseHandle; + isc_tr_handle* m_pTransactionHandle; + // We store our own copy of the blob id as typically the statement + // manages its own blob id, and blobs are independent of a statement + // in firebird. + ISC_QUAD m_blobID; + isc_blob_handle m_blobHandle; + + bool m_bBlobOpened; + sal_Int64 m_nBlobLength; + sal_uInt16 m_nMaxSegmentSize; + sal_Int64 m_nBlobPosition; + + ISC_STATUS_ARRAY m_statusVector; + + /// @throws css::sdbc::SQLException + void ensureBlobIsOpened(); + /** + * Closes the blob and cleans up resources -- can be used to reset + * the blob if we e.g. want to read from the beginning again. + * + * @throws css::sdbc::SQLException + */ + void closeBlob(); + sal_uInt16 getMaximumSegmentSize(); + + public: + Blob(isc_db_handle* pDatabaseHandle, + isc_tr_handle* pTransactionHandle, + ISC_QUAD const & aBlobID); + + bool readOneSegment(std::vector<char>& rDataOut); + + // ---- XBlob ---------------------------------------------------- + virtual sal_Int64 SAL_CALL + length() override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL + getBytes(sal_Int64 aPosition, sal_Int32 aLength) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL + getBinaryStream() override; + virtual sal_Int64 SAL_CALL + position(const css::uno::Sequence< sal_Int8 >& rPattern, + sal_Int64 aStart) override; + virtual sal_Int64 SAL_CALL + positionOfBlob(const css::uno::Reference< css::sdbc::XBlob >& rPattern, + sal_Int64 aStart) override; + + // ---- XInputStream ---------------------------------------------- + virtual sal_Int32 SAL_CALL + readBytes(css::uno::Sequence< sal_Int8 >& rDataOut, + sal_Int32 nBytes) override; + virtual sal_Int32 SAL_CALL + readSomeBytes(css::uno::Sequence< sal_Int8 >& rDataOut, + sal_Int32 nMaximumBytes) override; + virtual void SAL_CALL + skipBytes(sal_Int32 nBytes) override; + virtual sal_Int32 SAL_CALL + available() override; + virtual void SAL_CALL + closeInput() override; + + // ---- OComponentHelper ------------------------------------------ + virtual void SAL_CALL disposing() override; + }; } diff --git a/connectivity/source/drivers/firebird/Catalog.hxx b/connectivity/source/drivers/firebird/Catalog.hxx index 3ffb9238eda7..7ae15960546b 100644 --- a/connectivity/source/drivers/firebird/Catalog.hxx +++ b/connectivity/source/drivers/firebird/Catalog.hxx @@ -12,28 +12,28 @@ #include <sdbcx/VCatalog.hxx> namespace connectivity::firebird +{ + class Catalog: public ::connectivity::sdbcx::OCatalog { - class Catalog: public ::connectivity::sdbcx::OCatalog - { - css::uno::Reference< css::sdbc::XConnection > - m_xConnection; + css::uno::Reference< css::sdbc::XConnection > + m_xConnection; - public: - explicit Catalog(const css::uno::Reference< css::sdbc::XConnection >& rConnection); + public: + explicit Catalog(const css::uno::Reference< css::sdbc::XConnection >& rConnection); - // OCatalog - virtual void refreshTables() override; - virtual void refreshViews() override; + // OCatalog + virtual void refreshTables() override; + virtual void refreshViews() override; - // IRefreshableGroups - virtual void refreshGroups() override; + // IRefreshableGroups + virtual void refreshGroups() override; - // IRefreshableUsers - virtual void refreshUsers() override; + // IRefreshableUsers + virtual void refreshUsers() override; - sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } - sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); } - }; + sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } + sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); } + }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/Clob.hxx b/connectivity/source/drivers/firebird/Clob.hxx index 7fc5459d5d29..385836627e68 100644 --- a/connectivity/source/drivers/firebird/Clob.hxx +++ b/connectivity/source/drivers/firebird/Clob.hxx @@ -18,46 +18,46 @@ #include <rtl/ref.hxx> namespace connectivity::firebird - { - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XClob > - Clob_BASE; +{ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XClob > + Clob_BASE; - class Clob : - public Clob_BASE - { - protected: - ::osl::Mutex m_aMutex; + class Clob : + public Clob_BASE + { + protected: + ::osl::Mutex m_aMutex; - /* - * In Firebird Clob (textual Blob) is a subtype of blob, - * hence we store the data in a Blob, and the Clob class is - * a wrapper around that. - */ - rtl::Reference<connectivity::firebird::Blob> m_aBlob; + /* + * In Firebird Clob (textual Blob) is a subtype of blob, + * hence we store the data in a Blob, and the Clob class is + * a wrapper around that. + */ + rtl::Reference<connectivity::firebird::Blob> m_aBlob; - sal_Int64 m_nCharCount; + sal_Int64 m_nCharCount; - public: - Clob(isc_db_handle* pDatabaseHandle, - isc_tr_handle* pTransactionHandle, - ISC_QUAD const & aBlobID); + public: + Clob(isc_db_handle* pDatabaseHandle, + isc_tr_handle* pTransactionHandle, + ISC_QUAD const & aBlobID); - // ---- XClob ---------------------------------------------------- - virtual sal_Int64 SAL_CALL - length() override; - virtual OUString SAL_CALL - getSubString(sal_Int64 aPosition, sal_Int32 aLength) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL - getCharacterStream() override; - virtual sal_Int64 SAL_CALL - position(const OUString& rPattern, - sal_Int32 aStart) override; - virtual sal_Int64 SAL_CALL - positionOfClob(const ::css::uno::Reference< ::css::sdbc::XClob >& rPattern, - sal_Int64 aStart) override; - // ---- OComponentHelper ------------------------------------------ - virtual void SAL_CALL disposing() override; - }; + // ---- XClob ---------------------------------------------------- + virtual sal_Int64 SAL_CALL + length() override; + virtual OUString SAL_CALL + getSubString(sal_Int64 aPosition, sal_Int32 aLength) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL + getCharacterStream() override; + virtual sal_Int64 SAL_CALL + position(const OUString& rPattern, + sal_Int32 aStart) override; + virtual sal_Int64 SAL_CALL + positionOfClob(const ::css::uno::Reference< ::css::sdbc::XClob >& rPattern, + sal_Int64 aStart) override; + // ---- OComponentHelper ------------------------------------------ + virtual void SAL_CALL disposing() override; + }; } diff --git a/connectivity/source/drivers/firebird/Column.hxx b/connectivity/source/drivers/firebird/Column.hxx index c66287ce5668..13a13052feeb 100644 --- a/connectivity/source/drivers/firebird/Column.hxx +++ b/connectivity/source/drivers/firebird/Column.hxx @@ -11,21 +11,21 @@ #include <connectivity/sdbcx/VColumn.hxx> namespace connectivity::firebird +{ + class Column; + typedef ::comphelper::OIdPropertyArrayUsageHelper<Column> Column_PROP; + class Column : public sdbcx::OColumn, + public Column_PROP { - class Column; - typedef ::comphelper::OIdPropertyArrayUsageHelper<Column> Column_PROP; - class Column : public sdbcx::OColumn, - public Column_PROP - { - OUString m_sAutoIncrement; - protected: - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - Column(); - virtual void construct() override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - }; + OUString m_sAutoIncrement; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + Column(); + virtual void construct() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + }; } diff --git a/connectivity/source/drivers/firebird/Columns.hxx b/connectivity/source/drivers/firebird/Columns.hxx index a211f70d1809..ef3b06bc6a4f 100644 --- a/connectivity/source/drivers/firebird/Columns.hxx +++ b/connectivity/source/drivers/firebird/Columns.hxx @@ -15,15 +15,15 @@ namespace connectivity::firebird { - class Columns: public ::connectivity::OColumnsHelper - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - public: - Columns(Table& rTable, - ::osl::Mutex& rMutex, - const ::std::vector< OUString> &_rVector); - }; + class Columns: public ::connectivity::OColumnsHelper + { + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + public: + Columns(Table& rTable, + ::osl::Mutex& rMutex, + const ::std::vector< OUString> &_rVector); + }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx index 16ac0ffa278d..a0a033f1f1db 100644 --- a/connectivity/source/drivers/firebird/Connection.hxx +++ b/connectivity/source/drivers/firebird/Connection.hxx @@ -42,200 +42,200 @@ #include <com/sun/star/util/XModifiable.hpp> namespace connectivity::firebird - { +{ + + typedef ::cppu::WeakComponentImplHelper< css::document::XDocumentEventListener, + css::lang::XServiceInfo, + css::lang::XUnoTunnel, + css::sdbc::XConnection, + css::sdbc::XWarningsSupplier + > Connection_BASE; + + class OStatementCommonBase; + class FirebirdDriver; + class ODatabaseMetaData; - typedef ::cppu::WeakComponentImplHelper< css::document::XDocumentEventListener, - css::lang::XServiceInfo, - css::lang::XUnoTunnel, - css::sdbc::XConnection, - css::sdbc::XWarningsSupplier - > Connection_BASE; - - class OStatementCommonBase; - class FirebirdDriver; - class ODatabaseMetaData; - - - typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; - typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray; - - class Connection final : public Connection_BASE - { - ::osl::Mutex m_aMutex; - - TTypeInfoVector m_aTypeInfo; // vector containing an entry - // for each row returned by - // DatabaseMetaData.getTypeInfo. - - /** The URL passed to us when opening, i.e. of the form sdbc:* */ - OUString m_sConnectionURL; - /** - * The URL passed to firebird, i.e. either a local file (for a - * temporary .fdb extracted from a .odb or a normal local file) or - * a remote url. - */ - OUString m_sFirebirdURL; - - /* EMBEDDED MODE DATA */ - /** Denotes that we have a database stored within a .odb file. */ - bool m_bIsEmbedded; - - /** - * Handle for the parent DatabaseDocument. We need to notify this - * whenever any data is written to our temporary database so that - * the user is able to save this back to the .odb file. - * - * Note that this is ONLY set in embedded mode. - */ - css::uno::Reference< css::util::XModifiable > - m_xParentDocument; - - /** - * Handle for the folder within the .odb where we store our .fbk - * (Only used if m_bIsEmbedded is true). - */ - css::uno::Reference< css::embed::XStorage > - m_xEmbeddedStorage; - /** - * The temporary folder where we extract the .fbk from a .odb, - * and also store the temporary .fdb - * It is only valid if m_bIsEmbedded is true. - * - * The extracted .fbk is written in firebird.fbk, the temporary - * .fdb is stored as firebird.fdb. - */ - std::unique_ptr< ::utl::TempFileNamed > m_pDatabaseFileDir; - /** - * Path for our extracted .fbk file. - * - * (The temporary .fdb is our m_sFirebirdURL.) - */ - OUString m_sFBKPath; - - void loadDatabaseFile(const OUString& pSrcLocation, const OUString& pTmpLocation); - - /** - * Run the backup service, use nAction = - * isc_action_svc_backup to backup, nAction = isc_action_svc_restore - * to restore. - */ - void runBackupService(const short nAction); - - isc_svc_handle attachServiceManager(); - - void detachServiceManager(isc_svc_handle pServiceHandle); - - /** We are using an external (local) file */ - bool m_bIsFile; - - /* CONNECTION PROPERTIES */ - bool m_bIsAutoCommit; - bool m_bIsReadOnly; - sal_Int32 m_aTransactionIsolation; - - isc_db_handle m_aDBHandle; - isc_tr_handle m_aTransactionHandle; - - css::uno::WeakReference< css::sdbcx::XTablesSupplier> - m_xCatalog; - css::uno::WeakReference< css::sdbc::XDatabaseMetaData > - m_xMetaData; - /** Statements owned by this connection. */ - OWeakRefArray m_aStatements; - - /// @throws css::sdbc::SQLException - void buildTypeInfo(); - - /** - * Creates a new transaction with the desired parameters, if - * necessary discarding an existing transaction. This has to be done - * anytime we change the transaction isolation, or autocommitting. - * - * @throws css::sdbc::SQLException - */ - void setupTransaction(); - void disposeStatements(); - - public: - explicit Connection(); - virtual ~Connection() override; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void construct( const OUString& url, - const css::uno::Sequence< css::beans::PropertyValue >& info); - - const OUString& getConnectionURL() const {return m_sConnectionURL;} - bool isEmbedded() const {return m_bIsEmbedded;} - isc_db_handle& getDBHandle() {return m_aDBHandle;} - /// @throws css::sdbc::SQLException - isc_tr_handle& getTransaction(); - - /** - * Create a new Blob tied to this connection. Blobs are tied to a - * transaction and not to a statement, hence the connection should - * deal with their management. - * - * @throws css::sdbc::SQLException - * @throws css::uno::RuntimeException - */ - css::uno::Reference< css::sdbc::XBlob> - createBlob(ISC_QUAD const * pBlobID); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - css::uno::Reference< css::sdbc::XClob> - createClob(ISC_QUAD const * pBlobID); - - /** - * Create and/or connect to the sdbcx Catalog. This is completely - * unrelated to the SQL "Catalog". - */ - css::uno::Reference< css::sdbcx::XTablesSupplier > - createCatalog(); - - /** - * Backup and store embedded extracted database to the .odb file - */ - void storeDatabase(); - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XServiceInfo - DECLARE_SERVICE_INFO(); - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) override; - static const css::uno::Sequence<sal_Int8> & getUnoTunnelId(); - // XConnection - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; - virtual sal_Bool SAL_CALL getAutoCommit( ) override; - virtual void SAL_CALL commit( ) override; - virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual void SAL_CALL setCatalog( const OUString& catalog ) override; - virtual OUString SAL_CALL getCatalog( ) override; - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; - virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XDocumentEventListener - virtual void SAL_CALL documentEventOccured( const css::document::DocumentEvent& Event ) override; - // css.lang.XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - }; + + typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; + typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray; + + class Connection final : public Connection_BASE + { + ::osl::Mutex m_aMutex; + + TTypeInfoVector m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + + /** The URL passed to us when opening, i.e. of the form sdbc:* */ + OUString m_sConnectionURL; + /** + * The URL passed to firebird, i.e. either a local file (for a + * temporary .fdb extracted from a .odb or a normal local file) or + * a remote url. + */ + OUString m_sFirebirdURL; + + /* EMBEDDED MODE DATA */ + /** Denotes that we have a database stored within a .odb file. */ + bool m_bIsEmbedded; + + /** + * Handle for the parent DatabaseDocument. We need to notify this + * whenever any data is written to our temporary database so that + * the user is able to save this back to the .odb file. + * + * Note that this is ONLY set in embedded mode. + */ + css::uno::Reference< css::util::XModifiable > + m_xParentDocument; + + /** + * Handle for the folder within the .odb where we store our .fbk + * (Only used if m_bIsEmbedded is true). + */ + css::uno::Reference< css::embed::XStorage > + m_xEmbeddedStorage; + /** + * The temporary folder where we extract the .fbk from a .odb, + * and also store the temporary .fdb + * It is only valid if m_bIsEmbedded is true. + * + * The extracted .fbk is written in firebird.fbk, the temporary + * .fdb is stored as firebird.fdb. + */ + std::unique_ptr< ::utl::TempFileNamed > m_pDatabaseFileDir; + /** + * Path for our extracted .fbk file. + * + * (The temporary .fdb is our m_sFirebirdURL.) + */ + OUString m_sFBKPath; + + void loadDatabaseFile(const OUString& pSrcLocation, const OUString& pTmpLocation); + + /** + * Run the backup service, use nAction = + * isc_action_svc_backup to backup, nAction = isc_action_svc_restore + * to restore. + */ + void runBackupService(const short nAction); + + isc_svc_handle attachServiceManager(); + + void detachServiceManager(isc_svc_handle pServiceHandle); + + /** We are using an external (local) file */ + bool m_bIsFile; + + /* CONNECTION PROPERTIES */ + bool m_bIsAutoCommit; + bool m_bIsReadOnly; + sal_Int32 m_aTransactionIsolation; + + isc_db_handle m_aDBHandle; + isc_tr_handle m_aTransactionHandle; + + css::uno::WeakReference< css::sdbcx::XTablesSupplier> + m_xCatalog; + css::uno::WeakReference< css::sdbc::XDatabaseMetaData > + m_xMetaData; + /** Statements owned by this connection. */ + OWeakRefArray m_aStatements; + + /// @throws css::sdbc::SQLException + void buildTypeInfo(); + + /** + * Creates a new transaction with the desired parameters, if + * necessary discarding an existing transaction. This has to be done + * anytime we change the transaction isolation, or autocommitting. + * + * @throws css::sdbc::SQLException + */ + void setupTransaction(); + void disposeStatements(); + + public: + explicit Connection(); + virtual ~Connection() override; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void construct( const OUString& url, + const css::uno::Sequence< css::beans::PropertyValue >& info); + + const OUString& getConnectionURL() const {return m_sConnectionURL;} + bool isEmbedded() const {return m_bIsEmbedded;} + isc_db_handle& getDBHandle() {return m_aDBHandle;} + /// @throws css::sdbc::SQLException + isc_tr_handle& getTransaction(); + + /** + * Create a new Blob tied to this connection. Blobs are tied to a + * transaction and not to a statement, hence the connection should + * deal with their management. + * + * @throws css::sdbc::SQLException + * @throws css::uno::RuntimeException + */ + css::uno::Reference< css::sdbc::XBlob> + createBlob(ISC_QUAD const * pBlobID); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + css::uno::Reference< css::sdbc::XClob> + createClob(ISC_QUAD const * pBlobID); + + /** + * Create and/or connect to the sdbcx Catalog. This is completely + * unrelated to the SQL "Catalog". + */ + css::uno::Reference< css::sdbcx::XTablesSupplier > + createCatalog(); + + /** + * Backup and store embedded extracted database to the .odb file + */ + void storeDatabase(); + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XServiceInfo + DECLARE_SERVICE_INFO(); + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) override; + static const css::uno::Sequence<sal_Int8> & getUnoTunnelId(); + // XConnection + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; + virtual sal_Bool SAL_CALL getAutoCommit( ) override; + virtual void SAL_CALL commit( ) override; + virtual void SAL_CALL rollback( ) override; + virtual sal_Bool SAL_CALL isClosed( ) override; + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual void SAL_CALL setCatalog( const OUString& catalog ) override; + virtual OUString SAL_CALL getCatalog( ) override; + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; + virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XDocumentEventListener + virtual void SAL_CALL documentEventOccured( const css::document::DocumentEvent& Event ) override; + // css.lang.XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + }; } diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx index bf038fe17a6f..ca6155ed4ca1 100644 --- a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx +++ b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx @@ -30,206 +30,206 @@ #include <rtl/ref.hxx> namespace connectivity::firebird - { +{ + + //************ Class: ODatabaseMetaData + - //************ Class: ODatabaseMetaData - - - typedef ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData3> ODatabaseMetaData_BASE; - - class ODatabaseMetaData : public ODatabaseMetaData_BASE - { - ::rtl::Reference<Connection> m_pConnection; - private: - css::uno::Reference< css::sdbc::XResultSet > lcl_getKeys( bool bIsImport, std::u16string_view table ); - public: - - explicit ODatabaseMetaData(Connection* _pCon); - virtual ~ODatabaseMetaData() override; - - // as I mentioned before this interface is really BIG - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual OUString SAL_CALL getUserName( ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; - virtual OUString SAL_CALL getDatabaseProductName( ) override; - virtual OUString SAL_CALL getDatabaseProductVersion( ) override; - virtual OUString SAL_CALL getDriverName( ) override; - virtual OUString SAL_CALL getDriverVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; - virtual sal_Bool SAL_CALL usesLocalFiles( ) override; - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) override; - virtual OUString SAL_CALL getIdentifierQuoteString( ) override; - virtual OUString SAL_CALL getSQLKeywords( ) override; - virtual OUString SAL_CALL getNumericFunctions( ) override; - virtual OUString SAL_CALL getStringFunctions( ) override; - virtual OUString SAL_CALL getSystemFunctions( ) override; - virtual OUString SAL_CALL getTimeDateFunctions( ) override; - virtual OUString SAL_CALL getSearchStringEscape( ) override; - virtual OUString SAL_CALL getExtraNameCharacters( ) override; - virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; - virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; - virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupBy( ) override; - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; - virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; - virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; - virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; - virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; - virtual OUString SAL_CALL getSchemaTerm( ) override; - virtual OUString SAL_CALL getProcedureTerm( ) override; - virtual OUString SAL_CALL getCatalogTerm( ) override; - virtual sal_Bool SAL_CALL isCatalogAtStart( ) override; - virtual OUString SAL_CALL getCatalogSeparator( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; - virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; - virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; - virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; - virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; - virtual sal_Bool SAL_CALL supportsUnion( ) override; - virtual sal_Bool SAL_CALL supportsUnionAll( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - virtual sal_Int32 SAL_CALL getMaxConnections( ) override; - virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; - virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; - virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; - virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; - virtual sal_Int32 SAL_CALL getMaxStatements( ) override; - virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; - virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; - virtual sal_Bool SAL_CALL supportsTransactions( ) override; - virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; - virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; - virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; - virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; - virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; - virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; - virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; - 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; - }; + typedef ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData3> ODatabaseMetaData_BASE; + + class ODatabaseMetaData : public ODatabaseMetaData_BASE + { + ::rtl::Reference<Connection> m_pConnection; + private: + css::uno::Reference< css::sdbc::XResultSet > lcl_getKeys( bool bIsImport, std::u16string_view table ); + public: + + explicit ODatabaseMetaData(Connection* _pCon); + virtual ~ODatabaseMetaData() override; + + // as I mentioned before this interface is really BIG + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual OUString SAL_CALL getUserName( ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; + virtual OUString SAL_CALL getDatabaseProductName( ) override; + virtual OUString SAL_CALL getDatabaseProductVersion( ) override; + virtual OUString SAL_CALL getDriverName( ) override; + virtual OUString SAL_CALL getDriverVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; + virtual sal_Bool SAL_CALL usesLocalFiles( ) override; + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) override; + virtual OUString SAL_CALL getIdentifierQuoteString( ) override; + virtual OUString SAL_CALL getSQLKeywords( ) override; + virtual OUString SAL_CALL getNumericFunctions( ) override; + virtual OUString SAL_CALL getStringFunctions( ) override; + virtual OUString SAL_CALL getSystemFunctions( ) override; + virtual OUString SAL_CALL getTimeDateFunctions( ) override; + virtual OUString SAL_CALL getSearchStringEscape( ) override; + virtual OUString SAL_CALL getExtraNameCharacters( ) override; + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; + virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupBy( ) override; + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; + virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; + virtual OUString SAL_CALL getSchemaTerm( ) override; + virtual OUString SAL_CALL getProcedureTerm( ) override; + virtual OUString SAL_CALL getCatalogTerm( ) override; + virtual sal_Bool SAL_CALL isCatalogAtStart( ) override; + virtual OUString SAL_CALL getCatalogSeparator( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; + virtual sal_Bool SAL_CALL supportsUnion( ) override; + virtual sal_Bool SAL_CALL supportsUnionAll( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + virtual sal_Int32 SAL_CALL getMaxConnections( ) override; + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; + virtual sal_Int32 SAL_CALL getMaxStatements( ) override; + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; + virtual sal_Bool SAL_CALL supportsTransactions( ) override; + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; + 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; + }; } diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx index f126413aba94..5428568b4166 100644 --- a/connectivity/source/drivers/firebird/Driver.hxx +++ b/connectivity/source/drivers/firebird/Driver.hxx @@ -30,62 +30,62 @@ #include <unotools/weakref.hxx> namespace connectivity::firebird - { - // The SQL dialect in use - // Has to be used in various isc_* calls. - // 3: Is IB6 -- minimum required for delimited identifiers. - // SQL_DIALECT_V6 = 3, it's the last current version - // SQL_DIALECT_CURRENT is an alias for SQL_DIALECT_V6 - // See src/dsql/sqlda_pub.h for full details +{ + // The SQL dialect in use + // Has to be used in various isc_* calls. + // 3: Is IB6 -- minimum required for delimited identifiers. + // SQL_DIALECT_V6 = 3, it's the last current version + // SQL_DIALECT_CURRENT is an alias for SQL_DIALECT_V6 + // See src/dsql/sqlda_pub.h for full details - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, - css::sdbcx::XDataDefinitionSupplier, - css::lang::XServiceInfo > ODriver_BASE; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, + css::sdbcx::XDataDefinitionSupplier, + css::lang::XServiceInfo > ODriver_BASE; - class FirebirdDriver : public ODriver_BASE - { - private: - css::uno::Reference<css::uno::XComponentContext> m_aContext; - ::utl::TempFileNamed m_firebirdTMPDirectory; - ::utl::TempFileNamed m_firebirdLockDirectory; + class FirebirdDriver : public ODriver_BASE + { + private: + css::uno::Reference<css::uno::XComponentContext> m_aContext; + ::utl::TempFileNamed m_firebirdTMPDirectory; + ::utl::TempFileNamed m_firebirdLockDirectory; - protected: - ::osl::Mutex m_aMutex; // mutex is need to control member access - std::vector<unotools::WeakReference<Connection>> - m_xConnections; // vector containing a list - // of all the Connection objects - // for this Driver + protected: + ::osl::Mutex m_aMutex; // mutex is need to control member access + std::vector<unotools::WeakReference<Connection>> + m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver - public: + public: - explicit FirebirdDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); - virtual ~FirebirdDriver() override; - const css::uno::Reference<css::uno::XComponentContext>& getContext() const { return m_aContext; } + explicit FirebirdDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); + virtual ~FirebirdDriver() override; + const css::uno::Reference<css::uno::XComponentContext>& getContext() const { return m_aContext; } - // OComponentHelper - virtual void SAL_CALL disposing() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Int32 SAL_CALL getMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getMinorVersion( ) override; + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Int32 SAL_CALL getMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getMinorVersion( ) override; - // XDataDefinitionSupplier - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > - SAL_CALL getDataDefinitionByConnection( - const css::uno::Reference< css::sdbc::XConnection >& rxConnection) override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > - SAL_CALL getDataDefinitionByURL( - const OUString& rsURL, - const css::uno::Sequence< css::beans::PropertyValue >& rInfo) override; - }; + // XDataDefinitionSupplier + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > + SAL_CALL getDataDefinitionByConnection( + const css::uno::Reference< css::sdbc::XConnection >& rxConnection) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > + SAL_CALL getDataDefinitionByURL( + const OUString& rsURL, + const css::uno::Sequence< css::beans::PropertyValue >& rInfo) override; + }; } diff --git a/connectivity/source/drivers/firebird/Indexes.hxx b/connectivity/source/drivers/firebird/Indexes.hxx index 12d7dd198028..58991e23a788 100644 --- a/connectivity/source/drivers/firebird/Indexes.hxx +++ b/connectivity/source/drivers/firebird/Indexes.hxx @@ -14,25 +14,25 @@ #include <connectivity/TIndexes.hxx> namespace connectivity::firebird - { +{ - /** - * Firebird has a non-standard DROP INDEX statement, hence we need - * to override OIndexesHelper::dropObject - */ - class Indexes: public ::connectivity::OIndexesHelper - { - private: - Table* m_pTable; - protected: - // XDrop - virtual void dropObject(sal_Int32 nPosition, - const OUString& sIndexName) override; - public: - Indexes(Table* pTable, - ::osl::Mutex& rMutex, - const std::vector< OUString>& rVector); - }; + /** + * Firebird has a non-standard DROP INDEX statement, hence we need + * to override OIndexesHelper::dropObject + */ + class Indexes: public ::connectivity::OIndexesHelper + { + private: + Table* m_pTable; + protected: + // XDrop + virtual void dropObject(sal_Int32 nPosition, + const OUString& sIndexName) override; + public: + Indexes(Table* pTable, + ::osl::Mutex& rMutex, + const std::vector< OUString>& rVector); + }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/Keys.hxx b/connectivity/source/drivers/firebird/Keys.hxx index 4e9ba5a7eede..fb3d3ca036d4 100644 --- a/connectivity/source/drivers/firebird/Keys.hxx +++ b/connectivity/source/drivers/firebird/Keys.hxx @@ -12,24 +12,24 @@ #include <connectivity/TKeys.hxx> namespace connectivity::firebird - { +{ - class Table; + class Table; - class Keys: public ::connectivity::OKeysHelper - { - private: - Table* m_pTable; + class Keys: public ::connectivity::OKeysHelper + { + private: + Table* m_pTable; - public: - Keys(Table* pTable, - ::osl::Mutex& rMutex, - const ::std::vector< OUString>& rNames); + public: + Keys(Table* pTable, + ::osl::Mutex& rMutex, + const ::std::vector< OUString>& rNames); - // OKeysHelper / XDrop - void dropObject(sal_Int32 nPosition, const OUString& sName) override; + // OKeysHelper / XDrop + void dropObject(sal_Int32 nPosition, const OUString& sName) override; - }; + }; } diff --git a/connectivity/source/drivers/firebird/PreparedStatement.hxx b/connectivity/source/drivers/firebird/PreparedStatement.hxx index 96f687c38123..1c0fbb8f13f0 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.hxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.hxx @@ -32,120 +32,120 @@ #include <ibase.h> namespace connectivity::firebird +{ + class OResultSetMetaData; + class OBoundParam; + typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement, + css::sdbc::XParameters, + css::sdbc::XPreparedBatchExecution, + css::sdbc::XResultSetMetaDataSupplier, + css::lang::XServiceInfo> OPreparedStatement_Base; + + class OPreparedStatement : public OStatementCommonBase, + public OPreparedStatement_Base { - class OResultSetMetaData; - class OBoundParam; - typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement, - css::sdbc::XParameters, - css::sdbc::XPreparedBatchExecution, - css::sdbc::XResultSetMetaDataSupplier, - css::lang::XServiceInfo> OPreparedStatement_Base; - - class OPreparedStatement : public OStatementCommonBase, - public OPreparedStatement_Base - { - protected: - OUString m_sSqlStatement; - rtl::Reference<OResultSetMetaData> m_xMetaData; - - XSQLDA* m_pOutSqlda; - XSQLDA* m_pInSqlda; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void checkParameterIndex(sal_Int32 nParameterIndex); - - /** - * Set a numeric value in the input SQLDA. If the destination - * parameter is not of nType then an Exception will be thrown. - * - * @throws css::sdbc::SQLException - * @throws css::uno::RuntimeException - */ - template <typename T> void setValue(sal_Int32 nIndex, const T& nValue, ISC_SHORT nType); - void setParameterNull(sal_Int32 nParameterIndex, bool bSetNull = true); - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void ensurePrepared(); - /** - * Assumes that all necessary mutexes have been taken. - */ - void openBlobForWriting(isc_blob_handle& rBlobHandle, ISC_QUAD& rBlobId); - /** - * Assumes that all necessary mutexes have been taken. - */ - void closeBlobAfterWriting(isc_blob_handle& rBlobHandle); - void setClob(sal_Int32 nParamIndex, std::u16string_view rStr); - - protected: - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, - const css::uno::Any& rValue) override; - virtual ~OPreparedStatement() override; - public: - DECLARE_SERVICE_INFO(); - // a constructor, which is required for returning objects: - OPreparedStatement( Connection* _pConnection, - const OUString& sql); - - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPreparedStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL - executeQuery() override; - virtual sal_Int32 SAL_CALL - executeUpdate() override; - virtual sal_Bool SAL_CALL - execute() override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL - getConnection() override; - - // XParameters - virtual void SAL_CALL setNull(sal_Int32 nIndex, sal_Int32 nValue) override; - virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; - virtual void SAL_CALL setBoolean( sal_Int32 nIndex, sal_Bool nValue) override; - virtual void SAL_CALL setByte(sal_Int32 nIndex, sal_Int8 nValue) override; - virtual void SAL_CALL setShort(sal_Int32 nIndex, sal_Int16 nValue) override; - virtual void SAL_CALL setInt(sal_Int32 nIndex, sal_Int32 nValue) override; - virtual void SAL_CALL setLong(sal_Int32 nIndex, sal_Int64 nValue) override; - virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; - virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; - virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; - virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; - virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; - virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; - virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; - virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; - virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; - virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; - virtual void SAL_CALL clearParameters( ) override; - - // XPreparedBatchExecution -- UNSUPPORTED by firebird - virtual void SAL_CALL - addBatch() override; - virtual void SAL_CALL - clearBatch() override; - virtual css::uno::Sequence< sal_Int32 > SAL_CALL - executeBatch() override; - - // XCloseable - virtual void SAL_CALL close() override; - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - - }; + protected: + OUString m_sSqlStatement; + rtl::Reference<OResultSetMetaData> m_xMetaData; + + XSQLDA* m_pOutSqlda; + XSQLDA* m_pInSqlda; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void checkParameterIndex(sal_Int32 nParameterIndex); + + /** + * Set a numeric value in the input SQLDA. If the destination + * parameter is not of nType then an Exception will be thrown. + * + * @throws css::sdbc::SQLException + * @throws css::uno::RuntimeException + */ + template <typename T> void setValue(sal_Int32 nIndex, const T& nValue, ISC_SHORT nType); + void setParameterNull(sal_Int32 nParameterIndex, bool bSetNull = true); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void ensurePrepared(); + /** + * Assumes that all necessary mutexes have been taken. + */ + void openBlobForWriting(isc_blob_handle& rBlobHandle, ISC_QUAD& rBlobId); + /** + * Assumes that all necessary mutexes have been taken. + */ + void closeBlobAfterWriting(isc_blob_handle& rBlobHandle); + void setClob(sal_Int32 nParamIndex, std::u16string_view rStr); + + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, + const css::uno::Any& rValue) override; + virtual ~OPreparedStatement() override; + public: + DECLARE_SERVICE_INFO(); + // a constructor, which is required for returning objects: + OPreparedStatement( Connection* _pConnection, + const OUString& sql); + + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPreparedStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL + executeQuery() override; + virtual sal_Int32 SAL_CALL + executeUpdate() override; + virtual sal_Bool SAL_CALL + execute() override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL + getConnection() override; + + // XParameters + virtual void SAL_CALL setNull(sal_Int32 nIndex, sal_Int32 nValue) override; + virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; + virtual void SAL_CALL setBoolean( sal_Int32 nIndex, sal_Bool nValue) override; + virtual void SAL_CALL setByte(sal_Int32 nIndex, sal_Int8 nValue) override; + virtual void SAL_CALL setShort(sal_Int32 nIndex, sal_Int16 nValue) override; + virtual void SAL_CALL setInt(sal_Int32 nIndex, sal_Int32 nValue) override; + virtual void SAL_CALL setLong(sal_Int32 nIndex, sal_Int64 nValue) override; + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; + virtual void SAL_CALL clearParameters( ) override; + + // XPreparedBatchExecution -- UNSUPPORTED by firebird + virtual void SAL_CALL + addBatch() override; + virtual void SAL_CALL + clearBatch() override; + virtual css::uno::Sequence< sal_Int32 > SAL_CALL + executeBatch() override; + + // XCloseable + virtual void SAL_CALL close() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + + }; } diff --git a/connectivity/source/drivers/firebird/ResultSet.hxx b/connectivity/source/drivers/firebird/ResultSet.hxx index 046be37c567a..66814748bd6b 100644 --- a/connectivity/source/drivers/firebird/ResultSet.hxx +++ b/connectivity/source/drivers/firebird/ResultSet.hxx @@ -38,181 +38,181 @@ #include <type_traits> namespace connectivity::firebird +{ + class OResultSetMetaData; + /* + ** OResultSet + */ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate, + css::lang::XServiceInfo> OResultSet_BASE; + + /** + * This ResultSet does not deal with the management of the SQLDA + * it is supplied with. The owner must manage its SQLDA appropriately + * and ensure that the ResultSet is destroyed before disposing of the + * SQLDA. + */ + class OResultSet: public OResultSet_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> { - class OResultSetMetaData; - /* - ** OResultSet - */ - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate, - css::lang::XServiceInfo> OResultSet_BASE; - - /** - * This ResultSet does not deal with the management of the SQLDA - * it is supplied with. The owner must manage its SQLDA appropriately - * and ensure that the ResultSet is destroyed before disposing of the - * SQLDA. - */ - class OResultSet: public OResultSet_BASE, - public ::comphelper::OPropertyContainer, - public ::comphelper::OPropertyArrayUsageHelper<OResultSet> - { - private: - bool m_bIsBookmarkable; - sal_Int32 m_nFetchSize; - sal_Int32 m_nResultSetType; - sal_Int32 m_nFetchDirection; - sal_Int32 m_nResultSetConcurrency; - - protected: - // Connection kept alive by m_xStatement - Connection* m_pConnection; - ::osl::Mutex& m_rMutex; - const css::uno::Reference< css::uno::XInterface >& m_xStatement; - - rtl::Reference<OResultSetMetaData> m_xMetaData; - - XSQLDA* m_pSqlda; - isc_stmt_handle m_statementHandle; - - bool m_bWasNull; - // Row numbering starts with 0 for "in front of first row" - sal_Int32 m_currentRow; - bool m_bIsAfterLastRow; - - const sal_Int32 m_fieldCount; - ISC_STATUS_ARRAY m_statusVector; - - bool isNull(const sal_Int32 nColumnIndex); - - template <typename T> requires std::is_integral_v<T> - OUString makeNumericString(const sal_Int32 nColumnIndex); - - template <typename T> T retrieveValue(const sal_Int32 nColumnIndex, - const ISC_SHORT nType); - - template <typename T> T safelyRetrieveValue( - const sal_Int32 nColumnIndex, - const ISC_SHORT nType = 0); - - // OIdPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void checkColumnIndex( sal_Int32 index ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void checkRowIndex(); - - // you can't delete objects of this type - virtual ~OResultSet() override; - public: - DECLARE_SERVICE_INFO(); - - OResultSet(Connection* pConnection, - ::osl::Mutex& rMutex, - const css::uno::Reference< css::uno::XInterface >& xStatement, - isc_stmt_handle aStatementHandle, - XSQLDA* aSqlda - ); - - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( - const css::uno::Type& rType) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XResultSet - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn(const OUString& columnName) override; - - }; - - // Specialisations have to be in the namespace and can't be within the class. - template <> css::util::Date - OResultSet::retrieveValue( - const sal_Int32 nColumnIndex, - const ISC_SHORT nType); - template <> ::connectivity::ORowSetValue - OResultSet::retrieveValue( - const sal_Int32 nColumnIndex, - const ISC_SHORT nType); - template <> css::util::Time - OResultSet::retrieveValue( - const sal_Int32 nColumnIndex, - const ISC_SHORT nType); - template <> css::util::DateTime - OResultSet::retrieveValue( - const sal_Int32 nColumnIndex, - const ISC_SHORT nType); - template <> ISC_QUAD* - OResultSet::retrieveValue( - const sal_Int32 nColumnIndex, - const ISC_SHORT nType); - template <> OUString - OResultSet::retrieveValue( + private: + bool m_bIsBookmarkable; + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + + protected: + // Connection kept alive by m_xStatement + Connection* m_pConnection; + ::osl::Mutex& m_rMutex; + const css::uno::Reference< css::uno::XInterface >& m_xStatement; + + rtl::Reference<OResultSetMetaData> m_xMetaData; + + XSQLDA* m_pSqlda; + isc_stmt_handle m_statementHandle; + + bool m_bWasNull; + // Row numbering starts with 0 for "in front of first row" + sal_Int32 m_currentRow; + bool m_bIsAfterLastRow; + + const sal_Int32 m_fieldCount; + ISC_STATUS_ARRAY m_statusVector; + + bool isNull(const sal_Int32 nColumnIndex); + + template <typename T> requires std::is_integral_v<T> + OUString makeNumericString(const sal_Int32 nColumnIndex); + + template <typename T> T retrieveValue(const sal_Int32 nColumnIndex, + const ISC_SHORT nType); + + template <typename T> T safelyRetrieveValue( const sal_Int32 nColumnIndex, - const ISC_SHORT nType); - template <> ISC_QUAD* - OResultSet::retrieveValue( - const sal_Int32 nColumnIndex, - const ISC_SHORT nType); + const ISC_SHORT nType = 0); + + // OIdPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void checkColumnIndex( sal_Int32 index ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void checkRowIndex(); + + // you can't delete objects of this type + virtual ~OResultSet() override; + public: + DECLARE_SERVICE_INFO(); + + OResultSet(Connection* pConnection, + ::osl::Mutex& rMutex, + const css::uno::Reference< css::uno::XInterface >& xStatement, + isc_stmt_handle aStatementHandle, + XSQLDA* aSqlda + ); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( + const css::uno::Type& rType) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XResultSet + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn(const OUString& columnName) override; + + }; + + // Specialisations have to be in the namespace and can't be within the class. + template <> css::util::Date + OResultSet::retrieveValue( + const sal_Int32 nColumnIndex, + const ISC_SHORT nType); + template <> ::connectivity::ORowSetValue + OResultSet::retrieveValue( + const sal_Int32 nColumnIndex, + const ISC_SHORT nType); + template <> css::util::Time + OResultSet::retrieveValue( + const sal_Int32 nColumnIndex, + const ISC_SHORT nType); + template <> css::util::DateTime + OResultSet::retrieveValue( + const sal_Int32 nColumnIndex, + const ISC_SHORT nType); + template <> ISC_QUAD* + OResultSet::retrieveValue( + const sal_Int32 nColumnIndex, + const ISC_SHORT nType); + template <> OUString + OResultSet::retrieveValue( + const sal_Int32 nColumnIndex, + const ISC_SHORT nType); + template <> ISC_QUAD* + OResultSet::retrieveValue( + const sal_Int32 nColumnIndex, + const ISC_SHORT nType); } diff --git a/connectivity/source/drivers/firebird/ResultSetMetaData.hxx b/connectivity/source/drivers/firebird/ResultSetMetaData.hxx index a32c206213aa..6509e29819c9 100644 --- a/connectivity/source/drivers/firebird/ResultSetMetaData.hxx +++ b/connectivity/source/drivers/firebird/ResultSetMetaData.hxx @@ -29,51 +29,51 @@ #include <com/sun/star/sdbc/XResultSetMetaData.hpp> namespace connectivity::firebird - { - typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> - OResultSetMetaData_BASE; +{ + typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> + OResultSetMetaData_BASE; - class OResultSetMetaData : public OResultSetMetaData_BASE - { - protected: - ::rtl::Reference<Connection> m_pConnection; - XSQLDA* m_pSqlda; + class OResultSetMetaData : public OResultSetMetaData_BASE + { + protected: + ::rtl::Reference<Connection> m_pConnection; + XSQLDA* m_pSqlda; - virtual ~OResultSetMetaData() override; + virtual ~OResultSetMetaData() override; - /// @throws css::sdbc::SQLException - void verifyValidColumn(sal_Int32 column); - OUString getCharacterSet(sal_Int32 nIndex); - public: - // a constructor, which is required for returning objects: - OResultSetMetaData(Connection* pConnection, - XSQLDA* pSqlda) - : m_pConnection(pConnection) - , m_pSqlda(pSqlda) - {} + /// @throws css::sdbc::SQLException + void verifyValidColumn(sal_Int32 column); + OUString getCharacterSet(sal_Int32 nIndex); + public: + // a constructor, which is required for returning objects: + OResultSetMetaData(Connection* pConnection, + XSQLDA* pSqlda) + : m_pConnection(pConnection) + , m_pSqlda(pSqlda) + {} - virtual sal_Int32 SAL_CALL getColumnCount() override; - virtual sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column) override; - virtual sal_Bool SAL_CALL isCaseSensitive(sal_Int32 column) override; - virtual sal_Bool SAL_CALL isSearchable(sal_Int32 column) override; - virtual sal_Bool SAL_CALL isCurrency(sal_Int32 column) override; - virtual sal_Int32 SAL_CALL isNullable(sal_Int32 column) override; - virtual sal_Bool SAL_CALL isSigned(sal_Int32 column) override; - virtual sal_Int32 SAL_CALL getColumnDisplaySize(sal_Int32 column) override; - virtual OUString SAL_CALL getColumnLabel(sal_Int32 column) override; - virtual OUString SAL_CALL getColumnName(sal_Int32 column) override; - virtual OUString SAL_CALL getSchemaName(sal_Int32 column) override; - virtual sal_Int32 SAL_CALL getPrecision(sal_Int32 column) override; - virtual sal_Int32 SAL_CALL getScale(sal_Int32 column) override; - virtual OUString SAL_CALL getTableName(sal_Int32 column) override; - virtual OUString SAL_CALL getCatalogName(sal_Int32 column) override; - virtual sal_Int32 SAL_CALL getColumnType(sal_Int32 column) override; - virtual OUString SAL_CALL getColumnTypeName(sal_Int32 column) override; - virtual sal_Bool SAL_CALL isReadOnly(sal_Int32 column) override; - virtual sal_Bool SAL_CALL isWritable(sal_Int32 column) override; - virtual sal_Bool SAL_CALL isDefinitelyWritable(sal_Int32 column) override; - virtual OUString SAL_CALL getColumnServiceName(sal_Int32 column) override; - }; + virtual sal_Int32 SAL_CALL getColumnCount() override; + virtual sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column) override; + virtual sal_Bool SAL_CALL isCaseSensitive(sal_Int32 column) override; + virtual sal_Bool SAL_CALL isSearchable(sal_Int32 column) override; + virtual sal_Bool SAL_CALL isCurrency(sal_Int32 column) override; + virtual sal_Int32 SAL_CALL isNullable(sal_Int32 column) override; + virtual sal_Bool SAL_CALL isSigned(sal_Int32 column) override; + virtual sal_Int32 SAL_CALL getColumnDisplaySize(sal_Int32 column) override; + virtual OUString SAL_CALL getColumnLabel(sal_Int32 column) override; + virtual OUString SAL_CALL getColumnName(sal_Int32 column) override; + virtual OUString SAL_CALL getSchemaName(sal_Int32 column) override; + virtual sal_Int32 SAL_CALL getPrecision(sal_Int32 column) override; + virtual sal_Int32 SAL_CALL getScale(sal_Int32 column) override; + virtual OUString SAL_CALL getTableName(sal_Int32 column) override; + virtual OUString SAL_CALL getCatalogName(sal_Int32 column) override; + virtual sal_Int32 SAL_CALL getColumnType(sal_Int32 column) override; + virtual OUString SAL_CALL getColumnTypeName(sal_Int32 column) override; + virtual sal_Bool SAL_CALL isReadOnly(sal_Int32 column) override; + virtual sal_Bool SAL_CALL isWritable(sal_Int32 column) override; + virtual sal_Bool SAL_CALL isDefinitelyWritable(sal_Int32 column) override; + virtual OUString SAL_CALL getColumnServiceName(sal_Int32 column) override; + }; } diff --git a/connectivity/source/drivers/firebird/Statement.hxx b/connectivity/source/drivers/firebird/Statement.hxx index d1b967def1d5..6e501633a88f 100644 --- a/connectivity/source/drivers/firebird/Statement.hxx +++ b/connectivity/source/drivers/firebird/Statement.hxx @@ -25,59 +25,59 @@ #include <com/sun/star/sdbc/XBatchExecution.hpp> namespace connectivity::firebird - { +{ + + typedef ::cppu::ImplHelper1< css::sdbc::XStatement > + OStatement_Base; - typedef ::cppu::ImplHelper1< css::sdbc::XStatement > - OStatement_Base; - - class OStatement : public OStatementCommonBase, - public OStatement_Base, - public css::sdbc::XBatchExecution, - public css::lang::XServiceInfo - { - XSQLDA* m_pSqlda; - protected: - virtual ~OStatement() override {} - - public: - // a constructor, which is required for returning objects: - explicit OStatement( Connection* _pConnection) - : OStatementCommonBase( _pConnection), - m_pSqlda(nullptr) - {} - - virtual void disposeResultSet() override; - - DECLARE_SERVICE_INFO(); - - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL - executeQuery(const OUString& sql) override; - virtual sal_Int32 SAL_CALL executeUpdate(const OUString& sqlIn) override; - virtual sal_Bool SAL_CALL - execute(const OUString& sql) override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL - getConnection() override; - - // XBatchExecution - UNSUPPORTED - virtual void SAL_CALL addBatch( const OUString& sql ) override; - virtual void SAL_CALL clearBatch( ) override; - virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; - - // XInterface - virtual css::uno::Any SAL_CALL - queryInterface(const css::uno::Type & rType) override; - - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL - getTypes() override; - // OComponentHelper - virtual void SAL_CALL disposing() override; - - }; + class OStatement : public OStatementCommonBase, + public OStatement_Base, + public css::sdbc::XBatchExecution, + public css::lang::XServiceInfo + { + XSQLDA* m_pSqlda; + protected: + virtual ~OStatement() override {} + + public: + // a constructor, which is required for returning objects: + explicit OStatement( Connection* _pConnection) + : OStatementCommonBase( _pConnection), + m_pSqlda(nullptr) + {} + + virtual void disposeResultSet() override; + + DECLARE_SERVICE_INFO(); + + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL + executeQuery(const OUString& sql) override; + virtual sal_Int32 SAL_CALL executeUpdate(const OUString& sqlIn) override; + virtual sal_Bool SAL_CALL + execute(const OUString& sql) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL + getConnection() override; + + // XBatchExecution - UNSUPPORTED + virtual void SAL_CALL addBatch( const OUString& sql ) override; + virtual void SAL_CALL clearBatch( ) override; + virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; + + // XInterface + virtual css::uno::Any SAL_CALL + queryInterface(const css::uno::Type & rType) override; + + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL + getTypes() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; + + }; } diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.hxx b/connectivity/source/drivers/firebird/StatementCommonBase.hxx index 92eac1ec521d..17c130f7a374 100644 --- a/connectivity/source/drivers/firebird/StatementCommonBase.hxx +++ b/connectivity/source/drivers/firebird/StatementCommonBase.hxx @@ -37,98 +37,98 @@ #include <com/sun/star/util/XCancellable.hpp> namespace connectivity::firebird +{ + class OResultSet; + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, + css::util::XCancellable, + css::sdbc::XCloseable, + css::sdbc::XMultipleResults> OStatementCommonBase_Base; + + class OStatementCommonBase : public OStatementCommonBase_Base, + public ::cppu::OPropertySetHelper, + public OPropertyArrayUsageHelper<OStatementCommonBase> + { - class OResultSet; - - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, - css::util::XCancellable, - css::sdbc::XCloseable, - css::sdbc::XMultipleResults> OStatementCommonBase_Base; - - class OStatementCommonBase : public OStatementCommonBase_Base, - public ::cppu::OPropertySetHelper, - public OPropertyArrayUsageHelper<OStatementCommonBase> - - { - protected: - ::osl::Mutex m_aMutex; - - rtl::Reference<OResultSet> m_xResultSet; // The last ResultSet created - // for this Statement - - ::rtl::Reference<Connection> m_pConnection; - - ISC_STATUS_ARRAY m_statusVector; - isc_stmt_handle m_aStatementHandle; - - protected: - virtual void disposeResultSet(); - /// @throws css::sdbc::SQLException - void freeStatementHandle(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - using OPropertySetHelper::getFastPropertyValue; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, - sal_Int32 nHandle, - const css::uno::Any& rValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle) const override; - virtual ~OStatementCommonBase() override; - - /// @throws css::sdbc::SQLException - void prepareAndDescribeStatement(std::u16string_view sqlIn, XSQLDA*& pOutSqlda); - - /// @throws css::sdbc::SQLException - short getSqlInfoItem(char aInfoItem); - /// @throws css::sdbc::SQLException - bool isDDLStatement(); - /// @throws css::sdbc::SQLException - sal_Int32 getStatementChangeCount(); - - public: - - explicit OStatementCommonBase(Connection* _pConnection); - using OStatementCommonBase_Base::operator css::uno::Reference< css::uno::XInterface >; - - // OComponentHelper - virtual void SAL_CALL disposing() override { - disposeResultSet(); - OStatementCommonBase_Base::disposing(); - } - // XInterface - virtual void SAL_CALL release() noexcept override; - virtual void SAL_CALL acquire() noexcept override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - - // XWarningsSupplier - UNSUPPORTED - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XMultipleResults - UNSUPPORTED - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; - virtual sal_Int32 SAL_CALL getUpdateCount( ) override; - virtual sal_Bool SAL_CALL getMoreResults( ) override; - - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - - }; + protected: + ::osl::Mutex m_aMutex; + + rtl::Reference<OResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + + ::rtl::Reference<Connection> m_pConnection; + + ISC_STATUS_ARRAY m_statusVector; + isc_stmt_handle m_aStatementHandle; + + protected: + virtual void disposeResultSet(); + /// @throws css::sdbc::SQLException + void freeStatementHandle(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + using OPropertySetHelper::getFastPropertyValue; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle) const override; + virtual ~OStatementCommonBase() override; + + /// @throws css::sdbc::SQLException + void prepareAndDescribeStatement(std::u16string_view sqlIn, XSQLDA*& pOutSqlda); + + /// @throws css::sdbc::SQLException + short getSqlInfoItem(char aInfoItem); + /// @throws css::sdbc::SQLException + bool isDDLStatement(); + /// @throws css::sdbc::SQLException + sal_Int32 getStatementChangeCount(); + + public: + + explicit OStatementCommonBase(Connection* _pConnection); + using OStatementCommonBase_Base::operator css::uno::Reference< css::uno::XInterface >; + + // OComponentHelper + virtual void SAL_CALL disposing() override { + disposeResultSet(); + OStatementCommonBase_Base::disposing(); + } + // XInterface + virtual void SAL_CALL release() noexcept override; + virtual void SAL_CALL acquire() noexcept override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // XWarningsSupplier - UNSUPPORTED + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XMultipleResults - UNSUPPORTED + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; + virtual sal_Int32 SAL_CALL getUpdateCount( ) override; + virtual sal_Bool SAL_CALL getMoreResults( ) override; + + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + + }; } diff --git a/connectivity/source/drivers/firebird/SubComponent.hxx b/connectivity/source/drivers/firebird/SubComponent.hxx index bea5d76d423d..183d6daed252 100644 --- a/connectivity/source/drivers/firebird/SubComponent.hxx +++ b/connectivity/source/drivers/firebird/SubComponent.hxx @@ -27,84 +27,84 @@ namespace cppu { class IPropertyArrayHelper; } namespace com::sun::star::lang { class XComponent; } namespace connectivity::firebird - { - /// @throws css::lang::DisposedException - void checkDisposed(bool _bThrow); +{ + /// @throws css::lang::DisposedException + void checkDisposed(bool _bThrow); - template <class TYPE> - class OPropertyArrayUsageHelper - { - protected: - static sal_Int32 s_nRefCount; - static ::cppu::IPropertyArrayHelper* s_pProps; - static ::osl::Mutex s_aMutex; - - public: - OPropertyArrayUsageHelper(); - virtual ~OPropertyArrayUsageHelper(); - - /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the - class, which is created if necessary. - */ - ::cppu::IPropertyArrayHelper* getArrayHelper(); - - protected: - /** used to implement the creation of the array helper which is shared amongst all instances of the class. - This method needs to be implemented in derived classes. - <BR> - The method gets called with s_aMutex acquired. - @return a pointer to the newly created array helper. Must not be NULL. - */ - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const = 0; - }; - - template<class TYPE> - sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0; - - template<class TYPE> - ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = nullptr; - - template<class TYPE> - ::osl::Mutex OPropertyArrayUsageHelper< TYPE >::s_aMutex; - - - template <class TYPE> - OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper() - { - ::osl::MutexGuard aGuard(s_aMutex); - ++s_nRefCount; - } + template <class TYPE> + class OPropertyArrayUsageHelper + { + protected: + static sal_Int32 s_nRefCount; + static ::cppu::IPropertyArrayHelper* s_pProps; + static ::osl::Mutex s_aMutex; + + public: + OPropertyArrayUsageHelper(); + virtual ~OPropertyArrayUsageHelper(); + + /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the + class, which is created if necessary. + */ + ::cppu::IPropertyArrayHelper* getArrayHelper(); + + protected: + /** used to implement the creation of the array helper which is shared amongst all instances of the class. + This method needs to be implemented in derived classes. + <BR> + The method gets called with s_aMutex acquired. + @return a pointer to the newly created array helper. Must not be NULL. + */ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const = 0; + }; + + template<class TYPE> + sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0; + + template<class TYPE> + ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = nullptr; + + template<class TYPE> + ::osl::Mutex OPropertyArrayUsageHelper< TYPE >::s_aMutex; + + + template <class TYPE> + OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper() + { + ::osl::MutexGuard aGuard(s_aMutex); + ++s_nRefCount; + } - template <class TYPE> - OPropertyArrayUsageHelper<TYPE>::~OPropertyArrayUsageHelper() + template <class TYPE> + OPropertyArrayUsageHelper<TYPE>::~OPropertyArrayUsageHelper() + { + ::osl::MutexGuard aGuard(s_aMutex); + OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); + if (!--s_nRefCount) { - ::osl::MutexGuard aGuard(s_aMutex); - OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); - if (!--s_nRefCount) - { - delete s_pProps; - s_pProps = nullptr; - } + delete s_pProps; + s_pProps = nullptr; } + } - template <class TYPE> - ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYPE>::getArrayHelper() + template <class TYPE> + ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYPE>::getArrayHelper() + { + OSL_ENSURE(s_nRefCount, "OPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !"); + if (!s_pProps) { - OSL_ENSURE(s_nRefCount, "OPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !"); + ::osl::MutexGuard aGuard(s_aMutex); if (!s_pProps) { - ::osl::MutexGuard aGuard(s_aMutex); - if (!s_pProps) - { - s_pProps = createArrayHelper(); - OSL_ENSURE(s_pProps, "OPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !"); - } + s_pProps = createArrayHelper(); + OSL_ENSURE(s_pProps, "OPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !"); } - return s_pProps; } + return s_pProps; + } } diff --git a/connectivity/source/drivers/firebird/Table.hxx b/connectivity/source/drivers/firebird/Table.hxx index ed638a9c88ac..024f905a88b5 100644 --- a/connectivity/source/drivers/firebird/Table.hxx +++ b/connectivity/source/drivers/firebird/Table.hxx @@ -18,63 +18,63 @@ #include <connectivity/TTableHelper.hxx> namespace connectivity::firebird +{ + + /** + * Implements sdbcx.Table. We don't support table renaming (XRename) + * hence the appropriate methods are overridden. + */ + class Table: public OTableHelper { + private: + ::osl::Mutex& m_rMutex; + sal_Int32 m_nPrivileges; /** - * Implements sdbcx.Table. We don't support table renaming (XRename) - * hence the appropriate methods are overridden. + * Get the ALTER TABLE [TABLE] ALTER [COLUMN] String. + * Includes a trailing space. + */ + OUString getAlterTableColumn(std::u16string_view rColumn); + + protected: + void construct() override; + + public: + Table(Tables* pTables, + ::osl::Mutex& rMutex, + const css::uno::Reference< css::sdbc::XConnection >& _xConnection); + Table(Tables* pTables, + ::osl::Mutex& rMutex, + const css::uno::Reference< css::sdbc::XConnection >& _xConnection, + const OUString& rName, + const OUString& rType, + const OUString& rDescription); + + // OTableHelper + virtual ::connectivity::sdbcx::OCollection* createColumns( + const ::std::vector< OUString>& rNames) override; + virtual ::connectivity::sdbcx::OCollection* createKeys( + const ::std::vector< OUString>& rNames) override; + virtual ::connectivity::sdbcx::OCollection* createIndexes( + const ::std::vector< OUString>& rNames) override; + + // XAlterTable + /** + * See css::sdbcx::ColumnDescriptor for details of + * rDescriptor. */ - class Table: public OTableHelper - { - private: - ::osl::Mutex& m_rMutex; - sal_Int32 m_nPrivileges; - - /** - * Get the ALTER TABLE [TABLE] ALTER [COLUMN] String. - * Includes a trailing space. - */ - OUString getAlterTableColumn(std::u16string_view rColumn); - - protected: - void construct() override; - - public: - Table(Tables* pTables, - ::osl::Mutex& rMutex, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection); - Table(Tables* pTables, - ::osl::Mutex& rMutex, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection, - const OUString& rName, - const OUString& rType, - const OUString& rDescription); - - // OTableHelper - virtual ::connectivity::sdbcx::OCollection* createColumns( - const ::std::vector< OUString>& rNames) override; - virtual ::connectivity::sdbcx::OCollection* createKeys( - const ::std::vector< OUString>& rNames) override; - virtual ::connectivity::sdbcx::OCollection* createIndexes( - const ::std::vector< OUString>& rNames) override; - - // XAlterTable - /** - * See css::sdbcx::ColumnDescriptor for details of - * rDescriptor. - */ - virtual void SAL_CALL alterColumnByName( - const OUString& rColName, - const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override; - - // XRename -- UNSUPPORTED - virtual void SAL_CALL rename(const OUString& sName) override; - - //XInterface - virtual css::uno::Any - SAL_CALL queryInterface(const css::uno::Type & rType) override; - - }; + virtual void SAL_CALL alterColumnByName( + const OUString& rColName, + const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override; + + // XRename -- UNSUPPORTED + virtual void SAL_CALL rename(const OUString& sName) override; + + //XInterface + virtual css::uno::Any + SAL_CALL queryInterface(const css::uno::Type & rType) override; + + }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/Tables.hxx b/connectivity/source/drivers/firebird/Tables.hxx index 32f47380c65a..057d35c1ad33 100644 --- a/connectivity/source/drivers/firebird/Tables.hxx +++ b/connectivity/source/drivers/firebird/Tables.hxx @@ -16,45 +16,45 @@ #include <utility> namespace connectivity::firebird +{ + + /** + * This implements com.sun.star.sdbcx.Container, which seems to be + * also known by the name of Tables and Collection. + */ + class Tables: public ::connectivity::sdbcx::OCollection { + protected: + css::uno::Reference< css::sdbc::XDatabaseMetaData > + m_xMetaData; + + static OUString createStandardColumnPart(const css::uno::Reference< css::beans::XPropertySet >& xColProp,const css::uno::Reference< css::sdbc::XConnection>& _xConnection); + + // OCollection + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createObject( + const OUString& rName) override; + virtual css::uno::Reference< css::beans::XPropertySet > + createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( + const OUString& rName, + const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override; + + public: + Tables(css::uno::Reference< css::sdbc::XDatabaseMetaData > xMetaData, + ::cppu::OWeakObject& rParent, + ::osl::Mutex& rMutex, + ::std::vector< OUString> const & rNames) : sdbcx::OCollection(rParent, true, rMutex, rNames), m_xMetaData(std::move(xMetaData)) {} + + // TODO: we should also implement XDataDescriptorFactory, XRefreshable, + // XAppend, etc., but all are optional. + + // XDrop + virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override; + + void appendNew(const OUString& _rsNewTable); - /** - * This implements com.sun.star.sdbcx.Container, which seems to be - * also known by the name of Tables and Collection. - */ - class Tables: public ::connectivity::sdbcx::OCollection - { - protected: - css::uno::Reference< css::sdbc::XDatabaseMetaData > - m_xMetaData; - - static OUString createStandardColumnPart(const css::uno::Reference< css::beans::XPropertySet >& xColProp,const css::uno::Reference< css::sdbc::XConnection>& _xConnection); - - // OCollection - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createObject( - const OUString& rName) override; - virtual css::uno::Reference< css::beans::XPropertySet > - createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( - const OUString& rName, - const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override; - - public: - Tables(css::uno::Reference< css::sdbc::XDatabaseMetaData > xMetaData, - ::cppu::OWeakObject& rParent, - ::osl::Mutex& rMutex, - ::std::vector< OUString> const & rNames) : sdbcx::OCollection(rParent, true, rMutex, rNames), m_xMetaData(std::move(xMetaData)) {} - - // TODO: we should also implement XDataDescriptorFactory, XRefreshable, - // XAppend, etc., but all are optional. - - // XDrop - virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override; - - void appendNew(const OUString& _rsNewTable); - - }; + }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/User.hxx b/connectivity/source/drivers/firebird/User.hxx index e47565f5d52e..537c6f9aa1d8 100644 --- a/connectivity/source/drivers/firebird/User.hxx +++ b/connectivity/source/drivers/firebird/User.hxx @@ -13,33 +13,33 @@ #include <com/sun/star/sdbc/XConnection.hpp> namespace connectivity::firebird +{ + + /** + * This implements com.sun.star.sdbcx.Container. + */ + class User: public ::connectivity::sdbcx::OUser { + css::uno::Reference< css::sdbc::XConnection > m_xConnection; + public: + /** + * Create a "new" descriptor, which isn't yet in the database. + */ + User(const css::uno::Reference< css::sdbc::XConnection >& rConnection); /** - * This implements com.sun.star.sdbcx.Container. + * For a user that already exists in the db. */ - class User: public ::connectivity::sdbcx::OUser - { - css::uno::Reference< css::sdbc::XConnection > m_xConnection; - - public: - /** - * Create a "new" descriptor, which isn't yet in the database. - */ - User(const css::uno::Reference< css::sdbc::XConnection >& rConnection); - /** - * For a user that already exists in the db. - */ - User(const css::uno::Reference< css::sdbc::XConnection >& rConnection, const OUString& rName); - - // XAuthorizable - virtual void SAL_CALL changePassword(const OUString&, const OUString& newPassword) override; - virtual sal_Int32 SAL_CALL getPrivileges(const OUString&, sal_Int32) override; - virtual sal_Int32 SAL_CALL getGrantablePrivileges(const OUString&, sal_Int32) override; - - // IRefreshableGroups:: - virtual void refreshGroups() override; - }; + User(const css::uno::Reference< css::sdbc::XConnection >& rConnection, const OUString& rName); + + // XAuthorizable + virtual void SAL_CALL changePassword(const OUString&, const OUString& newPassword) override; + virtual sal_Int32 SAL_CALL getPrivileges(const OUString&, sal_Int32) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges(const OUString&, sal_Int32) override; + + // IRefreshableGroups:: + virtual void refreshGroups() override; + }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/Users.hxx b/connectivity/source/drivers/firebird/Users.hxx index c66e9749054b..a3c65460e162 100644 --- a/connectivity/source/drivers/firebird/Users.hxx +++ b/connectivity/source/drivers/firebird/Users.hxx @@ -13,40 +13,40 @@ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> namespace connectivity::firebird - { +{ - /** - * This implements com.sun.star.sdbcx.Container. - */ - class Users: public ::connectivity::sdbcx::OCollection - { - css::uno::Reference< css::sdbc::XDatabaseMetaData > - m_xMetaData; - protected: - - // OCollection - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createObject( - const OUString& rName) override; - virtual css::uno::Reference< css::beans::XPropertySet > - createDescriptor() override; - virtual ::css::uno::Reference< css::beans::XPropertySet > appendObject( - const OUString& rName, - const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override; - - public: - Users(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData, - ::cppu::OWeakObject& rParent, - ::osl::Mutex& rMutex, - ::std::vector< OUString> const & rNames); - - // TODO: we should also implement XDataDescriptorFactory, XRefreshable, - // XAppend, etc., but all are optional. - - // XDrop - virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override; - - }; + /** + * This implements com.sun.star.sdbcx.Container. + */ + class Users: public ::connectivity::sdbcx::OCollection + { + css::uno::Reference< css::sdbc::XDatabaseMetaData > + m_xMetaData; + protected: + + // OCollection + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createObject( + const OUString& rName) override; + virtual css::uno::Reference< css::beans::XPropertySet > + createDescriptor() override; + virtual ::css::uno::Reference< css::beans::XPropertySet > appendObject( + const OUString& rName, + const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override; + + public: + Users(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData, + ::cppu::OWeakObject& rParent, + ::osl::Mutex& rMutex, + ::std::vector< OUString> const & rNames); + + // TODO: we should also implement XDataDescriptorFactory, XRefreshable, + // XAppend, etc., but all are optional. + + // XDrop + virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override; + + }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx index 62ba0e2f9640..b41afc07dbb9 100644 --- a/connectivity/source/drivers/firebird/Util.hxx +++ b/connectivity/source/drivers/firebird/Util.hxx @@ -17,106 +17,106 @@ #include <utility> namespace connectivity::firebird - { - // Type Blob has 2 subtypes values - // 0 for BLOB, 1 for CLOB - // see http://www.firebirdfaq.org/faq48/ - // User-defined subtypes are negative. - // Use a number for image which is very unlikely to be defined by a - // user. - enum class BlobSubtype { - Blob = 0, - Clob = 1, - Image = -9546 - }; - - /** - * Numeric and decimal types can be identified by their subtype in - * Firebird API. 1 for NUMERIC, 2 for DECIMAL. - */ - enum class NumberSubType { - Other = 0, - Numeric = 1, - Decimal = 2 - }; - - class ColumnTypeInfo { +{ + // Type Blob has 2 subtypes values + // 0 for BLOB, 1 for CLOB + // see http://www.firebirdfaq.org/faq48/ + // User-defined subtypes are negative. + // Use a number for image which is very unlikely to be defined by a + // user. + enum class BlobSubtype { + Blob = 0, + Clob = 1, + Image = -9546 + }; + + /** + * Numeric and decimal types can be identified by their subtype in + * Firebird API. 1 for NUMERIC, 2 for DECIMAL. + */ + enum class NumberSubType { + Other = 0, + Numeric = 1, + Decimal = 2 + }; + + class ColumnTypeInfo { private: - short m_aType; - short m_aSubType; - short m_nScale; - OUString m_sCharsetName; + short m_aType; + short m_aSubType; + short m_nScale; + OUString m_sCharsetName; public: - /** - * @param tType SQL type of column defined by Firebird (e.g. - * SQL_DOUBLE) - * @param aSubType SQL sub type as in firebird API. See - * NumberSubType. - * @param scale: Scale of the number. It is ignored in case it's not - * a number. Scale obtained from the Firebird API is negative, so - * that should be negated before passing to this constructor. - * - */ - explicit ColumnTypeInfo( short aType, short aSubType = 0, - short nScale = 0, OUString sCharset = OUString() ) - : m_aType(aType) - , m_aSubType(aSubType) - , m_nScale(nScale) - , m_sCharsetName(std::move(sCharset)) {} - explicit ColumnTypeInfo(const XSQLVAR& var, OUString sCharset = {}) - : ColumnTypeInfo(var.sqltype, var.sqlsubtype, -var.sqlscale, std::move(sCharset)) {} - explicit ColumnTypeInfo(const XSQLDA* pXSQLDA, sal_Int32 column, OUString sCharset = {}) - : ColumnTypeInfo(pXSQLDA->sqlvar[column-1], std::move(sCharset)) {} - short getType() const { return m_aType; } - short getSubType() const { return m_aSubType; } - short getScale() const { return m_nScale; } - OUString const & getCharacterSet() const { return m_sCharsetName; } - - sal_Int32 getSdbcType() const; - OUString getColumnTypeName() const; - - }; - /** - * Make sure an identifier is safe to use within the database. Currently - * firebird seems to return identifiers with 93 character (instead of - * 31), whereby the name is simply padded with trailing whitespace. - * This removes all trailing whitespace (i.e. if necessary so that - * the length is below 31 characters). Firebird automatically compensates - * for such shorter strings, however any trailing padding makes the gui - * editing of such names harder, hence we remove all trailing whitespace. - */ - OUString sanitizeIdentifier(std::u16string_view rIdentifier); - - inline bool IndicatesError(const ISC_STATUS_ARRAY& rStatusVector) - { - return rStatusVector[0]==1 && rStatusVector[1]; // indicates error; - } - - OUString StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector, - std::u16string_view rCause); - - /** - * Evaluate a firebird status vector and throw exceptions as necessary. - * The content of the status vector is included in the thrown exception. + * @param tType SQL type of column defined by Firebird (e.g. + * SQL_DOUBLE) + * @param aSubType SQL sub type as in firebird API. See + * NumberSubType. + * @param scale: Scale of the number. It is ignored in case it's not + * a number. Scale obtained from the Firebird API is negative, so + * that should be negated before passing to this constructor. * - * @throws css::sdbc::SQLException - */ - void evaluateStatusVector(const ISC_STATUS_ARRAY& rStatusVector, - std::u16string_view aCause, - const css::uno::Reference< css::uno::XInterface >& _rxContext); - - /** - * Internally (i.e. in RDB$FIELD_TYPE) firebird stores the data type - * for a column as defined in blr_*, however in the firebird - * api the SQL_* types are used, hence we need to be able to convert - * between the two when retrieving column metadata. */ - short getFBTypeFromBlrType(short blrType); - - void mallocSQLVAR(XSQLDA* pSqlda); - - void freeSQLVAR(XSQLDA* pSqlda); + explicit ColumnTypeInfo( short aType, short aSubType = 0, + short nScale = 0, OUString sCharset = OUString() ) + : m_aType(aType) + , m_aSubType(aSubType) + , m_nScale(nScale) + , m_sCharsetName(std::move(sCharset)) {} + explicit ColumnTypeInfo(const XSQLVAR& var, OUString sCharset = {}) + : ColumnTypeInfo(var.sqltype, var.sqlsubtype, -var.sqlscale, std::move(sCharset)) {} + explicit ColumnTypeInfo(const XSQLDA* pXSQLDA, sal_Int32 column, OUString sCharset = {}) + : ColumnTypeInfo(pXSQLDA->sqlvar[column-1], std::move(sCharset)) {} + short getType() const { return m_aType; } + short getSubType() const { return m_aSubType; } + short getScale() const { return m_nScale; } + OUString const & getCharacterSet() const { return m_sCharsetName; } + + sal_Int32 getSdbcType() const; + OUString getColumnTypeName() const; + + }; + + /** + * Make sure an identifier is safe to use within the database. Currently + * firebird seems to return identifiers with 93 character (instead of + * 31), whereby the name is simply padded with trailing whitespace. + * This removes all trailing whitespace (i.e. if necessary so that + * the length is below 31 characters). Firebird automatically compensates + * for such shorter strings, however any trailing padding makes the gui + * editing of such names harder, hence we remove all trailing whitespace. + */ + OUString sanitizeIdentifier(std::u16string_view rIdentifier); + + inline bool IndicatesError(const ISC_STATUS_ARRAY& rStatusVector) + { + return rStatusVector[0]==1 && rStatusVector[1]; // indicates error; + } + + OUString StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector, + std::u16string_view rCause); + + /** + * Evaluate a firebird status vector and throw exceptions as necessary. + * The content of the status vector is included in the thrown exception. + * + * @throws css::sdbc::SQLException + */ + void evaluateStatusVector(const ISC_STATUS_ARRAY& rStatusVector, + std::u16string_view aCause, + const css::uno::Reference< css::uno::XInterface >& _rxContext); + + /** + * Internally (i.e. in RDB$FIELD_TYPE) firebird stores the data type + * for a column as defined in blr_*, however in the firebird + * api the SQL_* types are used, hence we need to be able to convert + * between the two when retrieving column metadata. + */ + short getFBTypeFromBlrType(short blrType); + + void mallocSQLVAR(XSQLDA* pSqlda); + + void freeSQLVAR(XSQLDA* pSqlda); } diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx b/connectivity/source/drivers/hsqldb/HTerminateListener.hxx index baf66e90eb1e..265be80ef5b9 100644 --- a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx +++ b/connectivity/source/drivers/hsqldb/HTerminateListener.hxx @@ -23,23 +23,23 @@ namespace connectivity::hsqldb +{ + class ODriverDelegator; + class OConnectionController : public ::cppu::WeakImplHelper< css::frame::XTerminateListener > { - class ODriverDelegator; - class OConnectionController : public ::cppu::WeakImplHelper< css::frame::XTerminateListener > - { - ODriverDelegator* m_pDriver; - protected: - virtual ~OConnectionController() override {m_pDriver = nullptr;} - public: - explicit OConnectionController(ODriverDelegator* _pDriver) : m_pDriver(_pDriver){} + ODriverDelegator* m_pDriver; + protected: + virtual ~OConnectionController() override {m_pDriver = nullptr;} + public: + explicit OConnectionController(ODriverDelegator* _pDriver) : m_pDriver(_pDriver){} - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - // XTerminateListener - virtual void SAL_CALL queryTermination( const css::lang::EventObject& aEvent ) override; - virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) override; - }; + // XTerminateListener + virtual void SAL_CALL queryTermination( const css::lang::EventObject& aEvent ) override; + virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) override; + }; } // namespace connectivity::hsqldb diff --git a/connectivity/source/drivers/macab/MacabAddressBook.hxx b/connectivity/source/drivers/macab/MacabAddressBook.hxx index a23e0c1eb2e7..a12ba6c5be12 100644 --- a/connectivity/source/drivers/macab/MacabAddressBook.hxx +++ b/connectivity/source/drivers/macab/MacabAddressBook.hxx @@ -32,28 +32,28 @@ namespace connectivity::macab { - class MacabAddressBook - { - protected: - ABAddressBookRef m_aAddressBook; - MacabRecords *m_xMacabRecords; - std::vector<MacabGroup *> m_xMacabGroups; - bool m_bRetrievedGroups; - - public: - MacabAddressBook(); - ~MacabAddressBook(); - static const OUString & getDefaultTableName(); - - MacabRecords *getMacabRecords(); - std::vector<MacabGroup *> getMacabGroups(); - - MacabGroup *getMacabGroup(std::u16string_view _groupName); - MacabRecords *getMacabRecords(std::u16string_view _tableName); - - MacabGroup *getMacabGroupMatch(const OUString& _groupName); - MacabRecords *getMacabRecordsMatch(const OUString& _tableName); - }; + class MacabAddressBook + { + protected: + ABAddressBookRef m_aAddressBook; + MacabRecords *m_xMacabRecords; + std::vector<MacabGroup *> m_xMacabGroups; + bool m_bRetrievedGroups; + + public: + MacabAddressBook(); + ~MacabAddressBook(); + static const OUString & getDefaultTableName(); + + MacabRecords *getMacabRecords(); + std::vector<MacabGroup *> getMacabGroups(); + + MacabGroup *getMacabGroup(std::u16string_view _groupName); + MacabRecords *getMacabRecords(std::u16string_view _tableName); + + MacabGroup *getMacabGroupMatch(const OUString& _groupName); + MacabRecords *getMacabRecordsMatch(const OUString& _tableName); + }; } diff --git a/connectivity/source/drivers/macab/MacabCatalog.hxx b/connectivity/source/drivers/macab/MacabCatalog.hxx index 1757bb908851..8a12125b1284 100644 --- a/connectivity/source/drivers/macab/MacabCatalog.hxx +++ b/connectivity/source/drivers/macab/MacabCatalog.hxx @@ -23,29 +23,29 @@ namespace connectivity::macab { - class MacabConnection; + class MacabConnection; - class MacabCatalog : public connectivity::sdbcx::OCatalog - { - MacabConnection* m_pConnection; // used to get the metadata + class MacabCatalog : public connectivity::sdbcx::OCatalog + { + MacabConnection* m_pConnection; // used to get the metadata - public: - explicit MacabCatalog(MacabConnection* _pCon); + public: + explicit MacabCatalog(MacabConnection* _pCon); - MacabConnection* getConnection() const { return m_pConnection; } + MacabConnection* getConnection() const { return m_pConnection; } - static const OUString& getDot(); + static const OUString& getDot(); - // implementation of the pure virtual methods - virtual void refreshTables() override; - virtual void refreshViews() override; - virtual void refreshGroups() override; - virtual void refreshUsers() override; + // implementation of the pure virtual methods + virtual void refreshTables() override; + virtual void refreshViews() override; + virtual void refreshGroups() override; + virtual void refreshUsers() override; - // XTablesSupplier - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( - ) override; - }; + // XTablesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( + ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabColumns.hxx b/connectivity/source/drivers/macab/MacabColumns.hxx index 5991e8948f10..1da4021734c3 100644 --- a/connectivity/source/drivers/macab/MacabColumns.hxx +++ b/connectivity/source/drivers/macab/MacabColumns.hxx @@ -24,19 +24,19 @@ namespace connectivity::macab { - class MacabColumns : public sdbcx::OCollection - { - protected: - MacabTable* m_pTable; + class MacabColumns : public sdbcx::OCollection + { + protected: + MacabTable* m_pTable; - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; - public: - MacabColumns( MacabTable* _pTable, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector); - }; + public: + MacabColumns( MacabTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabConnection.hxx b/connectivity/source/drivers/macab/MacabConnection.hxx index 4e750f09d7db..b9fa3c58e23e 100644 --- a/connectivity/source/drivers/macab/MacabConnection.hxx +++ b/connectivity/source/drivers/macab/MacabConnection.hxx @@ -30,79 +30,79 @@ namespace connectivity::macab { - typedef ::cppu::WeakComponentImplHelper<css::sdbc::XConnection, - css::sdbc::XWarningsSupplier, - css::lang::XServiceInfo - > OMetaConnection_BASE; - - class MacabDriver; - class MacabAddressBook; - - typedef connectivity::OMetaConnection MacabConnection_BASE; - - class MacabConnection : public MacabConnection_BASE - { - protected: - - // Data attributes - - MacabAddressBook* m_pAddressBook; // the address book - MacabDriver* m_pDriver; // pointer to the owning driver object - css::uno::Reference< css::sdbcx::XTablesSupplier> - m_xCatalog; // needed for the SQL interpreter - - private: - bool doIsClosed(); - - void doClose(); - - public: - /// @throws css::sdbc::SQLException - virtual void construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info); - - explicit MacabConnection(MacabDriver* _pDriver); - virtual ~MacabConnection() override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XServiceInfo - DECLARE_SERVICE_INFO(); - - // XConnection - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; - virtual sal_Bool SAL_CALL getAutoCommit( ) override; - virtual void SAL_CALL commit( ) override; - virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual void SAL_CALL setCatalog( const OUString& catalog ) override; - virtual OUString SAL_CALL getCatalog( ) override; - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; - virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - - // XCloseable - virtual void SAL_CALL close( ) override; - - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - - // needed for the SQL interpreter - css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); - - // accessors - MacabDriver* getDriver() const { return m_pDriver;} - MacabAddressBook* getAddressBook() const; - }; + typedef ::cppu::WeakComponentImplHelper<css::sdbc::XConnection, + css::sdbc::XWarningsSupplier, + css::lang::XServiceInfo + > OMetaConnection_BASE; + + class MacabDriver; + class MacabAddressBook; + + typedef connectivity::OMetaConnection MacabConnection_BASE; + + class MacabConnection : public MacabConnection_BASE + { + protected: + + // Data attributes + + MacabAddressBook* m_pAddressBook; // the address book + MacabDriver* m_pDriver; // pointer to the owning driver object + css::uno::Reference< css::sdbcx::XTablesSupplier> + m_xCatalog; // needed for the SQL interpreter + + private: + bool doIsClosed(); + + void doClose(); + + public: + /// @throws css::sdbc::SQLException + virtual void construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info); + + explicit MacabConnection(MacabDriver* _pDriver); + virtual ~MacabConnection() override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; + virtual sal_Bool SAL_CALL getAutoCommit( ) override; + virtual void SAL_CALL commit( ) override; + virtual void SAL_CALL rollback( ) override; + virtual sal_Bool SAL_CALL isClosed( ) override; + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual void SAL_CALL setCatalog( const OUString& catalog ) override; + virtual OUString SAL_CALL getCatalog( ) override; + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; + virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + + // XCloseable + virtual void SAL_CALL close( ) override; + + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + + // needed for the SQL interpreter + css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); + + // accessors + MacabDriver* getDriver() const { return m_pDriver;} + MacabAddressBook* getAddressBook() const; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx index 662be1c018ce..d5d127fa1025 100644 --- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx +++ b/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx @@ -26,170 +26,170 @@ namespace connectivity::macab { - class MacabDatabaseMetaData : public ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData> - { - rtl::Reference< MacabConnection > m_xConnection; - bool m_bUseCatalog; + class MacabDatabaseMetaData : public ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData> + { + rtl::Reference< MacabConnection > m_xConnection; + bool m_bUseCatalog; - public: + public: - MacabConnection* getOwnConnection() const { return m_xConnection.get(); } + MacabConnection* getOwnConnection() const { return m_xConnection.get(); } - explicit MacabDatabaseMetaData(MacabConnection* _pCon); - virtual ~MacabDatabaseMetaData() override; + explicit MacabDatabaseMetaData(MacabConnection* _pCon); + virtual ~MacabDatabaseMetaData() override; - // this interface is really BIG - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual OUString SAL_CALL getUserName( ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; - virtual OUString SAL_CALL getDatabaseProductName( ) override; - virtual OUString SAL_CALL getDatabaseProductVersion( ) override; - virtual OUString SAL_CALL getDriverName( ) override; - virtual OUString SAL_CALL getDriverVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; - virtual sal_Bool SAL_CALL usesLocalFiles( ) override; - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) override; - virtual OUString SAL_CALL getIdentifierQuoteString( ) override; - virtual OUString SAL_CALL getSQLKeywords( ) override; - virtual OUString SAL_CALL getNumericFunctions( ) override; - virtual OUString SAL_CALL getStringFunctions( ) override; - virtual OUString SAL_CALL getSystemFunctions( ) override; - virtual OUString SAL_CALL getTimeDateFunctions( ) override; - virtual OUString SAL_CALL getSearchStringEscape( ) override; - virtual OUString SAL_CALL getExtraNameCharacters( ) override; - virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; - virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; - virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupBy( ) override; - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; - virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; - virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; - virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; - virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; - virtual OUString SAL_CALL getSchemaTerm( ) override; - virtual OUString SAL_CALL getProcedureTerm( ) override; - virtual OUString SAL_CALL getCatalogTerm( ) override; - virtual sal_Bool SAL_CALL isCatalogAtStart( ) override; - virtual OUString SAL_CALL getCatalogSeparator( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; - virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; - virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; - virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; - virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; - virtual sal_Bool SAL_CALL supportsUnion( ) override; - virtual sal_Bool SAL_CALL supportsUnionAll( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - virtual sal_Int32 SAL_CALL getMaxConnections( ) override; - virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; - virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; - virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; - virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; - virtual sal_Int32 SAL_CALL getMaxStatements( ) override; - virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; - virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; - virtual sal_Bool SAL_CALL supportsTransactions( ) override; - virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; - virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; - virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; - virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; - virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; - virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; - virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; - 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; - }; + // this interface is really BIG + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual OUString SAL_CALL getUserName( ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; + virtual OUString SAL_CALL getDatabaseProductName( ) override; + virtual OUString SAL_CALL getDatabaseProductVersion( ) override; + virtual OUString SAL_CALL getDriverName( ) override; + virtual OUString SAL_CALL getDriverVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; + virtual sal_Bool SAL_CALL usesLocalFiles( ) override; + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) override; + virtual OUString SAL_CALL getIdentifierQuoteString( ) override; + virtual OUString SAL_CALL getSQLKeywords( ) override; + virtual OUString SAL_CALL getNumericFunctions( ) override; + virtual OUString SAL_CALL getStringFunctions( ) override; + virtual OUString SAL_CALL getSystemFunctions( ) override; + virtual OUString SAL_CALL getTimeDateFunctions( ) override; + virtual OUString SAL_CALL getSearchStringEscape( ) override; + virtual OUString SAL_CALL getExtraNameCharacters( ) override; + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; + virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupBy( ) override; + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; + virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; + virtual OUString SAL_CALL getSchemaTerm( ) override; + virtual OUString SAL_CALL getProcedureTerm( ) override; + virtual OUString SAL_CALL getCatalogTerm( ) override; + virtual sal_Bool SAL_CALL isCatalogAtStart( ) override; + virtual OUString SAL_CALL getCatalogSeparator( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; + virtual sal_Bool SAL_CALL supportsUnion( ) override; + virtual sal_Bool SAL_CALL supportsUnionAll( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + virtual sal_Int32 SAL_CALL getMaxConnections( ) override; + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; + virtual sal_Int32 SAL_CALL getMaxStatements( ) override; + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; + virtual sal_Bool SAL_CALL supportsTransactions( ) override; + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; + 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; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabDriver.hxx b/connectivity/source/drivers/macab/MacabDriver.hxx index d18f5e9827f4..f12db3514acd 100644 --- a/connectivity/source/drivers/macab/MacabDriver.hxx +++ b/connectivity/source/drivers/macab/MacabDriver.hxx @@ -33,128 +33,128 @@ namespace connectivity::macab { - class MacabConnection; - class MacabDriver; + class MacabConnection; + class MacabDriver; - typedef void* (SAL_CALL * ConnectionFactoryFunction)( void* _pDriver ); - - typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray; + typedef void* (SAL_CALL * ConnectionFactoryFunction)( void* _pDriver ); + + typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray; - // = MacabImplModule - - class MacabImplModule - { - private: - /// Did we already attempt to load the module and to retrieve the symbols? - bool m_bAttemptedLoadModule; - oslModule m_hConnectorModule; - ConnectionFactoryFunction m_pConnectionFactoryFunc; + // = MacabImplModule + + class MacabImplModule + { + private: + /// Did we already attempt to load the module and to retrieve the symbols? + bool m_bAttemptedLoadModule; + oslModule m_hConnectorModule; + ConnectionFactoryFunction m_pConnectionFactoryFunc; - public: - MacabImplModule(); + public: + MacabImplModule(); - /** determines whether there is a mac OS present in the environment - */ - bool isMacOSPresent(); + /** determines whether there is a mac OS present in the environment + */ + bool isMacOSPresent(); - /** initializes the implementation module. + /** initializes the implementation module. - @throws css::uno::RuntimeException - if the module could be loaded, but required symbols are missing - @throws css::sdbc::SQLException - if no Mac OS was found at all - */ - void init(); + @throws css::uno::RuntimeException + if the module could be loaded, but required symbols are missing + @throws css::sdbc::SQLException + if no Mac OS was found at all + */ + void init(); - /** shuts down the impl module - */ - void shutdown(); + /** shuts down the impl module + */ + void shutdown(); - /** creates a new connection - @precond - <member>init</member> has been called before - @throws css::uno::RuntimeException - if no connection object could be created (which is a severe error, normally impossible) - */ - MacabConnection* createConnection( MacabDriver* _pDriver ) const; + /** creates a new connection + @precond + <member>init</member> has been called before + @throws css::uno::RuntimeException + if no connection object could be created (which is a severe error, normally impossible) + */ + MacabConnection* createConnection( MacabDriver* _pDriver ) const; - private: - /** loads the implementation module and retrieves the needed symbols + private: + /** loads the implementation module and retrieves the needed symbols - Save against being called multiple times. + Save against being called multiple times. - @return <TRUE/> if the module could be loaded successfully. + @return <TRUE/> if the module could be loaded successfully. - @throws css::uno::RuntimeException - if the module could be loaded, but required symbols are missing - */ - bool impl_loadModule(); + @throws css::uno::RuntimeException + if the module could be loaded, but required symbols are missing + */ + bool impl_loadModule(); - /** unloads the implementation module, and resets all function pointers to <NULL/> - @precond m_hConnectorModule is not <NULL/> - */ - void impl_unloadModule(); - }; + /** unloads the implementation module, and resets all function pointers to <NULL/> + @precond m_hConnectorModule is not <NULL/> + */ + void impl_unloadModule(); + }; - // = MacabDriver + // = MacabDriver - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, - css::lang::XServiceInfo, - css::frame::XTerminateListener > MacabDriver_BASE; - class MacabDriver : public MacabDriver_BASE - { - protected: - ::osl::Mutex m_aMutex; // mutex is need to control member access - OWeakRefArray m_xConnections; // vector containing a list of all the - // MacabConnection objects for this Driver - css::uno::Reference< css::uno::XComponentContext > - m_xContext; // the multi-service factory - MacabImplModule m_aImplModule; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, + css::lang::XServiceInfo, + css::frame::XTerminateListener > MacabDriver_BASE; + class MacabDriver : public MacabDriver_BASE + { + protected: + ::osl::Mutex m_aMutex; // mutex is need to control member access + OWeakRefArray m_xConnections; // vector containing a list of all the + // MacabConnection objects for this Driver + css::uno::Reference< css::uno::XComponentContext > + m_xContext; // the multi-service factory + MacabImplModule m_aImplModule; - public: - css::uno::Reference< css::uno::XComponentContext > const & - getComponentContext() const { return m_xContext; } + public: + css::uno::Reference< css::uno::XComponentContext > const & + getComponentContext() const { return m_xContext; } - /** returns the path of our configuration settings - */ - static OUString impl_getConfigurationSettingsPath(); + /** returns the path of our configuration settings + */ + static OUString impl_getConfigurationSettingsPath(); - explicit MacabDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); - protected: + explicit MacabDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); + protected: - // OComponentHelper - virtual void SAL_CALL disposing() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Int32 SAL_CALL getMajorVersion() override; - virtual sal_Int32 SAL_CALL getMinorVersion() override; - - // XTerminateListener - virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override; - virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override; - - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - private: - /** shuts down the library which contains the real implementations - - This method is safe against being called multiple times - - @precond our mutex is locked - */ - void impl_shutdownImplementationModule(); - }; + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Int32 SAL_CALL getMajorVersion() override; + virtual sal_Int32 SAL_CALL getMinorVersion() override; + + // XTerminateListener + virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override; + virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + /** shuts down the library which contains the real implementations + + This method is safe against being called multiple times + + @precond our mutex is locked + */ + void impl_shutdownImplementationModule(); + }; } diff --git a/connectivity/source/drivers/macab/MacabGroup.hxx b/connectivity/source/drivers/macab/MacabGroup.hxx index ddcd47b46423..a6379dda2a57 100644 --- a/connectivity/source/drivers/macab/MacabGroup.hxx +++ b/connectivity/source/drivers/macab/MacabGroup.hxx @@ -29,10 +29,10 @@ namespace connectivity::macab { - class MacabGroup: public MacabRecords { - public: - MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords *_allRecords, const ABGroupRef _xGroup); - }; + class MacabGroup: public MacabRecords { + public: + MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords *_allRecords, const ABGroupRef _xGroup); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabHeader.hxx b/connectivity/source/drivers/macab/MacabHeader.hxx index 24b3fc7b0b9c..2c110990e985 100644 --- a/connectivity/source/drivers/macab/MacabHeader.hxx +++ b/connectivity/source/drivers/macab/MacabHeader.hxx @@ -27,35 +27,35 @@ namespace connectivity::macab { - class MacabHeader: public MacabRecord{ - protected: - macabfield **sortRecord(sal_Int32 _start, sal_Int32 _length); - public: - MacabHeader(); - MacabHeader(const sal_Int32 _size, macabfield **_fields); - virtual ~MacabHeader() override; - void operator+= (const MacabHeader *r); - OUString getString(const sal_Int32 i) const; - void sortRecord(); - sal_Int32 getColumnNumber(std::u16string_view s) const; - - static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2); - - MacabHeader *begin(); - sal_Int32 end() const; - class iterator{ - protected: - sal_Int32 id; - MacabHeader *record; - public: - iterator& operator= (MacabHeader *_record); - iterator(); - void operator++ (); - bool operator!= (const sal_Int32 i) const; - bool operator== (const sal_Int32 i) const; - macabfield *operator* () const; - }; - }; + class MacabHeader: public MacabRecord{ + protected: + macabfield **sortRecord(sal_Int32 _start, sal_Int32 _length); + public: + MacabHeader(); + MacabHeader(const sal_Int32 _size, macabfield **_fields); + virtual ~MacabHeader() override; + void operator+= (const MacabHeader *r); + OUString getString(const sal_Int32 i) const; + void sortRecord(); + sal_Int32 getColumnNumber(std::u16string_view s) const; + + static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2); + + MacabHeader *begin(); + sal_Int32 end() const; + class iterator{ + protected: + sal_Int32 id; + MacabHeader *record; + public: + iterator& operator= (MacabHeader *_record); + iterator(); + void operator++ (); + bool operator!= (const sal_Int32 i) const; + bool operator== (const sal_Int32 i) const; + macabfield *operator* () const; + }; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabPreparedStatement.hxx b/connectivity/source/drivers/macab/MacabPreparedStatement.hxx index 6e649bf647f3..1a759800b509 100644 --- a/connectivity/source/drivers/macab/MacabPreparedStatement.hxx +++ b/connectivity/source/drivers/macab/MacabPreparedStatement.hxx @@ -28,84 +28,84 @@ namespace connectivity::macab { - typedef ::cppu::ImplInheritanceHelper< MacabCommonStatement, - css::sdbc::XPreparedStatement, - css::sdbc::XParameters, - css::sdbc::XResultSetMetaDataSupplier, - css::lang::XServiceInfo> MacabPreparedStatement_BASE; + typedef ::cppu::ImplInheritanceHelper< MacabCommonStatement, + css::sdbc::XPreparedStatement, + css::sdbc::XParameters, + css::sdbc::XResultSetMetaDataSupplier, + css::lang::XServiceInfo> MacabPreparedStatement_BASE; - class MacabPreparedStatement : public MacabPreparedStatement_BASE - { - protected: - OUString m_sSqlStatement; - ::rtl::Reference< MacabResultSetMetaData > - m_xMetaData; - bool m_bPrepared; - mutable sal_Int32 m_nParameterIndex; - OValueRow m_aParameterRow; + class MacabPreparedStatement : public MacabPreparedStatement_BASE + { + protected: + OUString m_sSqlStatement; + ::rtl::Reference< MacabResultSetMetaData > + m_xMetaData; + bool m_bPrepared; + mutable sal_Int32 m_nParameterIndex; + OValueRow m_aParameterRow; - /// @throws css::sdbc::SQLException - void checkAndResizeParameters(sal_Int32 nParams); - /// @throws css::sdbc::SQLException - void setMacabFields() const; + /// @throws css::sdbc::SQLException + void checkAndResizeParameters(sal_Int32 nParams); + /// @throws css::sdbc::SQLException + void setMacabFields() const; - protected: - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue) override; + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue) override; - virtual void resetParameters() const override; - virtual void getNextParameter(OUString &rParameter) const override; - virtual ~MacabPreparedStatement() override; + virtual void resetParameters() const override; + virtual void getNextParameter(OUString &rParameter) const override; + virtual ~MacabPreparedStatement() override; - public: - DECLARE_SERVICE_INFO(); - MacabPreparedStatement(MacabConnection* _pConnection, const OUString& sql); + public: + DECLARE_SERVICE_INFO(); + MacabPreparedStatement(MacabConnection* _pConnection, const OUString& sql); - // OComponentHelper - virtual void SAL_CALL disposing() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XPreparedStatement - using MacabCommonStatement::executeQuery; - using MacabCommonStatement::executeUpdate; - using MacabCommonStatement::execute; + // XPreparedStatement + using MacabCommonStatement::executeQuery; + using MacabCommonStatement::executeUpdate; + using MacabCommonStatement::execute; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; - virtual sal_Int32 SAL_CALL executeUpdate( ) override; - virtual sal_Bool SAL_CALL execute( ) override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; + virtual sal_Int32 SAL_CALL executeUpdate( ) override; + virtual sal_Bool SAL_CALL execute( ) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; - // XParameters - virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; - virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; - virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; - virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; - virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; - virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; - virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; - virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; - virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; - virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; - virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; - virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; - virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; - virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; - virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; - virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; - virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; - virtual void SAL_CALL clearParameters( ) override; + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; + virtual void SAL_CALL clearParameters( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - }; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabRecord.hxx b/connectivity/source/drivers/macab/MacabRecord.hxx index 5184eefc8ab4..93d41ee92c35 100644 --- a/connectivity/source/drivers/macab/MacabRecord.hxx +++ b/connectivity/source/drivers/macab/MacabRecord.hxx @@ -34,38 +34,38 @@ namespace connectivity::macab { - /* a MacabRecord is at root a list of macabfields (which is just - * something to hold both a CFTypeRef (a CoreFoundation object) and - * its Address Book type. - */ - struct macabfield - { - CFTypeRef value; - ABPropertyType type; - }; + /* a MacabRecord is at root a list of macabfields (which is just + * something to hold both a CFTypeRef (a CoreFoundation object) and + * its Address Book type. + */ + struct macabfield + { + CFTypeRef value; + ABPropertyType type; + }; - class MacabRecord{ - protected: - sal_Int32 size; - std::unique_ptr<macabfield *[]> fields; - protected: - void releaseFields(); - public: - MacabRecord(); - explicit MacabRecord(const sal_Int32 _size); - virtual ~MacabRecord(); - void insertAtColumn (CFTypeRef _value, ABPropertyType _type, const sal_Int32 _column); - bool contains(const macabfield *_field) const; - bool contains(const CFTypeRef _value) const; - sal_Int32 getSize() const; - macabfield *copy(const sal_Int32 i) const; - macabfield *get(const sal_Int32 i) const; + class MacabRecord{ + protected: + sal_Int32 size; + std::unique_ptr<macabfield *[]> fields; + protected: + void releaseFields(); + public: + MacabRecord(); + explicit MacabRecord(const sal_Int32 _size); + virtual ~MacabRecord(); + void insertAtColumn (CFTypeRef _value, ABPropertyType _type, const sal_Int32 _column); + bool contains(const macabfield *_field) const; + bool contains(const CFTypeRef _value) const; + sal_Int32 getSize() const; + macabfield *copy(const sal_Int32 i) const; + macabfield *get(const sal_Int32 i) const; - static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2); - static macabfield *createMacabField(const OUString& _newFieldString, const ABPropertyType _abtype); - static OUString fieldToString(const macabfield *_aField); + static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2); + static macabfield *createMacabField(const OUString& _newFieldString, const ABPropertyType _abtype); + static OUString fieldToString(const macabfield *_aField); - }; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabRecords.hxx b/connectivity/source/drivers/macab/MacabRecords.hxx index 8d0d5cf6f796..f38705a12e86 100644 --- a/connectivity/source/drivers/macab/MacabRecords.hxx +++ b/connectivity/source/drivers/macab/MacabRecords.hxx @@ -35,91 +35,91 @@ namespace connectivity::macab { - /* This struct is for converting CF types to AB types (Core Foundation - * types to Address Book types). - */ - struct lcl_CFType { - CFTypeID cf; - sal_Int32 ab; - }; - - class MacabRecords{ - protected: - /* MacabRecords is, at its core, a table of macabfields, in the - * form of a header and a list of objects of type MacabRecord. - * It also has a unique name that refers to the name of the table. - */ - sal_Int32 recordsSize; - sal_Int32 currentRecord; - CFStringRef recordType; - MacabHeader *header; - MacabRecord **records; - ABAddressBookRef addressBook; - OUString m_sName; - - /* For converting CF types to AB types */ - std::vector<lcl_CFType> lcl_CFTypes; - - /* For required properties */ - std::vector<CFStringRef> requiredProperties; - - private: - /* All of the private methods are for creating a MacabHeader or a - * MacabRecord. They are used by the initialize method that goes - * about filling a MacabRecords using all of the records in the - * macOS Address Book. - */ - void bootstrap_CF_types(); - void bootstrap_requiredProperties(); - MacabHeader *createHeaderForProperty(const ABRecordRef _record, const CFStringRef _propertyName, const CFStringRef _recordType, const bool _isPropertyRequired) const; - MacabHeader *createHeaderForProperty(const ABPropertyType _propertyType, const CFTypeRef _propertyValue, const CFStringRef _propertyName) const; - ABPropertyType getABTypeFromCFType(const CFTypeID cf_type ) const; - void insertPropertyIntoMacabRecord(MacabRecord *_abrecord, const MacabHeader *_header, const OUString& _propertyName, const CFTypeRef _propertyValue) const; - void insertPropertyIntoMacabRecord(const ABPropertyType _propertyType, MacabRecord *_abrecord, const MacabHeader *_header, const OUString& _propertyName, const CFTypeRef _propertyValue) const; - public: - MacabRecords(const ABAddressBookRef _addressBook, MacabHeader *_header, MacabRecord **_records, sal_Int32 _numRecords); - explicit MacabRecords(const MacabRecords *_copy); - explicit MacabRecords(const ABAddressBookRef _addressBook); - ~MacabRecords(); - - void initialize(); - - void setHeader(MacabHeader *_header); - MacabHeader *getHeader() const; - - void setName(const OUString& _sName); - OUString const & getName() const; - - MacabRecord *insertRecord(MacabRecord *_newRecord, const sal_Int32 _location); - void insertRecord(MacabRecord *_newRecord); - MacabRecord *getRecord(const sal_Int32 _location) const; - void swap(const sal_Int32 _id1, const sal_Int32 _id2); - - macabfield *getField(const sal_Int32 _recordNumber, const sal_Int32 _columnNumber) const; - macabfield *getField(const sal_Int32 _recordNumber, std::u16string_view _columnName) const; - sal_Int32 getFieldNumber(std::u16string_view _columnName) const; - - sal_Int32 size() const; - - MacabHeader *createHeaderForRecordType(const CFArrayRef _records, const CFStringRef _recordType) const; - MacabRecord *createMacabRecord(const ABRecordRef _abrecord, const MacabHeader *_header, const CFStringRef _recordType) const; - - MacabRecords *begin(); - sal_Int32 end() const; - class iterator{ - protected: - MacabRecords *records; - public: - sal_Int32 id; - iterator& operator= (MacabRecords *_records); - iterator(); - void operator++ (); - bool operator!= (const sal_Int32 i) const; - bool operator== (const sal_Int32 i) const; - MacabRecord *operator* () const; - }; - - }; + /* This struct is for converting CF types to AB types (Core Foundation + * types to Address Book types). + */ + struct lcl_CFType { + CFTypeID cf; + sal_Int32 ab; + }; + + class MacabRecords{ + protected: + /* MacabRecords is, at its core, a table of macabfields, in the + * form of a header and a list of objects of type MacabRecord. + * It also has a unique name that refers to the name of the table. + */ + sal_Int32 recordsSize; + sal_Int32 currentRecord; + CFStringRef recordType; + MacabHeader *header; + MacabRecord **records; + ABAddressBookRef addressBook; + OUString m_sName; + + /* For converting CF types to AB types */ + std::vector<lcl_CFType> lcl_CFTypes; + + /* For required properties */ + std::vector<CFStringRef> requiredProperties; + + private: + /* All of the private methods are for creating a MacabHeader or a + * MacabRecord. They are used by the initialize method that goes + * about filling a MacabRecords using all of the records in the + * macOS Address Book. + */ + void bootstrap_CF_types(); + void bootstrap_requiredProperties(); + MacabHeader *createHeaderForProperty(const ABRecordRef _record, const CFStringRef _propertyName, const CFStringRef _recordType, const bool _isPropertyRequired) const; + MacabHeader *createHeaderForProperty(const ABPropertyType _propertyType, const CFTypeRef _propertyValue, const CFStringRef _propertyName) const; + ABPropertyType getABTypeFromCFType(const CFTypeID cf_type ) const; + void insertPropertyIntoMacabRecord(MacabRecord *_abrecord, const MacabHeader *_header, const OUString& _propertyName, const CFTypeRef _propertyValue) const; + void insertPropertyIntoMacabRecord(const ABPropertyType _propertyType, MacabRecord *_abrecord, const MacabHeader *_header, const OUString& _propertyName, const CFTypeRef _propertyValue) const; + public: + MacabRecords(const ABAddressBookRef _addressBook, MacabHeader *_header, MacabRecord **_records, sal_Int32 _numRecords); + explicit MacabRecords(const MacabRecords *_copy); + explicit MacabRecords(const ABAddressBookRef _addressBook); + ~MacabRecords(); + + void initialize(); + + void setHeader(MacabHeader *_header); + MacabHeader *getHeader() const; + + void setName(const OUString& _sName); + OUString const & getName() const; + + MacabRecord *insertRecord(MacabRecord *_newRecord, const sal_Int32 _location); + void insertRecord(MacabRecord *_newRecord); + MacabRecord *getRecord(const sal_Int32 _location) const; + void swap(const sal_Int32 _id1, const sal_Int32 _id2); + + macabfield *getField(const sal_Int32 _recordNumber, const sal_Int32 _columnNumber) const; + macabfield *getField(const sal_Int32 _recordNumber, std::u16string_view _columnName) const; + sal_Int32 getFieldNumber(std::u16string_view _columnName) const; + + sal_Int32 size() const; + + MacabHeader *createHeaderForRecordType(const CFArrayRef _records, const CFStringRef _recordType) const; + MacabRecord *createMacabRecord(const ABRecordRef _abrecord, const MacabHeader *_header, const CFStringRef _recordType) const; + + MacabRecords *begin(); + sal_Int32 end() const; + class iterator{ + protected: + MacabRecords *records; + public: + sal_Int32 id; + iterator& operator= (MacabRecords *_records); + iterator(); + void operator++ (); + bool operator!= (const sal_Int32 i) const; + bool operator== (const sal_Int32 i) const; + MacabRecord *operator* () const; + }; + + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabResultSet.hxx b/connectivity/source/drivers/macab/MacabResultSet.hxx index 306ef562d3b4..c3c949afc414 100644 --- a/connectivity/source/drivers/macab/MacabResultSet.hxx +++ b/connectivity/source/drivers/macab/MacabResultSet.hxx @@ -33,181 +33,181 @@ namespace connectivity::macab { - /* - ** MacabResultSet - */ - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XWarningsSupplier, - css::sdbc::XResultSetUpdate, - css::sdbc::XRowUpdate, - css::sdbcx::XRowLocate, - css::sdbcx::XDeleteRows, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate, - css::lang::XServiceInfo> MacabResultSet_BASE; - class MacabRecords; - - class MacabResultSet : public cppu::BaseMutex, - public MacabResultSet_BASE, - public ::cppu::OPropertySetHelper, - public comphelper::OPropertyArrayUsageHelper<MacabResultSet> + /* + ** MacabResultSet + */ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XWarningsSupplier, + css::sdbc::XResultSetUpdate, + css::sdbc::XRowUpdate, + css::sdbcx::XRowLocate, + css::sdbcx::XDeleteRows, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate, + css::lang::XServiceInfo> MacabResultSet_BASE; + class MacabRecords; + + class MacabResultSet : public cppu::BaseMutex, + public MacabResultSet_BASE, + public ::cppu::OPropertySetHelper, + public comphelper::OPropertyArrayUsageHelper<MacabResultSet> + { + protected: + ::rtl::Reference< MacabCommonStatement > m_xStatement; // the statement that has created this result set + ::rtl::Reference< MacabResultSetMetaData > m_xMetaData; // the description of the columns in this result set + MacabRecords * m_aMacabRecords; // address book entries matching the query + sal_Int32 m_nRowPos; // the current row within the result set + bool m_bWasNull; // last entry retrieved from this result set was NULL + OUString m_sTableName; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle) const override; + + // you can't delete objects of this type + virtual ~MacabResultSet() override; + + public: + DECLARE_SERVICE_INFO(); + + explicit MacabResultSet(MacabCommonStatement *pStmt); + + css::uno::Reference< css::uno::XInterface > operator *() { - protected: - ::rtl::Reference< MacabCommonStatement > m_xStatement; // the statement that has created this result set - ::rtl::Reference< MacabResultSetMetaData > m_xMetaData; // the description of the columns in this result set - MacabRecords * m_aMacabRecords; // address book entries matching the query - sal_Int32 m_nRowPos; // the current row within the result set - bool m_bWasNull; // last entry retrieved from this result set was NULL - OUString m_sTableName; - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, - sal_Int32 nHandle, - const css::uno::Any& rValue) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle) const override; - - // you can't delete objects of this type - virtual ~MacabResultSet() override; - - public: - DECLARE_SERVICE_INFO(); - - explicit MacabResultSet(MacabCommonStatement *pStmt); - - css::uno::Reference< css::uno::XInterface > operator *() - { - return css::uno::Reference< css::uno::XInterface >(*static_cast<MacabResultSet_BASE*>(this)); - } - - void allMacabRecords(); - void someMacabRecords(const class MacabCondition *pCondition); - void sortMacabRecords(const class MacabOrder *pOrder); - void setTableName(const OUString& _sTableName); - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - - // XResultSet - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - - // XCancellable - virtual void SAL_CALL cancel( ) override; - - // XCloseable - virtual void SAL_CALL close( ) override; - - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - - // XResultSetUpdate - virtual void SAL_CALL insertRow( ) override; - virtual void SAL_CALL updateRow( ) override; - virtual void SAL_CALL deleteRow( ) override; - virtual void SAL_CALL cancelRowUpdates( ) override; - virtual void SAL_CALL moveToInsertRow( ) override; - virtual void SAL_CALL moveToCurrentRow( ) override; - // XRowUpdate - virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; - - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - - // XRowLocate - virtual css::uno::Any SAL_CALL getBookmark( ) override; - virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; - virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& firstItem, const css::uno::Any& secondItem ) override; - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; - virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; - - // XDeleteRows - virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; - }; + return css::uno::Reference< css::uno::XInterface >(*static_cast<MacabResultSet_BASE*>(this)); + } + + void allMacabRecords(); + void someMacabRecords(const class MacabCondition *pCondition); + void sortMacabRecords(const class MacabOrder *pOrder); + void setTableName(const OUString& _sTableName); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // XResultSet + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + + // XCancellable + virtual void SAL_CALL cancel( ) override; + + // XCloseable + virtual void SAL_CALL close( ) override; + + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) override; + virtual void SAL_CALL updateRow( ) override; + virtual void SAL_CALL deleteRow( ) override; + virtual void SAL_CALL cancelRowUpdates( ) override; + virtual void SAL_CALL moveToInsertRow( ) override; + virtual void SAL_CALL moveToCurrentRow( ) override; + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; + + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + + // XRowLocate + virtual css::uno::Any SAL_CALL getBookmark( ) override; + virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; + virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& firstItem, const css::uno::Any& secondItem ) override; + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; + virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; + + // XDeleteRows + virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx index b82088154cb9..16dc1d34ea8d 100644 --- a/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx +++ b/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx @@ -27,54 +27,54 @@ namespace connectivity::macab { - /* - ** MacabResultSetMetaData - */ - class MacabResultSetMetaData : public ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> - { - MacabConnection* m_pConnection; - OUString m_sTableName; - std::vector<sal_Int32> m_aMacabFields; // for each selected column, contains the number - // of the corresponding AddressBook field + /* + ** MacabResultSetMetaData + */ + class MacabResultSetMetaData : public ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> + { + MacabConnection* m_pConnection; + OUString m_sTableName; + std::vector<sal_Int32> m_aMacabFields; // for each selected column, contains the number + // of the corresponding AddressBook field - protected: - virtual ~MacabResultSetMetaData() override; + protected: + virtual ~MacabResultSetMetaData() override; - public: - MacabResultSetMetaData(MacabConnection* _pConnection, OUString const & _sTableName); + public: + MacabResultSetMetaData(MacabConnection* _pConnection, OUString const & _sTableName); - // avoid ambiguous cast error from the compiler - operator css::uno::Reference< css::sdbc::XResultSetMetaData > () noexcept - { return this; } + // avoid ambiguous cast error from the compiler + operator css::uno::Reference< css::sdbc::XResultSetMetaData > () noexcept + { return this; } - /// @throws css::sdbc::SQLException - void setMacabFields( - const ::rtl::Reference<connectivity::OSQLColumns> &xColumns); - sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const - { return m_aMacabFields[columnIndex - 1]; } + /// @throws css::sdbc::SQLException + void setMacabFields( + const ::rtl::Reference<connectivity::OSQLColumns> &xColumns); + sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const + { return m_aMacabFields[columnIndex - 1]; } - virtual sal_Int32 SAL_CALL getColumnCount( ) override; - virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; - virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; - virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; - virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; - }; + virtual sal_Int32 SAL_CALL getColumnCount( ) override; + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; + virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; + virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; + virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabStatement.hxx b/connectivity/source/drivers/macab/MacabStatement.hxx index 700a895c0a38..8c72bd55974b 100644 --- a/connectivity/source/drivers/macab/MacabStatement.hxx +++ b/connectivity/source/drivers/macab/MacabStatement.hxx @@ -33,137 +33,137 @@ namespace connectivity::macab { - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement, - css::sdbc::XWarningsSupplier, - css::util::XCancellable, - css::sdbc::XCloseable> MacabCommonStatement_BASE; - - - // Class MacabCommonStatement - // is a base class for the normal statement and for the prepared statement - - class MacabCommonStatement : public cppu::BaseMutex, - public MacabCommonStatement_BASE, - public ::cppu::OPropertySetHelper, - public comphelper::OPropertyArrayUsageHelper<MacabCommonStatement> - - { - css::sdbc::SQLWarning m_aLastWarning; - - protected: - connectivity::OSQLParser m_aParser; - connectivity::OSQLParseTreeIterator m_aSQLIterator; - connectivity::OSQLParseNode* m_pParseTree; - MacabConnection* m_pConnection; // The owning Connection object - MacabHeader* m_pHeader; // The header of the address book on which to run queries (provided by m_pConnection) - css::uno::WeakReference< css::sdbc::XResultSet> m_xResultSet; // The last ResultSet created - - - protected: - /// @throws css::sdbc::SQLException - class MacabCondition *analyseWhereClause( - const OSQLParseNode *pParseNode) const; - /// @throws css::sdbc::SQLException - class MacabOrder *analyseOrderByClause( - const OSQLParseNode *pParseNode) const; - OUString getTableName( ) const; - /// @throws css::sdbc::SQLException - void setMacabFields(class MacabResultSet *pResult) const; - /// @throws css::sdbc::SQLException - void selectRecords(MacabResultSet *pResult) const; - /// @throws css::sdbc::SQLException - void sortRecords(MacabResultSet *pResult) const; - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, - sal_Int32 nHandle, - const css::uno::Any& rValue) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle) const override; - - /// @throws css::sdbc::SQLException - virtual void resetParameters() const; - /// @throws css::sdbc::SQLException - virtual void getNextParameter(OUString &rParameter) const; - virtual ~MacabCommonStatement() override; - - public: - using MacabCommonStatement_BASE::rBHelper; - - explicit MacabCommonStatement(MacabConnection *_pConnection); - using MacabCommonStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; - - // OComponentHelper - using MacabCommonStatement_BASE::disposing; - - // XInterface - virtual void SAL_CALL release() noexcept override; - virtual void SAL_CALL acquire() noexcept override; - virtual css::uno::Any SAL_CALL queryInterface( - const css::uno::Type & rType - ) override; - - // XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( - ) override; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( - ) override; - - // XStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( - const OUString& sql ) override; - virtual sal_Int32 SAL_CALL executeUpdate( - const OUString& sql ) override; - virtual sal_Bool SAL_CALL execute( - const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( - ) override; - - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( - ) override; - virtual void SAL_CALL clearWarnings( - ) override; - - // XCancellable - virtual void SAL_CALL cancel( - ) override; - - // XCloseable - virtual void SAL_CALL close( - ) override; - - // other methods - MacabConnection* getOwnConnection() const { return m_pConnection; } - }; - - - // Class MacabStatement - - typedef ::cppu::ImplInheritanceHelper< - MacabCommonStatement, css::lang::XServiceInfo > MacabStatement_BASE; - - class MacabStatement : public MacabStatement_BASE - { - protected: - virtual ~MacabStatement() override { } - - public: - explicit MacabStatement(MacabConnection* _pConnection); - DECLARE_SERVICE_INFO(); - }; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement, + css::sdbc::XWarningsSupplier, + css::util::XCancellable, + css::sdbc::XCloseable> MacabCommonStatement_BASE; + + + // Class MacabCommonStatement + // is a base class for the normal statement and for the prepared statement + + class MacabCommonStatement : public cppu::BaseMutex, + public MacabCommonStatement_BASE, + public ::cppu::OPropertySetHelper, + public comphelper::OPropertyArrayUsageHelper<MacabCommonStatement> + + { + css::sdbc::SQLWarning m_aLastWarning; + + protected: + connectivity::OSQLParser m_aParser; + connectivity::OSQLParseTreeIterator m_aSQLIterator; + connectivity::OSQLParseNode* m_pParseTree; + MacabConnection* m_pConnection; // The owning Connection object + MacabHeader* m_pHeader; // The header of the address book on which to run queries (provided by m_pConnection) + css::uno::WeakReference< css::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + + + protected: + /// @throws css::sdbc::SQLException + class MacabCondition *analyseWhereClause( + const OSQLParseNode *pParseNode) const; + /// @throws css::sdbc::SQLException + class MacabOrder *analyseOrderByClause( + const OSQLParseNode *pParseNode) const; + OUString getTableName( ) const; + /// @throws css::sdbc::SQLException + void setMacabFields(class MacabResultSet *pResult) const; + /// @throws css::sdbc::SQLException + void selectRecords(MacabResultSet *pResult) const; + /// @throws css::sdbc::SQLException + void sortRecords(MacabResultSet *pResult) const; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle) const override; + + /// @throws css::sdbc::SQLException + virtual void resetParameters() const; + /// @throws css::sdbc::SQLException + virtual void getNextParameter(OUString &rParameter) const; + virtual ~MacabCommonStatement() override; + + public: + using MacabCommonStatement_BASE::rBHelper; + + explicit MacabCommonStatement(MacabConnection *_pConnection); + using MacabCommonStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; + + // OComponentHelper + using MacabCommonStatement_BASE::disposing; + + // XInterface + virtual void SAL_CALL release() noexcept override; + virtual void SAL_CALL acquire() noexcept override; + virtual css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType + ) override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( + ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( + ) override; + + // XStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( + const OUString& sql ) override; + virtual sal_Int32 SAL_CALL executeUpdate( + const OUString& sql ) override; + virtual sal_Bool SAL_CALL execute( + const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( + ) override; + + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( + ) override; + virtual void SAL_CALL clearWarnings( + ) override; + + // XCancellable + virtual void SAL_CALL cancel( + ) override; + + // XCloseable + virtual void SAL_CALL close( + ) override; + + // other methods + MacabConnection* getOwnConnection() const { return m_pConnection; } + }; + + + // Class MacabStatement + + typedef ::cppu::ImplInheritanceHelper< + MacabCommonStatement, css::lang::XServiceInfo > MacabStatement_BASE; + + class MacabStatement : public MacabStatement_BASE + { + protected: + virtual ~MacabStatement() override { } + + public: + explicit MacabStatement(MacabConnection* _pConnection); + DECLARE_SERVICE_INFO(); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabTable.hxx b/connectivity/source/drivers/macab/MacabTable.hxx index 897d589cc697..ac57c49c7f0c 100644 --- a/connectivity/source/drivers/macab/MacabTable.hxx +++ b/connectivity/source/drivers/macab/MacabTable.hxx @@ -24,31 +24,31 @@ namespace connectivity::macab { - typedef connectivity::sdbcx::OTable MacabTable_TYPEDEF; - - class MacabTable : public MacabTable_TYPEDEF - { - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - MacabConnection* m_pConnection; - - public: - MacabTable( sdbcx::OCollection* _pTables, MacabConnection* _pConnection); - MacabTable( sdbcx::OCollection* _pTables, - MacabConnection* _pConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description = OUString(), - const OUString& SchemaName = OUString(), - const OUString& CatalogName = OUString() - ); - - MacabConnection* getConnection() { return m_pConnection;} - - virtual void refreshColumns() override; - - OUString const & getTableName() const { return m_Name; } - OUString const & getSchema() const { return m_SchemaName; } - }; + typedef connectivity::sdbcx::OTable MacabTable_TYPEDEF; + + class MacabTable : public MacabTable_TYPEDEF + { + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + MacabConnection* m_pConnection; + + public: + MacabTable( sdbcx::OCollection* _pTables, MacabConnection* _pConnection); + MacabTable( sdbcx::OCollection* _pTables, + MacabConnection* _pConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description = OUString(), + const OUString& SchemaName = OUString(), + const OUString& CatalogName = OUString() + ); + + MacabConnection* getConnection() { return m_pConnection;} + + virtual void refreshColumns() override; + + OUString const & getTableName() const { return m_Name; } + OUString const & getSchema() const { return m_SchemaName; } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabTables.hxx b/connectivity/source/drivers/macab/MacabTables.hxx index 0fe248045a85..d9ccad86da13 100644 --- a/connectivity/source/drivers/macab/MacabTables.hxx +++ b/connectivity/source/drivers/macab/MacabTables.hxx @@ -24,26 +24,26 @@ namespace connectivity::macab { - class MacabTables : public sdbcx::OCollection - { - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + class MacabTables : public sdbcx::OCollection + { + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; - public: - MacabTables( - const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData, - ::cppu::OWeakObject& _rParent, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) - : sdbcx::OCollection(_rParent,true,_rMutex,_rVector), - m_xMetaData(_rMetaData) - { } + public: + MacabTables( + const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData, + ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) + : sdbcx::OCollection(_rParent,true,_rMutex,_rVector), + m_xMetaData(_rMetaData) + { } - virtual void disposing() override; - }; + virtual void disposing() override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/macaborder.hxx b/connectivity/source/drivers/macab/macaborder.hxx index e5eb6c987ce2..36151cb76ea6 100644 --- a/connectivity/source/drivers/macab/macaborder.hxx +++ b/connectivity/source/drivers/macab/macaborder.hxx @@ -29,36 +29,36 @@ namespace connectivity::macab { - class MacabOrder - { - public: - virtual ~MacabOrder(); + class MacabOrder + { + public: + virtual ~MacabOrder(); - virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const = 0; - }; + virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const = 0; + }; - class MacabSimpleOrder : public MacabOrder - { - sal_Int32 m_nFieldNumber; - bool m_bAscending; + class MacabSimpleOrder : public MacabOrder + { + sal_Int32 m_nFieldNumber; + bool m_bAscending; - public: - MacabSimpleOrder(MacabHeader const *header, std::u16string_view sColumnName, bool bAscending); + public: + MacabSimpleOrder(MacabHeader const *header, std::u16string_view sColumnName, bool bAscending); - virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const override; - }; + virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const override; + }; - class MacabComplexOrder : public MacabOrder - { - std::vector<std::unique_ptr<MacabOrder>> m_aOrders; + class MacabComplexOrder : public MacabOrder + { + std::vector<std::unique_ptr<MacabOrder>> m_aOrders; - public: - MacabComplexOrder(); - virtual ~MacabComplexOrder() override; + public: + MacabComplexOrder(); + virtual ~MacabComplexOrder() override; - void addOrder(MacabOrder *pOrder); - virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const override; - }; + void addOrder(MacabOrder *pOrder); + virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx index 7e0f6b091085..f89553c9ea27 100644 --- a/connectivity/source/drivers/macab/macabutilities.hxx +++ b/connectivity/source/drivers/macab/macabutilities.hxx @@ -36,107 +36,107 @@ namespace connectivity::macab { - inline OUString CFStringToOUString(const CFStringRef sOrig) - { - /* Copied all-but directly from code by Florian Heckl in - * cws_src680_aquafilepicker01 - * File was: fpicker/source/aqua/CFStringUtilities - * I only removed commented debugging lines and changed variable - * names. - */ - if (nullptr == sOrig) { - return OUString(); - } + inline OUString CFStringToOUString(const CFStringRef sOrig) + { + /* Copied all-but directly from code by Florian Heckl in + * cws_src680_aquafilepicker01 + * File was: fpicker/source/aqua/CFStringUtilities + * I only removed commented debugging lines and changed variable + * names. + */ + if (nullptr == sOrig) { + return OUString(); + } - CFRetain(sOrig); - CFIndex nStringLength = CFStringGetLength(sOrig); + CFRetain(sOrig); + CFIndex nStringLength = CFStringGetLength(sOrig); - auto const unichars = std::make_unique<UniChar[]>(nStringLength+1); + auto const unichars = std::make_unique<UniChar[]>(nStringLength+1); - //'close' the string buffer correctly - unichars[nStringLength] = '\0'; + //'close' the string buffer correctly + unichars[nStringLength] = '\0'; - CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars.get()); - CFRelease(sOrig); + CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars.get()); + CFRelease(sOrig); - return OUString(reinterpret_cast<sal_Unicode *>(unichars.get())); - } + return OUString(reinterpret_cast<sal_Unicode *>(unichars.get())); + } - inline CFStringRef OUStringToCFString(const OUString& aString) - { - /* Copied directly from code by Florian Heckl in - * cws_src680_aquafilepicker01 - * File was: fpicker/source/aqua/CFStringUtilities - */ + inline CFStringRef OUStringToCFString(const OUString& aString) + { + /* Copied directly from code by Florian Heckl in + * cws_src680_aquafilepicker01 + * File was: fpicker/source/aqua/CFStringUtilities + */ - CFStringRef ref = CFStringCreateWithCharacters(kCFAllocatorDefault, reinterpret_cast<UniChar const *>(aString.getStr()), aString.getLength()); + CFStringRef ref = CFStringCreateWithCharacters(kCFAllocatorDefault, reinterpret_cast<UniChar const *>(aString.getStr()), aString.getLength()); - return ref; - } + return ref; + } - inline css::util::DateTime CFDateToDateTime(const CFDateRef _cfDate) + inline css::util::DateTime CFDateToDateTime(const CFDateRef _cfDate) + { + /* Carbon can give us the time since 2001 of any CFDateRef, + * and it also stores the time since 1970 as a constant, + * basically allowing us to get the unixtime of any + * CFDateRef. From there, it is just a matter of choosing what + * we want to do with it. + */ + css::util::DateTime nRet; + double timeSince2001 = CFDateGetAbsoluteTime(_cfDate); + time_t unixtime = timeSince2001+kCFAbsoluteTimeIntervalSince1970; + struct tm *ptm = localtime(&unixtime); + nRet.Year = ptm->tm_year+1900; + nRet.Month = ptm->tm_mon+1; + nRet.Day = ptm->tm_mday; + nRet.Hours = ptm->tm_hour; + nRet.Minutes = ptm->tm_min; + nRet.Seconds = ptm->tm_sec; + nRet.NanoSeconds = 0; + return nRet; + } + + + inline OUString fixLabel(const OUString& _originalLabel) + { + /* Get the length, and make sure that there is actually a string + * here. + */ + if(_originalLabel.startsWith("_$!<")) { - /* Carbon can give us the time since 2001 of any CFDateRef, - * and it also stores the time since 1970 as a constant, - * basically allowing us to get the unixtime of any - * CFDateRef. From there, it is just a matter of choosing what - * we want to do with it. - */ - css::util::DateTime nRet; - double timeSince2001 = CFDateGetAbsoluteTime(_cfDate); - time_t unixtime = timeSince2001+kCFAbsoluteTimeIntervalSince1970; - struct tm *ptm = localtime(&unixtime); - nRet.Year = ptm->tm_year+1900; - nRet.Month = ptm->tm_mon+1; - nRet.Day = ptm->tm_mday; - nRet.Hours = ptm->tm_hour; - nRet.Minutes = ptm->tm_min; - nRet.Seconds = ptm->tm_sec; - nRet.NanoSeconds = 0; - return nRet; + return _originalLabel.copy(4,_originalLabel.getLength()-8); } - - inline OUString fixLabel(const OUString& _originalLabel) - { - /* Get the length, and make sure that there is actually a string - * here. - */ - if(_originalLabel.startsWith("_$!<")) - { - return _originalLabel.copy(4,_originalLabel.getLength()-8); - } - - return _originalLabel; - } + return _originalLabel; + } - inline sal_Int32 ABTypeToDataType(const ABPropertyType _abType) + inline sal_Int32 ABTypeToDataType(const ABPropertyType _abType) + { + sal_Int32 dataType; + switch(_abType) { - sal_Int32 dataType; - switch(_abType) - { - case kABStringProperty: - dataType = css::sdbc::DataType::CHAR; - break; - case kABDateProperty: - dataType = css::sdbc::DataType::TIMESTAMP; - break; - case kABIntegerProperty: - dataType = css::sdbc::DataType::INTEGER; - break; - case kABRealProperty: - dataType = css::sdbc::DataType::FLOAT; - break; - default: - dataType = -1; - } - return dataType; + case kABStringProperty: + dataType = css::sdbc::DataType::CHAR; + break; + case kABDateProperty: + dataType = css::sdbc::DataType::TIMESTAMP; + break; + case kABIntegerProperty: + dataType = css::sdbc::DataType::INTEGER; + break; + case kABRealProperty: + dataType = css::sdbc::DataType::FLOAT; + break; + default: + dataType = -1; } + return dataType; + } - void impl_throwError(TranslateId pErrorId); + void impl_throwError(TranslateId pErrorId); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx index e01a2bb9612c..57f207c92345 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx @@ -29,49 +29,49 @@ namespace connectivity::mozab { - typedef ::cppu::WeakComponentImplHelper< css::mozilla::XMozillaBootstrap, - css::lang::XServiceInfo > OMozillaBootstrap_BASE; - class ProfileAccess; - class ProfileManager; - class MozillaBootstrap : public OMozillaBootstrap_BASE - { - private: - ::osl::Mutex m_aMutex; // mutex is need to control member access - virtual ~MozillaBootstrap() override; - std::unique_ptr<ProfileAccess> m_ProfileAccess; - public: + typedef ::cppu::WeakComponentImplHelper< css::mozilla::XMozillaBootstrap, + css::lang::XServiceInfo > OMozillaBootstrap_BASE; + class ProfileAccess; + class ProfileManager; + class MozillaBootstrap : public OMozillaBootstrap_BASE + { + private: + ::osl::Mutex m_aMutex; // mutex is need to control member access + virtual ~MozillaBootstrap() override; + std::unique_ptr<ProfileAccess> m_ProfileAccess; + public: - MozillaBootstrap(); + MozillaBootstrap(); - // OComponentHelper - virtual void SAL_CALL disposing() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XMozillaBootstrap + // XMozillaBootstrap - // XProfileDiscover - virtual ::sal_Int32 SAL_CALL getProfileCount( css::mozilla::MozillaProductType product) override; - virtual ::sal_Int32 SAL_CALL getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list ) override; - virtual OUString SAL_CALL getDefaultProfile( css::mozilla::MozillaProductType product ) override; - virtual OUString SAL_CALL getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName ) override; - virtual sal_Bool SAL_CALL isProfileLocked( css::mozilla::MozillaProductType product, const OUString& profileName ) override; - virtual sal_Bool SAL_CALL getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName ) override; + // XProfileDiscover + virtual ::sal_Int32 SAL_CALL getProfileCount( css::mozilla::MozillaProductType product) override; + virtual ::sal_Int32 SAL_CALL getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list ) override; + virtual OUString SAL_CALL getDefaultProfile( css::mozilla::MozillaProductType product ) override; + virtual OUString SAL_CALL getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName ) override; + virtual sal_Bool SAL_CALL isProfileLocked( css::mozilla::MozillaProductType product, const OUString& profileName ) override; + virtual sal_Bool SAL_CALL getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName ) override; - // XProfileManager - virtual ::sal_Int32 SAL_CALL bootupProfile( css::mozilla::MozillaProductType product, const OUString& profileName ) override; - virtual ::sal_Int32 SAL_CALL shutdownProfile( ) override; - virtual css::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) override; - virtual OUString SAL_CALL getCurrentProfile( ) override; - virtual sal_Bool SAL_CALL isCurrentProfileLocked( ) override; - virtual OUString SAL_CALL setCurrentProfile( css::mozilla::MozillaProductType product, const OUString& profileName ) override; + // XProfileManager + virtual ::sal_Int32 SAL_CALL bootupProfile( css::mozilla::MozillaProductType product, const OUString& profileName ) override; + virtual ::sal_Int32 SAL_CALL shutdownProfile( ) override; + virtual css::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) override; + virtual OUString SAL_CALL getCurrentProfile( ) override; + virtual sal_Bool SAL_CALL isCurrentProfileLocked( ) override; + virtual OUString SAL_CALL setCurrentProfile( css::mozilla::MozillaProductType product, const OUString& profileName ) override; - // XProxyRunner - virtual ::sal_Int32 SAL_CALL Run( const css::uno::Reference< css::mozilla::XCodeProxy >& aCode ) override; - }; + // XProxyRunner + virtual ::sal_Int32 SAL_CALL Run( const css::uno::Reference< css::mozilla::XCodeProxy >& aCode ) override; + }; } diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx index 132ac06c003c..5c60dc87e544 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx @@ -32,47 +32,47 @@ namespace connectivity::mozab { class ProfileStruct; } typedef std::map<OUString, ::connectivity::mozab::ProfileStruct> ProfileList; namespace connectivity::mozab +{ + class ProfileStruct { - class ProfileStruct - { - public: - ProfileStruct(); - ProfileStruct(OUString aProfileName, OUString aProfilePath); - const OUString& getProfileName() const { return profileName;} - const OUString& getProfilePath() const; - private: - OUString profileName; - OUString profilePath; - }; + public: + ProfileStruct(); + ProfileStruct(OUString aProfileName, OUString aProfilePath); + const OUString& getProfileName() const { return profileName;} + const OUString& getProfilePath() const; + private: + OUString profileName; + OUString profilePath; + }; - class ProductStruct - { - public: - OUString mCurrentProfileName; - ProfileList mProfileList; - }; + class ProductStruct + { + public: + OUString mCurrentProfileName; + ProfileList mProfileList; + }; - //Used to query profiles information - class ProfileAccess final - { - public: - ~ProfileAccess(); - ProfileAccess(); - /// @throws css::uno::RuntimeException - OUString getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName ); - /// @throws css::uno::RuntimeException - ::sal_Int32 getProfileCount( css::mozilla::MozillaProductType product ); - /// @throws css::uno::RuntimeException - ::sal_Int32 getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list ); - /// @throws css::uno::RuntimeException - OUString getDefaultProfile( css::mozilla::MozillaProductType product ); - /// @throws css::uno::RuntimeException - bool getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName ); - private: - ProductStruct m_ProductProfileList[4]; - void LoadProductsInfo(); - void LoadXPToolkitProfiles(MozillaProductType product); - }; + //Used to query profiles information + class ProfileAccess final + { + public: + ~ProfileAccess(); + ProfileAccess(); + /// @throws css::uno::RuntimeException + OUString getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName ); + /// @throws css::uno::RuntimeException + ::sal_Int32 getProfileCount( css::mozilla::MozillaProductType product ); + /// @throws css::uno::RuntimeException + ::sal_Int32 getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list ); + /// @throws css::uno::RuntimeException + OUString getDefaultProfile( css::mozilla::MozillaProductType product ); + /// @throws css::uno::RuntimeException + bool getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName ); + private: + ProductStruct m_ProductProfileList[4]; + void LoadProductsInfo(); + void LoadXPToolkitProfiles(MozillaProductType product); + }; } diff --git a/connectivity/source/inc/TDatabaseMetaDataBase.hxx b/connectivity/source/inc/TDatabaseMetaDataBase.hxx index de5d25ac3233..6fb37adea881 100644 --- a/connectivity/source/inc/TDatabaseMetaDataBase.hxx +++ b/connectivity/source/inc/TDatabaseMetaDataBase.hxx @@ -32,105 +32,105 @@ namespace comphelper { class OEventListenerHelper; } namespace connectivity { - class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataBase : - public cppu::BaseMutex, - public ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData2, - css::lang::XEventListener> + class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataBase : + public cppu::BaseMutex, + public ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData2, + css::lang::XEventListener> + { + private: + css::uno::Sequence< css::beans::PropertyValue > m_aConnectionInfo; + ::connectivity::ODatabaseMetaDataResultSet::ORows m_aTypeInfoRows; + + // cached database information + std::pair<bool,bool> m_isCatalogAtStart; + std::pair<bool,OUString> m_sCatalogSeparator; + std::pair<bool,OUString> m_sIdentifierQuoteString; + std::pair<bool,bool> m_supportsCatalogsInTableDefinitions; + std::pair<bool,bool> m_supportsSchemasInTableDefinitions; + std::pair<bool,bool> m_supportsCatalogsInDataManipulation; + std::pair<bool,bool> m_supportsSchemasInDataManipulation; + std::pair<bool,bool> m_supportsMixedCaseQuotedIdentifiers; + std::pair<bool,bool> m_supportsAlterTableWithAddColumn; + std::pair<bool,bool> m_supportsAlterTableWithDropColumn; + std::pair<bool,sal_Int32> m_MaxStatements; + std::pair<bool,sal_Int32> m_MaxTablesInSelect; + std::pair<bool,bool> m_storesMixedCaseQuotedIdentifiers; + + template <typename T> T callImplMethod(std::pair<bool,T>& _rCache,const std::function<T(ODatabaseMetaDataBase *)>& _pImplMethod) { - private: - css::uno::Sequence< css::beans::PropertyValue > m_aConnectionInfo; - ::connectivity::ODatabaseMetaDataResultSet::ORows m_aTypeInfoRows; - - // cached database information - std::pair<bool,bool> m_isCatalogAtStart; - std::pair<bool,OUString> m_sCatalogSeparator; - std::pair<bool,OUString> m_sIdentifierQuoteString; - std::pair<bool,bool> m_supportsCatalogsInTableDefinitions; - std::pair<bool,bool> m_supportsSchemasInTableDefinitions; - std::pair<bool,bool> m_supportsCatalogsInDataManipulation; - std::pair<bool,bool> m_supportsSchemasInDataManipulation; - std::pair<bool,bool> m_supportsMixedCaseQuotedIdentifiers; - std::pair<bool,bool> m_supportsAlterTableWithAddColumn; - std::pair<bool,bool> m_supportsAlterTableWithDropColumn; - std::pair<bool,sal_Int32> m_MaxStatements; - std::pair<bool,sal_Int32> m_MaxTablesInSelect; - std::pair<bool,bool> m_storesMixedCaseQuotedIdentifiers; - - template <typename T> T callImplMethod(std::pair<bool,T>& _rCache,const std::function<T(ODatabaseMetaDataBase *)>& _pImplMethod) + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !_rCache.first ) { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !_rCache.first ) - { - _rCache.second = _pImplMethod(this); - _rCache.first = true; - } - return _rCache.second; + _rCache.second = _pImplMethod(this); + _rCache.first = true; } - protected: - css::uno::Reference< css::sdbc::XConnection > m_xConnection; - rtl::Reference< comphelper::OEventListenerHelper> m_xListenerHelper; // forward the calls from the connection to me - - virtual ~ODatabaseMetaDataBase() override; - - protected: - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() = 0; - // cached database information - virtual OUString impl_getIdentifierQuoteString_throw( ) = 0; - virtual bool impl_isCatalogAtStart_throw( ) = 0; - virtual OUString impl_getCatalogSeparator_throw( ) = 0; - virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) = 0; - virtual bool impl_supportsSchemasInTableDefinitions_throw( ) = 0; - virtual bool impl_supportsCatalogsInDataManipulation_throw( ) = 0; - virtual bool impl_supportsSchemasInDataManipulation_throw( ) = 0; - virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) = 0; - virtual bool impl_supportsAlterTableWithAddColumn_throw( ) = 0; - virtual bool impl_supportsAlterTableWithDropColumn_throw( ) = 0; - virtual sal_Int32 impl_getMaxStatements_throw( ) = 0; - virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) = 0; - virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) = 0; - - - public: - - ODatabaseMetaDataBase(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo); - - // XDatabaseMetaData2 - virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getConnectionInfo( ) override; - - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; - - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; - // cached database information - virtual OUString SAL_CALL getIdentifierQuoteString( ) override; - virtual sal_Bool SAL_CALL isCatalogAtStart( ) override; - virtual OUString SAL_CALL getCatalogSeparator( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; - virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; - virtual sal_Int32 SAL_CALL getMaxStatements( ) override; - virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) override; - }; + return _rCache.second; + } + protected: + css::uno::Reference< css::sdbc::XConnection > m_xConnection; + rtl::Reference< comphelper::OEventListenerHelper> m_xListenerHelper; // forward the calls from the connection to me + + virtual ~ODatabaseMetaDataBase() override; + + protected: + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() = 0; + // cached database information + virtual OUString impl_getIdentifierQuoteString_throw( ) = 0; + virtual bool impl_isCatalogAtStart_throw( ) = 0; + virtual OUString impl_getCatalogSeparator_throw( ) = 0; + virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) = 0; + virtual bool impl_supportsSchemasInTableDefinitions_throw( ) = 0; + virtual bool impl_supportsCatalogsInDataManipulation_throw( ) = 0; + virtual bool impl_supportsSchemasInDataManipulation_throw( ) = 0; + virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) = 0; + virtual bool impl_supportsAlterTableWithAddColumn_throw( ) = 0; + virtual bool impl_supportsAlterTableWithDropColumn_throw( ) = 0; + virtual sal_Int32 impl_getMaxStatements_throw( ) = 0; + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) = 0; + virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) = 0; + + + public: + + ODatabaseMetaDataBase(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo); + + // XDatabaseMetaData2 + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getConnectionInfo( ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; + + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; + // cached database information + virtual OUString SAL_CALL getIdentifierQuoteString( ) override; + virtual sal_Bool SAL_CALL isCatalogAtStart( ) override; + virtual OUString SAL_CALL getCatalogSeparator( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; + virtual sal_Int32 SAL_CALL getMaxStatements( ) override; + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ACallableStatement.hxx b/connectivity/source/inc/ado/ACallableStatement.hxx index e58617b3b00e..707b57ebb315 100644 --- a/connectivity/source/inc/ado/ACallableStatement.hxx +++ b/connectivity/source/inc/ado/ACallableStatement.hxx @@ -27,49 +27,49 @@ namespace connectivity::ado { - //************ Class: java.sql.CallableStatement + //************ Class: java.sql.CallableStatement - class OCallableStatement : public OPreparedStatement, - public css::sdbc::XRow, - public css::sdbc::XOutParameters - { - OLEVariant m_aValue; - public: - DECLARE_SERVICE_INFO(); + class OCallableStatement : public OPreparedStatement, + public css::sdbc::XRow, + public css::sdbc::XOutParameters + { + OLEVariant m_aValue; + public: + DECLARE_SERVICE_INFO(); - // a Constructor, that is needed for when Returning the Object is needed: - OCallableStatement( OConnection* _pConnection, const OUString& sql ); + // a Constructor, that is needed for when Returning the Object is needed: + OCallableStatement( OConnection* _pConnection, const OUString& sql ); - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XOutParameters - virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; - virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) override; - }; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XOutParameters + virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; + virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) override; + }; } diff --git a/connectivity/source/inc/ado/ACatalog.hxx b/connectivity/source/inc/ado/ACatalog.hxx index fd09e9ad3c40..326b803f7f51 100644 --- a/connectivity/source/inc/ado/ACatalog.hxx +++ b/connectivity/source/inc/ado/ACatalog.hxx @@ -23,27 +23,27 @@ namespace connectivity::ado { - class OConnection; + class OConnection; - class OCatalog : public connectivity::sdbcx::OCatalog - { - WpADOCatalog m_aCatalog; - OConnection* m_pConnection; + class OCatalog : public connectivity::sdbcx::OCatalog + { + WpADOCatalog m_aCatalog; + OConnection* m_pConnection; - public: - virtual void refreshTables() override; - virtual void refreshViews() override; - virtual void refreshGroups() override; - virtual void refreshUsers() override; + public: + virtual void refreshTables() override; + virtual void refreshViews() override; + virtual void refreshGroups() override; + virtual void refreshUsers() override; - public: - OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon); - ~OCatalog() override; + public: + OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon); + ~OCatalog() override; - OConnection* getConnection() const { return m_pConnection; } - sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } - WpADOCatalog getCatalog() const { return m_aCatalog; } - }; + OConnection* getConnection() const { return m_pConnection; } + sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } + WpADOCatalog getCatalog() const { return m_aCatalog; } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AColumn.hxx b/connectivity/source/inc/ado/AColumn.hxx index f297964820dc..151238a5f10d 100644 --- a/connectivity/source/inc/ado/AColumn.hxx +++ b/connectivity/source/inc/ado/AColumn.hxx @@ -24,29 +24,29 @@ namespace connectivity::ado { - class OConnection; - typedef sdbcx::OColumn OColumn_ADO; - class OAdoColumn : public OColumn_ADO - { - WpADOColumn m_aColumn; - OConnection* m_pConnection; - OUString m_ReferencedColumn; - bool m_IsAscending; + class OConnection; + typedef sdbcx::OColumn OColumn_ADO; + class OAdoColumn : public OColumn_ADO + { + WpADOColumn m_aColumn; + OConnection* m_pConnection; + OUString m_ReferencedColumn; + bool m_IsAscending; - void fillPropertyValues(); - protected: - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) override; - public: - OAdoColumn(bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn); - OAdoColumn(bool _bCase,OConnection* _pConnection); - // ODescriptor - virtual void construct() override; + void fillPropertyValues(); + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue + ) override; + public: + OAdoColumn(bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn); + OAdoColumn(bool _bCase,OConnection* _pConnection); + // ODescriptor + virtual void construct() override; - WpADOColumn getColumnImpl() const; - }; + WpADOColumn getColumnImpl() const; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AColumns.hxx b/connectivity/source/inc/ado/AColumns.hxx index 9c307c9dc386..4ff9ad041376 100644 --- a/connectivity/source/inc/ado/AColumns.hxx +++ b/connectivity/source/inc/ado/AColumns.hxx @@ -26,31 +26,31 @@ namespace connectivity::ado { - class OConnection; - class OColumns : public sdbcx::OCollection - { - protected: - WpADOColumns m_aCollection; - OConnection* m_pConnection; + class OConnection; + class OColumns : public sdbcx::OCollection + { + protected: + WpADOColumns m_aCollection; + OConnection* m_pConnection; - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; - public: - OColumns( ::cppu::OWeakObject& _rParent, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - const WpADOColumns& _rCollection, - bool _bCase, - OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) - ,m_aCollection(_rCollection) - ,m_pConnection(_pConnection) - { - } + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOColumns& _rCollection, + bool _bCase, + OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pConnection(_pConnection) + { + } - }; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx index 38a8a6d757bb..2d29fbe64a12 100644 --- a/connectivity/source/inc/ado/AConnection.hxx +++ b/connectivity/source/inc/ado/AConnection.hxx @@ -32,100 +32,100 @@ namespace connectivity::ado { - struct OExtendedTypeInfo + struct OExtendedTypeInfo + { + ::connectivity::OTypeInfo aSimpleType; // the general type info + DataTypeEnum eType; + + OUString getDBName() const { return aSimpleType.aTypeName; } + }; + + class WpADOConnection; + class ODriver; + typedef std::multimap<DataTypeEnum, OExtendedTypeInfo*> OTypeInfoMap; + typedef connectivity::OMetaConnection OConnection_BASE; + + + class OConnection : public OConnection_BASE + { + protected: + + // Data attributes + + OTypeInfoMap m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + unotools::WeakReference<OCatalog> m_xCatalog; + ODriver* m_pDriver; + private: + WpADOConnection m_aAdoConnection; + sal_Int32 m_nEngineType; + bool m_bClosed; + bool m_bAutocommit; + + protected: + /// @throws css::sdbc::SQLException + void buildTypeInfo(); + public: + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OConnection(ODriver* _pDriver); + // OConnection(const SQLHANDLE _pConnectionHandle); + ~OConnection() override; + void construct(std::u16string_view url,const css::uno::Sequence< css::beans::PropertyValue >& info); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + // XServiceInfo + DECLARE_SERVICE_INFO(); + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XConnection + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; + virtual sal_Bool SAL_CALL getAutoCommit( ) override; + virtual void SAL_CALL commit( ) override; + virtual void SAL_CALL rollback( ) override; + virtual sal_Bool SAL_CALL isClosed( ) override; + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual void SAL_CALL setCatalog( const OUString& catalog ) override; + virtual OUString SAL_CALL getCatalog( ) override; + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; + virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + + WpADOConnection& getConnection() { return m_aAdoConnection; } + void setCatalog(OCatalog* _pCatalog) { m_xCatalog = _pCatalog; } + + const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo;} + OCatalog* getAdoCatalog() const { - ::connectivity::OTypeInfo aSimpleType; // the general type info - DataTypeEnum eType; - - OUString getDBName() const { return aSimpleType.aTypeName; } - }; - - class WpADOConnection; - class ODriver; - typedef std::multimap<DataTypeEnum, OExtendedTypeInfo*> OTypeInfoMap; - typedef connectivity::OMetaConnection OConnection_BASE; - - - class OConnection : public OConnection_BASE - { - protected: - - // Data attributes - - OTypeInfoMap m_aTypeInfo; // vector containing an entry - // for each row returned by - // DatabaseMetaData.getTypeInfo. - unotools::WeakReference<OCatalog> m_xCatalog; - ODriver* m_pDriver; - private: - WpADOConnection m_aAdoConnection; - sal_Int32 m_nEngineType; - bool m_bClosed; - bool m_bAutocommit; - - protected: - /// @throws css::sdbc::SQLException - void buildTypeInfo(); - public: - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - OConnection(ODriver* _pDriver); - // OConnection(const SQLHANDLE _pConnectionHandle); - ~OConnection() override; - void construct(std::u16string_view url,const css::uno::Sequence< css::beans::PropertyValue >& info); - - //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); - // XServiceInfo - DECLARE_SERVICE_INFO(); - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XConnection - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; - virtual sal_Bool SAL_CALL getAutoCommit( ) override; - virtual void SAL_CALL commit( ) override; - virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual void SAL_CALL setCatalog( const OUString& catalog ) override; - virtual OUString SAL_CALL getCatalog( ) override; - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; - virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - - WpADOConnection& getConnection() { return m_aAdoConnection; } - void setCatalog(OCatalog* _pCatalog) { m_xCatalog = _pCatalog; } - - const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo;} - OCatalog* getAdoCatalog() const - { - return m_xCatalog.get().get(); - } - - sal_Int32 getEngineType() const { return m_nEngineType; } - ODriver* getDriver() const { return m_pDriver; } - - static const OExtendedTypeInfo* getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, - DataTypeEnum _nType, - const OUString& _sTypeName, - sal_Int32 _nPrecision, - sal_Int32 _nScale, - bool& _brForceToType); - }; + return m_xCatalog.get().get(); + } + + sal_Int32 getEngineType() const { return m_nEngineType; } + ODriver* getDriver() const { return m_pDriver; } + + static const OExtendedTypeInfo* getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, + DataTypeEnum _nType, + const OUString& _sTypeName, + sal_Int32 _nPrecision, + sal_Int32 _nScale, + bool& _brForceToType); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ADatabaseMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaData.hxx index 1661ca44181c..2cecedda93fe 100644 --- a/connectivity/source/inc/ado/ADatabaseMetaData.hxx +++ b/connectivity/source/inc/ado/ADatabaseMetaData.hxx @@ -24,197 +24,197 @@ namespace connectivity::ado { - class WpADOConnection; - class OConnection; + class WpADOConnection; + class OConnection; - //************ Class: ODatabaseMetaData + //************ Class: ODatabaseMetaData - class ODatabaseMetaData : public ODatabaseMetaDataBase + class ODatabaseMetaData : public ODatabaseMetaDataBase + { + struct LiteralInfo { - struct LiteralInfo - { - OUString pwszLiteralValue; - sal_uInt32 cchMaxLen; - bool fSupported; - }; - - std::map<sal_uInt32,LiteralInfo> m_aLiteralInfo; - WpADOConnection& m_rADOConnection; - OConnection* m_pConnection; - - void fillLiterals(); - // get information out of rowset - sal_Int32 getMaxSize(sal_uInt32 _nId); - bool isCapable(sal_uInt32 _nId); - OUString getLiteral(sal_uInt32 _nProperty); - - // get info out of properties - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - OUString getStringProperty(const OUString& _aProperty); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getInt32Property(const OUString& _aProperty); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - bool getBoolProperty(const OUString& _aProperty); - - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - // cached database information - virtual OUString impl_getIdentifierQuoteString_throw( ) override; - virtual bool impl_isCatalogAtStart_throw( ) override; - virtual OUString impl_getCatalogSeparator_throw( ) override; - virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; - virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override; - virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; - virtual bool impl_supportsSchemasInDataManipulation_throw( ) override; - virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override; - virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; - virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; - virtual sal_Int32 impl_getMaxStatements_throw( ) override; - virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; - virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; - public: - - ODatabaseMetaData(OConnection* _pCon); - - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual OUString SAL_CALL getUserName( ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; - virtual OUString SAL_CALL getDatabaseProductName( ) override; - virtual OUString SAL_CALL getDatabaseProductVersion( ) override; - virtual OUString SAL_CALL getDriverName( ) override; - virtual OUString SAL_CALL getDriverVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; - virtual sal_Bool SAL_CALL usesLocalFiles( ) override; - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; - - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; - - virtual OUString SAL_CALL getSQLKeywords( ) override; - virtual OUString SAL_CALL getNumericFunctions( ) override; - virtual OUString SAL_CALL getStringFunctions( ) override; - virtual OUString SAL_CALL getSystemFunctions( ) override; - virtual OUString SAL_CALL getTimeDateFunctions( ) override; - virtual OUString SAL_CALL getSearchStringEscape( ) override; - virtual OUString SAL_CALL getExtraNameCharacters( ) override; - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; - virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupBy( ) override; - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; - virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; - virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; - virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; - virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; - virtual OUString SAL_CALL getSchemaTerm( ) override; - virtual OUString SAL_CALL getProcedureTerm( ) override; - virtual OUString SAL_CALL getCatalogTerm( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; - virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; - virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; - virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; - virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; - virtual sal_Bool SAL_CALL supportsUnion( ) override; - virtual sal_Bool SAL_CALL supportsUnionAll( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - virtual sal_Int32 SAL_CALL getMaxConnections( ) override; - virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; - virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; - virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; - virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; - virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; - virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; - virtual sal_Bool SAL_CALL supportsTransactions( ) override; - virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; - virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; - virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; - virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; - virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; - virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; - virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; - 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; + OUString pwszLiteralValue; + sal_uInt32 cchMaxLen; + bool fSupported; }; + + std::map<sal_uInt32,LiteralInfo> m_aLiteralInfo; + WpADOConnection& m_rADOConnection; + OConnection* m_pConnection; + + void fillLiterals(); + // get information out of rowset + sal_Int32 getMaxSize(sal_uInt32 _nId); + bool isCapable(sal_uInt32 _nId); + OUString getLiteral(sal_uInt32 _nProperty); + + // get info out of properties + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OUString getStringProperty(const OUString& _aProperty); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getInt32Property(const OUString& _aProperty); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + bool getBoolProperty(const OUString& _aProperty); + + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + // cached database information + virtual OUString impl_getIdentifierQuoteString_throw( ) override; + virtual bool impl_isCatalogAtStart_throw( ) override; + virtual OUString impl_getCatalogSeparator_throw( ) override; + virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; + virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override; + virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; + virtual bool impl_supportsSchemasInDataManipulation_throw( ) override; + virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override; + virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; + virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; + virtual sal_Int32 impl_getMaxStatements_throw( ) override; + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; + virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; + public: + + ODatabaseMetaData(OConnection* _pCon); + + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual OUString SAL_CALL getUserName( ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; + virtual OUString SAL_CALL getDatabaseProductName( ) override; + virtual OUString SAL_CALL getDatabaseProductVersion( ) override; + virtual OUString SAL_CALL getDriverName( ) override; + virtual OUString SAL_CALL getDriverVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; + virtual sal_Bool SAL_CALL usesLocalFiles( ) override; + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; + + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; + + virtual OUString SAL_CALL getSQLKeywords( ) override; + virtual OUString SAL_CALL getNumericFunctions( ) override; + virtual OUString SAL_CALL getStringFunctions( ) override; + virtual OUString SAL_CALL getSystemFunctions( ) override; + virtual OUString SAL_CALL getTimeDateFunctions( ) override; + virtual OUString SAL_CALL getSearchStringEscape( ) override; + virtual OUString SAL_CALL getExtraNameCharacters( ) override; + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; + virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupBy( ) override; + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; + virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; + virtual OUString SAL_CALL getSchemaTerm( ) override; + virtual OUString SAL_CALL getProcedureTerm( ) override; + virtual OUString SAL_CALL getCatalogTerm( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; + virtual sal_Bool SAL_CALL supportsUnion( ) override; + virtual sal_Bool SAL_CALL supportsUnionAll( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + virtual sal_Int32 SAL_CALL getMaxConnections( ) override; + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; + virtual sal_Bool SAL_CALL supportsTransactions( ) override; + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; + 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; + }; } diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx index fda0b6e72440..3c3e1dd30f34 100644 --- a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx @@ -35,191 +35,191 @@ namespace connectivity::ado { - /* - ** java_sql_ResultSet - */ - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XWarningsSupplier, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; - - class ODatabaseMetaDataResultSet : public cppu::BaseMutex, - public ODatabaseMetaDataResultSet_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> - { - std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time - - std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> > m_aValueRange; - std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> >::iterator m_aValueRangeIter; - - std::map<sal_Int32, std::map< OUString,sal_Int32> > m_aStrValueRange; - std::map<sal_Int32, std::map< OUString,sal_Int32> >::iterator m_aStrValueRangeIter; - - std::map<sal_Int32, std::map< sal_Int32,OUString> > m_aIntValueRange; - std::map<sal_Int32, std::map< sal_Int32,OUString> >::iterator m_aIntValueRangeIter; - - ADORecordset* m_pRecordSet; - css::uno::WeakReferenceHelper m_aStatement1; - css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; - OLEVariant m_aValue; - sal_Int32 m_nRowPos; - bool m_bWasNull; - bool m_bEOF; - bool m_bOnFirstAfterOpen; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static sal_Int32 getResultSetConcurrency(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static sal_Int32 getResultSetType(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static sal_Int32 getFetchDirection(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getFetchSize() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static OUString getCursorName(); - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setFetchDirection(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setFetchSize(sal_Int32 _par0); - - - inline sal_Int32 mapColumn (sal_Int32 column); - /// @throws css::sdbc::SQLException - void checkRecordSet(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - OLEVariant getValue(sal_Int32 columnIndex ); - - protected: - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XWarningsSupplier, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + class ODatabaseMetaDataResultSet : public cppu::BaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + { + std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time + + std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> > m_aValueRange; + std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> >::iterator m_aValueRangeIter; + + std::map<sal_Int32, std::map< OUString,sal_Int32> > m_aStrValueRange; + std::map<sal_Int32, std::map< OUString,sal_Int32> >::iterator m_aStrValueRangeIter; + + std::map<sal_Int32, std::map< sal_Int32,OUString> > m_aIntValueRange; + std::map<sal_Int32, std::map< sal_Int32,OUString> >::iterator m_aIntValueRangeIter; + + ADORecordset* m_pRecordSet; + css::uno::WeakReferenceHelper m_aStatement1; + css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; + OLEVariant m_aValue; + sal_Int32 m_nRowPos; + bool m_bWasNull; + bool m_bEOF; + bool m_bOnFirstAfterOpen; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getResultSetConcurrency(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getResultSetType(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getFetchDirection(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getFetchSize() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static OUString getCursorName(); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchDirection(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchSize(sal_Int32 _par0); + + + inline sal_Int32 mapColumn (sal_Int32 column); + /// @throws css::sdbc::SQLException + void checkRecordSet(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OLEVariant getValue(sal_Int32 columnIndex ); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const css::uno::Any& rValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const override; - public: - // a Constructor, that is needed for when Returning the Object is needed: - ODatabaseMetaDataResultSet( ADORecordset* _pRecordSet); - ~ODatabaseMetaDataResultSet() override; - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XResultSet - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - - const std::vector<sal_Int32>& getColumnMapping() { return m_aColMapping; } - - void setCatalogsMap(); - void setSchemasMap(); - void setColumnPrivilegesMap(); - void setColumnsMap(); - void setTablesMap(); - void setProcedureColumnsMap(); - void setProceduresMap(); - void setExportedKeysMap(); - void setImportedKeysMap(); - void setPrimaryKeysMap(); - void setIndexInfoMap(); - void setTablePrivilegesMap(); - void setCrossReferenceMap(); - void setTypeInfoMap(bool _bJetEngine); - }; - - inline sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column) + const css::uno::Any& rValue + ) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + public: + // a Constructor, that is needed for when Returning the Object is needed: + ODatabaseMetaDataResultSet( ADORecordset* _pRecordSet); + ~ODatabaseMetaDataResultSet() override; + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XResultSet + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + + const std::vector<sal_Int32>& getColumnMapping() { return m_aColMapping; } + + void setCatalogsMap(); + void setSchemasMap(); + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setProceduresMap(); + void setExportedKeysMap(); + void setImportedKeysMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(bool _bJetEngine); + }; + + inline sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column) + { + sal_Int32 map = column; + + if (!m_aColMapping.empty()) { - sal_Int32 map = column; - - if (!m_aColMapping.empty()) - { - // Validate column number - map = m_aColMapping[column]; - } - - return map; + // Validate column number + map = m_aColMapping[column]; } + return map; + } + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx index abac49ba1d9b..9d14454b6469 100644 --- a/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx @@ -29,74 +29,74 @@ namespace connectivity::ado { - //************ Class: ResultSetMetaData + //************ Class: ResultSetMetaData - typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; + typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; - class ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE - { - friend class ODatabaseMetaDataResultSet; + class ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE + { + friend class ODatabaseMetaDataResultSet; - const std::vector<sal_Int32> &m_vMapping; // when not every column is needed - std::map<sal_Int32,connectivity::OColumn> m_mColumns; - std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; + const std::vector<sal_Int32> &m_vMapping; // when not every column is needed + std::map<sal_Int32,connectivity::OColumn> m_mColumns; + std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; - ADORecordset* m_pRecordSet; - sal_Int32 m_nColCount; + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; - private: - ODatabaseMetaDataResultSetMetaData( const ODatabaseMetaDataResultSetMetaData& ); // never implemented - ODatabaseMetaDataResultSetMetaData& operator=( const ODatabaseMetaDataResultSetMetaData& ); // never implemented + private: + ODatabaseMetaDataResultSetMetaData( const ODatabaseMetaDataResultSetMetaData& ); // never implemented + ODatabaseMetaDataResultSetMetaData& operator=( const ODatabaseMetaDataResultSetMetaData& ); // never implemented - protected: - void setColumnPrivilegesMap(); - void setColumnsMap(); - void setTablesMap(); - void setProcedureColumnsMap(); - void setPrimaryKeysMap(); - void setIndexInfoMap(); - void setTablePrivilegesMap(); - void setCrossReferenceMap(); - void setTypeInfoMap(); - void setProceduresMap(); - public: - // a Constructor, that is needed for when Returning the Object is needed: - ODatabaseMetaDataResultSetMetaData( ADORecordset* _pRecordSet ,ODatabaseMetaDataResultSet* _pRes) - : m_vMapping(_pRes->getColumnMapping()), - m_pRecordSet(_pRecordSet), - m_nColCount(m_vMapping.size()-1) - { - if(m_pRecordSet) - m_pRecordSet->AddRef(); - } - ~ODatabaseMetaDataResultSetMetaData() override; + protected: + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setProceduresMap(); + public: + // a Constructor, that is needed for when Returning the Object is needed: + ODatabaseMetaDataResultSetMetaData( ADORecordset* _pRecordSet ,ODatabaseMetaDataResultSet* _pRes) + : m_vMapping(_pRes->getColumnMapping()), + m_pRecordSet(_pRecordSet), + m_nColCount(m_vMapping.size()-1) + { + if(m_pRecordSet) + m_pRecordSet->AddRef(); + } + ~ODatabaseMetaDataResultSetMetaData() override; - /// Avoid ambiguous cast error from the compiler. - operator css::uno::Reference< css::sdbc::XResultSetMetaData > () noexcept - { return this; } + /// Avoid ambiguous cast error from the compiler. + operator css::uno::Reference< css::sdbc::XResultSetMetaData > () noexcept + { return this; } - virtual sal_Int32 SAL_CALL getColumnCount( ) override; - virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; - virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; - virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; - virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; - }; + virtual sal_Int32 SAL_CALL getColumnCount( ) override; + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; + virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; + virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; + virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ADriver.hxx b/connectivity/source/inc/ado/ADriver.hxx index 1e13b97e2647..7aacd59c95cb 100644 --- a/connectivity/source/inc/ado/ADriver.hxx +++ b/connectivity/source/inc/ado/ADriver.hxx @@ -30,53 +30,53 @@ namespace com::sun::star::uno { class XComponentContext; } namespace connectivity::ado { - class OConnection; - - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, - css::sdbcx::XDataDefinitionSupplier, - css::lang::XServiceInfo - > ODriver_BASE; - class ODriver : public ODriver_BASE - { - ::osl::Mutex m_aMutex; - - std::vector<unotools::WeakReference<OConnection>> - m_xConnections; // vector containing a list - // of all the Connection objects - // for this Driver - css::uno::Reference< css::uno::XComponentContext > m_xContext; - - // to put back all the inits with COINIT_MULTITHREADED if needed - int mnNbCallCoInitializeExForReinit; - - public: - ODriver(const css::uno::Reference< css::uno::XComponentContext >& xContext); - ~ODriver() override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - css::uno::Reference< css::uno::XComponentContext > getContext() const { return m_xContext; } - - private: - void impl_checkURL_throw(const OUString& _sUrl); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Int32 SAL_CALL getMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getMinorVersion( ) override; - - // XDataDefinitionSupplier - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - }; + class OConnection; + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, + css::sdbcx::XDataDefinitionSupplier, + css::lang::XServiceInfo + > ODriver_BASE; + class ODriver : public ODriver_BASE + { + ::osl::Mutex m_aMutex; + + std::vector<unotools::WeakReference<OConnection>> + m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + css::uno::Reference< css::uno::XComponentContext > m_xContext; + + // to put back all the inits with COINIT_MULTITHREADED if needed + int mnNbCallCoInitializeExForReinit; + + public: + ODriver(const css::uno::Reference< css::uno::XComponentContext >& xContext); + ~ODriver() override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + css::uno::Reference< css::uno::XComponentContext > getContext() const { return m_xContext; } + + private: + void impl_checkURL_throw(const OUString& _sUrl); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Int32 SAL_CALL getMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getMinorVersion( ) override; + + // XDataDefinitionSupplier + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + }; } diff --git a/connectivity/source/inc/ado/AGroup.hxx b/connectivity/source/inc/ado/AGroup.hxx index 00207a5fa23a..a5cdef4b2025 100644 --- a/connectivity/source/inc/ado/AGroup.hxx +++ b/connectivity/source/inc/ado/AGroup.hxx @@ -24,35 +24,35 @@ namespace connectivity::ado { - typedef sdbcx::OGroup OGroup_ADO; - class OCatalog; - - class OAdoGroup : public OGroup_ADO - { - WpADOGroup m_aGroup; - OCatalog* m_pCatalog; - - static sal_Int32 MapRight(RightsEnum _eNum); - static RightsEnum Map2Right(sal_Int32 _eNum); - static ObjectTypeEnum MapObjectType(sal_Int32 ObjType); - protected: - virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue,sal_Int32 nHandle) const override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; - - public: - virtual void refreshUsers() override; - public: - OAdoGroup(OCatalog* _pParent,bool _bCase, ADOGroup* _pGroup=nullptr); - OAdoGroup(OCatalog* _pParent,bool _bCase, const OUString& Name); - - // XAuthorizable - virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - - WpADOGroup getImpl() const { return m_aGroup; } - }; + typedef sdbcx::OGroup OGroup_ADO; + class OCatalog; + + class OAdoGroup : public OGroup_ADO + { + WpADOGroup m_aGroup; + OCatalog* m_pCatalog; + + static sal_Int32 MapRight(RightsEnum _eNum); + static RightsEnum Map2Right(sal_Int32 _eNum); + static ObjectTypeEnum MapObjectType(sal_Int32 ObjType); + protected: + virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue,sal_Int32 nHandle) const override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + + public: + virtual void refreshUsers() override; + public: + OAdoGroup(OCatalog* _pParent,bool _bCase, ADOGroup* _pGroup=nullptr); + OAdoGroup(OCatalog* _pParent,bool _bCase, const OUString& Name); + + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + + WpADOGroup getImpl() const { return m_aGroup; } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AGroups.hxx b/connectivity/source/inc/ado/AGroups.hxx index c5bdba263947..e3d7e2555b8a 100644 --- a/connectivity/source/inc/ado/AGroups.hxx +++ b/connectivity/source/inc/ado/AGroups.hxx @@ -25,27 +25,27 @@ namespace connectivity::ado { - class OGroups : public sdbcx::OCollection - { - WpADOGroups m_aCollection; - OCatalog* m_pCatalog; - protected: + class OGroups : public sdbcx::OCollection + { + WpADOGroups m_aCollection; + OCatalog* m_pCatalog; + protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; - public: - OGroups(OCatalog* _pParent, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - const WpADOGroups& _rCollection,bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) - ,m_aCollection(_rCollection) - ,m_pCatalog(_pParent) - { - } - }; + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OGroups(OCatalog* _pParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOGroups& _rCollection,bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AIndex.hxx b/connectivity/source/inc/ado/AIndex.hxx index 98c3a77d1ceb..d6e7c65a0215 100644 --- a/connectivity/source/inc/ado/AIndex.hxx +++ b/connectivity/source/inc/ado/AIndex.hxx @@ -25,22 +25,22 @@ namespace connectivity::ado { - class OConnection; - class OAdoIndex : public sdbcx::OIndex - { - WpADOIndex m_aIndex; - OConnection* m_pConnection; - protected: - void fillPropertyValues(); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; - public: - virtual void refreshColumns() override; - public: - OAdoIndex(bool _bCase, OConnection* _pConnection,ADOIndex* _pIndex); - OAdoIndex(bool _bCase, OConnection* _pConnection); + class OConnection; + class OAdoIndex : public sdbcx::OIndex + { + WpADOIndex m_aIndex; + OConnection* m_pConnection; + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + public: + virtual void refreshColumns() override; + public: + OAdoIndex(bool _bCase, OConnection* _pConnection,ADOIndex* _pIndex); + OAdoIndex(bool _bCase, OConnection* _pConnection); - WpADOIndex getImpl() const { return m_aIndex;} - }; + WpADOIndex getImpl() const { return m_aIndex;} + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AIndexes.hxx b/connectivity/source/inc/ado/AIndexes.hxx index 85d2c30314f3..525c6052a8c1 100644 --- a/connectivity/source/inc/ado/AIndexes.hxx +++ b/connectivity/source/inc/ado/AIndexes.hxx @@ -24,30 +24,30 @@ namespace connectivity::ado { - class OConnection; - class OIndexes : public sdbcx::OCollection + class OConnection; + class OIndexes : public sdbcx::OCollection + { + WpADOIndexes m_aCollection; + OConnection* m_pConnection; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OIndexes(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOIndexes& _rCollection, + bool _bCase, + OConnection* _pConnection) + : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + , m_aCollection(_rCollection) + , m_pConnection(_pConnection) { - WpADOIndexes m_aCollection; - OConnection* m_pConnection; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; - public: - OIndexes(::cppu::OWeakObject& _rParent, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - const WpADOIndexes& _rCollection, - bool _bCase, - OConnection* _pConnection) - : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) - , m_aCollection(_rCollection) - , m_pConnection(_pConnection) - { - } - }; + } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AKey.hxx b/connectivity/source/inc/ado/AKey.hxx index 5ec3fa972b12..f4fe154c96d0 100644 --- a/connectivity/source/inc/ado/AKey.hxx +++ b/connectivity/source/inc/ado/AKey.hxx @@ -25,31 +25,31 @@ namespace connectivity::ado { - typedef sdbcx::OKey OKey_ADO; + typedef sdbcx::OKey OKey_ADO; - class OConnection; - class OAdoKey : public OKey_ADO - { - WpADOKey m_aKey; - OConnection* m_pConnection; - protected: - void fillPropertyValues(); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; - public: - virtual void refreshColumns() override; - public: - OAdoKey(bool _bCase,OConnection* _pConnection,ADOKey* _pKey); - OAdoKey(bool _bCase,OConnection* _pConnection); + class OConnection; + class OAdoKey : public OKey_ADO + { + WpADOKey m_aKey; + OConnection* m_pConnection; + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + public: + virtual void refreshColumns() override; + public: + OAdoKey(bool _bCase,OConnection* _pConnection,ADOKey* _pKey); + OAdoKey(bool _bCase,OConnection* _pConnection); - WpADOKey getImpl() const { return m_aKey;} - // map the update/delete rules - static RuleEnum Map2Rule(sal_Int32 _eNum); - static sal_Int32 MapRule(const RuleEnum& _eNum); + WpADOKey getImpl() const { return m_aKey;} + // map the update/delete rules + static RuleEnum Map2Rule(sal_Int32 _eNum); + static sal_Int32 MapRule(const RuleEnum& _eNum); - // map the keytypes - static sal_Int32 MapKeyRule(const KeyTypeEnum& _eNum); - static KeyTypeEnum Map2KeyRule(sal_Int32 _eNum); - }; + // map the keytypes + static sal_Int32 MapKeyRule(const KeyTypeEnum& _eNum); + static KeyTypeEnum Map2KeyRule(sal_Int32 _eNum); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AKeys.hxx b/connectivity/source/inc/ado/AKeys.hxx index 65af4dd0ee75..4514c3bc7c70 100644 --- a/connectivity/source/inc/ado/AKeys.hxx +++ b/connectivity/source/inc/ado/AKeys.hxx @@ -24,30 +24,30 @@ namespace connectivity::ado { - class OConnection; - class OKeys : public sdbcx::OCollection - { - WpADOKeys m_aCollection; - OConnection* m_pConnection; + class OConnection; + class OKeys : public sdbcx::OCollection + { + WpADOKeys m_aCollection; + OConnection* m_pConnection; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; - public: - OKeys(::cppu::OWeakObject& _rParent, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - const WpADOKeys& _rCollection, - bool _bCase, - OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) - ,m_aCollection(_rCollection) - ,m_pConnection(_pConnection) - { - } - }; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OKeys(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOKeys& _rCollection, + bool _bCase, + OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pConnection(_pConnection) + { + } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AResultSet.hxx b/connectivity/source/inc/ado/AResultSet.hxx index b9f024765b34..64f83f06ed93 100644 --- a/connectivity/source/inc/ado/AResultSet.hxx +++ b/connectivity/source/inc/ado/AResultSet.hxx @@ -38,195 +38,195 @@ namespace connectivity::ado { - /* - ** java_sql_ResultSet - */ - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XWarningsSupplier, - css::sdbc::XResultSetUpdate, - css::sdbc::XRowUpdate, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate, - css::sdbcx::XRowLocate, - css::sdbcx::XDeleteRows, - css::lang::XServiceInfo> OResultSet_BASE; - - class OResultSet : public cppu::BaseMutex, - public OResultSet_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<OResultSet> - { - - ADORecordset* m_pRecordSet; - OStatement_Base* m_pStmt; - css::uno::Reference< css::uno::XInterface> m_xStatement; - css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; - std::vector<OLEVariant> m_aBookmarks; - OLEVariant m_aValue; - long m_nRowPos; - bool m_bEOF; - bool m_bOnFirstAfterOpen; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getResultSetConcurrency() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getResultSetType() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static sal_Int32 getFetchDirection(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getFetchSize() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static OUString getCursorName(); - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setFetchDirection(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setFetchSize(sal_Int32 _par0); - void updateValue(sal_Int32 columnIndex,const OLEVariant& x); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - OLEVariant getValue(sal_Int32 columnIndex ); - - protected: - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XWarningsSupplier, + css::sdbc::XResultSetUpdate, + css::sdbc::XRowUpdate, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate, + css::sdbcx::XRowLocate, + css::sdbcx::XDeleteRows, + css::lang::XServiceInfo> OResultSet_BASE; + + class OResultSet : public cppu::BaseMutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + { + + ADORecordset* m_pRecordSet; + OStatement_Base* m_pStmt; + css::uno::Reference< css::uno::XInterface> m_xStatement; + css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; + std::vector<OLEVariant> m_aBookmarks; + OLEVariant m_aValue; + long m_nRowPos; + bool m_bEOF; + bool m_bOnFirstAfterOpen; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetConcurrency() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetType() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getFetchDirection(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getFetchSize() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static OUString getCursorName(); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchDirection(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchSize(sal_Int32 _par0); + void updateValue(sal_Int32 columnIndex,const OLEVariant& x); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OLEVariant getValue(sal_Int32 columnIndex ); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const css::uno::Any& rValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const override; - virtual ~OResultSet() override; - public: - // a Constructor, that is needed for when Returning the Object is needed: - OResultSet( ADORecordset* _pRecordSet,OStatement_Base* pStmt); - OResultSet( ADORecordset* _pRecordSet); - - // late constructor - void construct(); - void setMetaData(const css::uno::Reference< css::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} - - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XResultSet - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XResultSetUpdate - virtual void SAL_CALL insertRow( ) override; - virtual void SAL_CALL updateRow( ) override; - virtual void SAL_CALL deleteRow( ) override; - virtual void SAL_CALL cancelRowUpdates( ) override; - virtual void SAL_CALL moveToInsertRow( ) override; - virtual void SAL_CALL moveToCurrentRow( ) override; - // XRowUpdate - virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - // XRowLocate - virtual css::uno::Any SAL_CALL getBookmark( ) override; - virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; - virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; - virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; - // XDeleteRows - virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; - - }; + const css::uno::Any& rValue + ) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + virtual ~OResultSet() override; + public: + // a Constructor, that is needed for when Returning the Object is needed: + OResultSet( ADORecordset* _pRecordSet,OStatement_Base* pStmt); + OResultSet( ADORecordset* _pRecordSet); + + // late constructor + void construct(); + void setMetaData(const css::uno::Reference< css::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} + + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XResultSet + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) override; + virtual void SAL_CALL updateRow( ) override; + virtual void SAL_CALL deleteRow( ) override; + virtual void SAL_CALL cancelRowUpdates( ) override; + virtual void SAL_CALL moveToInsertRow( ) override; + virtual void SAL_CALL moveToCurrentRow( ) override; + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + // XRowLocate + virtual css::uno::Any SAL_CALL getBookmark( ) override; + virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; + virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; + virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; + // XDeleteRows + virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; + + }; } diff --git a/connectivity/source/inc/ado/AResultSetMetaData.hxx b/connectivity/source/inc/ado/AResultSetMetaData.hxx index 1eeb22656245..762593233f22 100644 --- a/connectivity/source/inc/ado/AResultSetMetaData.hxx +++ b/connectivity/source/inc/ado/AResultSetMetaData.hxx @@ -30,50 +30,50 @@ namespace connectivity::ado { - //************ Class: ResultSetMetaData + //************ Class: ResultSetMetaData - typedef ::cppu::WeakImplHelper<css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + typedef ::cppu::WeakImplHelper<css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; - class OResultSetMetaData : public OResultSetMetaData_BASE - { - friend class OResultSet; + class OResultSetMetaData : public OResultSetMetaData_BASE + { + friend class OResultSet; - ADORecordset* m_pRecordSet; - sal_Int32 m_nColCount; + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; - sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); - private: - OResultSetMetaData( const OResultSetMetaData& ); // never implemented - OResultSetMetaData& operator=( const OResultSetMetaData& ); // never implemented + sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + private: + OResultSetMetaData( const OResultSetMetaData& ); // never implemented + OResultSetMetaData& operator=( const OResultSetMetaData& ); // never implemented - protected: - virtual ~OResultSetMetaData() override; - public: - // a Constructor, that is needed for when Returning the Object is needed: - OResultSetMetaData( ADORecordset* _pRecordSet); + protected: + virtual ~OResultSetMetaData() override; + public: + // a Constructor, that is needed for when Returning the Object is needed: + OResultSetMetaData( ADORecordset* _pRecordSet); - virtual sal_Int32 SAL_CALL getColumnCount( ) override; - virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; - virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; - virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; - virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; - }; + virtual sal_Int32 SAL_CALL getColumnCount( ) override; + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; + virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; + virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; + virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AStatement.hxx b/connectivity/source/inc/ado/AStatement.hxx index b8e3e1a6ff9c..00e37b66d3b5 100644 --- a/connectivity/source/inc/ado/AStatement.hxx +++ b/connectivity/source/inc/ado/AStatement.hxx @@ -38,181 +38,181 @@ namespace connectivity::ado { - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement, - css::sdbc::XWarningsSupplier, - css::util::XCancellable, - css::sdbc::XCloseable, - css::sdbc::XMultipleResults> OStatement_BASE; - - - //************ Class: java.sql.Statement - - class OStatement_Base : public cppu::BaseMutex, - public OStatement_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> - - { - friend class OResultSet; - - css::sdbc::SQLWarning m_aLastWarning; - - protected: - std::vector< OUString> m_aBatchVector; - - unotools::WeakReference<OResultSet> m_xResultSet; // The last ResultSet created - // for this Statement - - OConnection* m_pConnection;// The owning Connection object - WpADOCommand m_Command; - WpADORecordset m_RecordSet; - OLEVariant m_RecordsAffected; - OLEVariant m_Parameters; - std::vector<connectivity::OTypeInfo> m_aTypeInfo; // Hashtable containing an entry - // for each row returned by - // DatabaseMetaData.getTypeInfo. - long m_nMaxRows; - sal_Int32 m_nFetchSize; - LockTypeEnum m_eLockType; - CursorTypeEnum m_eCursorType; - - using OStatement_BASE::rBHelper; - private: - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getQueryTimeOut() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static sal_Int32 getMaxFieldSize(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getMaxRows() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getResultSetConcurrency() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getResultSetType() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static sal_Int32 getFetchDirection(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getFetchSize() const; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - OUString getCursorName() const; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setQueryTimeOut(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setMaxFieldSize(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setMaxRows(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setResultSetConcurrency(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setResultSetType(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setFetchDirection(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setFetchSize(sal_Int32 _par0); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setCursorName(std::u16string_view _par0); - - protected: - - void assignRecordSet( ADORecordset* _pRS ); - - /// @throws css::sdbc::SQLException - void reset (); - /// @throws css::sdbc::SQLException - void clearMyResultSet (); - /// @throws css::sdbc::SQLException - void setWarning (const css::sdbc::SQLWarning &ex); - /// @throws css::sdbc::SQLException - sal_Int32 getRowCount (); - sal_Int32 getPrecision ( sal_Int32 sqlType); - - void disposeResultSet(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement, + css::sdbc::XWarningsSupplier, + css::util::XCancellable, + css::sdbc::XCloseable, + css::sdbc::XMultipleResults> OStatement_BASE; + + + //************ Class: java.sql.Statement + + class OStatement_Base : public cppu::BaseMutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> + + { + friend class OResultSet; + + css::sdbc::SQLWarning m_aLastWarning; + + protected: + std::vector< OUString> m_aBatchVector; + + unotools::WeakReference<OResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + + OConnection* m_pConnection;// The owning Connection object + WpADOCommand m_Command; + WpADORecordset m_RecordSet; + OLEVariant m_RecordsAffected; + OLEVariant m_Parameters; + std::vector<connectivity::OTypeInfo> m_aTypeInfo; // Hashtable containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + long m_nMaxRows; + sal_Int32 m_nFetchSize; + LockTypeEnum m_eLockType; + CursorTypeEnum m_eCursorType; + + using OStatement_BASE::rBHelper; + private: + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getQueryTimeOut() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getMaxFieldSize(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getMaxRows() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetConcurrency() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getResultSetType() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getFetchDirection(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getFetchSize() const; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OUString getCursorName() const; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setQueryTimeOut(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setMaxFieldSize(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setMaxRows(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setResultSetConcurrency(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setResultSetType(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchDirection(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setFetchSize(sal_Int32 _par0); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setCursorName(std::u16string_view _par0); + + protected: + + void assignRecordSet( ADORecordset* _pRS ); + + /// @throws css::sdbc::SQLException + void reset (); + /// @throws css::sdbc::SQLException + void clearMyResultSet (); + /// @throws css::sdbc::SQLException + void setWarning (const css::sdbc::SQLWarning &ex); + /// @throws css::sdbc::SQLException + sal_Int32 getRowCount (); + sal_Int32 getPrecision ( sal_Int32 sqlType); + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const css::uno::Any& rValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const override; - public: - OStatement_Base(OConnection* _pConnection ); - - using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; - // OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override; - virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override; - virtual sal_Bool SAL_CALL execute( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XMultipleResults - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; - virtual sal_Int32 SAL_CALL getUpdateCount( ) override; - virtual sal_Bool SAL_CALL getMoreResults( ) override; - }; - - class OStatement : public OStatement_Base, - public css::sdbc::XBatchExecution, - public css::lang::XServiceInfo - { - public: - // a Constructor, that is needed for when Returning the Object is needed: - OStatement( OConnection* _pConnection) : OStatement_Base( _pConnection){}; - ~OStatement() override; - - DECLARE_SERVICE_INFO(); - - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - // XBatchExecution - virtual void SAL_CALL addBatch( const OUString& sql ) override; - virtual void SAL_CALL clearBatch( ) override; - virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; - }; + const css::uno::Any& rValue + ) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + public: + OStatement_Base(OConnection* _pConnection ); + + using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; + // OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override; + virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override; + virtual sal_Bool SAL_CALL execute( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XMultipleResults + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; + virtual sal_Int32 SAL_CALL getUpdateCount( ) override; + virtual sal_Bool SAL_CALL getMoreResults( ) override; + }; + + class OStatement : public OStatement_Base, + public css::sdbc::XBatchExecution, + public css::lang::XServiceInfo + { + public: + // a Constructor, that is needed for when Returning the Object is needed: + OStatement( OConnection* _pConnection) : OStatement_Base( _pConnection){}; + ~OStatement() override; + + DECLARE_SERVICE_INFO(); + + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + // XBatchExecution + virtual void SAL_CALL addBatch( const OUString& sql ) override; + virtual void SAL_CALL clearBatch( ) override; + virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ATable.hxx b/connectivity/source/inc/ado/ATable.hxx index 827485a6b480..83f21d4f78fe 100644 --- a/connectivity/source/inc/ado/ATable.hxx +++ b/connectivity/source/inc/ado/ATable.hxx @@ -25,45 +25,45 @@ namespace connectivity::ado { - typedef connectivity::sdbcx::OTable OTable_TYPEDEF; - typedef connectivity::sdbcx::OTableDescriptor_BASE OTableDescriptor_BASE_TYPEDEF; + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + typedef connectivity::sdbcx::OTableDescriptor_BASE OTableDescriptor_BASE_TYPEDEF; - class OAdoTable : public OTable_TYPEDEF - { - WpADOTable m_aTable; - OCatalog* m_pCatalog; + class OAdoTable : public OTable_TYPEDEF + { + WpADOTable m_aTable; + OCatalog* m_pCatalog; - protected: - void fillPropertyValues(); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; - public: - virtual void refreshColumns() override; - virtual void refreshKeys() override; - virtual void refreshIndexes() override; + public: + virtual void refreshColumns() override; + virtual void refreshKeys() override; + virtual void refreshIndexes() override; - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; - public: - OAdoTable(sdbcx::OCollection* _pTables,bool _bCase,OCatalog* _pCatalog,_ADOTable* _pTable); - OAdoTable(sdbcx::OCollection* _pTables,bool _bCase,OCatalog* _pCatalog); + public: + OAdoTable(sdbcx::OCollection* _pTables,bool _bCase,OCatalog* _pCatalog,_ADOTable* _pTable); + OAdoTable(sdbcx::OCollection* _pTables,bool _bCase,OCatalog* _pCatalog); - virtual OUString SAL_CALL getName() override; - OUString getSchema() const { return m_SchemaName; } - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const override; + virtual OUString SAL_CALL getName() override; + OUString getSchema() const { return m_SchemaName; } + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const override; - // XRename - virtual void SAL_CALL rename( const OUString& newName ) override; + // XRename + virtual void SAL_CALL rename( const OUString& newName ) override; - // XAlterTable - virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + // XAlterTable + virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - WpADOTable getImpl() const { return m_aTable;} - OCatalog* getCatalog() const { return m_pCatalog; } - }; + WpADOTable getImpl() const { return m_aTable;} + OCatalog* getCatalog() const { return m_pCatalog; } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/ATables.hxx b/connectivity/source/inc/ado/ATables.hxx index 37c91f7c451f..2f37340133a3 100644 --- a/connectivity/source/inc/ado/ATables.hxx +++ b/connectivity/source/inc/ado/ATables.hxx @@ -24,29 +24,29 @@ namespace connectivity::ado { - class OCatalog; - class OTables : public sdbcx::OCollection + class OCatalog; + class OTables : public sdbcx::OCollection + { + WpADOTables m_aCollection; + OCatalog* m_pCatalog; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OTables(OCatalog* _pParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOTables& _rCollection, + bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) { - WpADOTables m_aCollection; - OCatalog* m_pCatalog; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; - public: - OTables(OCatalog* _pParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - const WpADOTables& _rCollection, - bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) - ,m_aCollection(_rCollection) - ,m_pCatalog(_pParent) - { - OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid"); - } - void appendNew(const OUString& _rsNewTable); - }; + OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid"); + } + void appendNew(const OUString& _rsNewTable); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AUser.hxx b/connectivity/source/inc/ado/AUser.hxx index 8d0c0f7321b6..c0c661904776 100644 --- a/connectivity/source/inc/ado/AUser.hxx +++ b/connectivity/source/inc/ado/AUser.hxx @@ -24,60 +24,60 @@ namespace connectivity::ado { - class OCatalog; - typedef connectivity::sdbcx::OUser OUser_TYPEDEF; - typedef connectivity::sdbcx::OUser_BASE OUser_BASE_TYPEDEF; + class OCatalog; + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + typedef connectivity::sdbcx::OUser_BASE OUser_BASE_TYPEDEF; - class OAdoUser : public OUser_TYPEDEF - { - protected: - WpADOUser m_aUser; - OCatalog* m_pCatalog; + class OAdoUser : public OUser_TYPEDEF + { + protected: + WpADOUser m_aUser; + OCatalog* m_pCatalog; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const override; - public: - virtual void refreshGroups() override; - public: - OAdoUser(OCatalog* _pParent,bool _bCase, ADOUser* _pUser=nullptr); - OAdoUser(OCatalog* _pParent,bool _bCase, const OUString& Name); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue + ) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + public: + virtual void refreshGroups() override; + public: + OAdoUser(OCatalog* _pParent,bool _bCase, ADOUser* _pUser=nullptr); + OAdoUser(OCatalog* _pParent,bool _bCase, const OUString& Name); - // XUser - virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; - // XAuthorizable - virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + // XUser + virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - WpADOUser getImpl() const { return m_aUser;} - }; + WpADOUser getImpl() const { return m_aUser;} + }; - class OUserExtend; - typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; - class OUserExtend : public OAdoUser, - public OUserExtend_PROP - { - protected: - OUString m_Password; - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OUserExtend(OCatalog* _pParent,bool _bCase,ADOUser* _pUser=nullptr); - OUserExtend(OCatalog* _pParent,bool _bCase,const OUString& Name); + class OUserExtend : public OAdoUser, + public OUserExtend_PROP + { + protected: + OUString m_Password; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OUserExtend(OCatalog* _pParent,bool _bCase,ADOUser* _pUser=nullptr); + OUserExtend(OCatalog* _pParent,bool _bCase,const OUString& Name); - virtual void construct() override; - OUString getPassword() const { return m_Password;} - }; + virtual void construct() override; + OUString getPassword() const { return m_Password;} + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AUsers.hxx b/connectivity/source/inc/ado/AUsers.hxx index 3f715f8b7209..b88776206321 100644 --- a/connectivity/source/inc/ado/AUsers.hxx +++ b/connectivity/source/inc/ado/AUsers.hxx @@ -26,28 +26,28 @@ namespace connectivity::ado { - class OUsers : public sdbcx::OCollection + class OUsers : public sdbcx::OCollection + { + WpADOUsers m_aCollection; + OCatalog* m_pCatalog; + public: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OUsers( OCatalog* _pParent, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + const WpADOUsers& _rCollection, + bool _bCase) + :sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) { - WpADOUsers m_aCollection; - OCatalog* m_pCatalog; - public: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; - public: - OUsers( OCatalog* _pParent, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - const WpADOUsers& _rCollection, - bool _bCase) - :sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) - ,m_aCollection(_rCollection) - ,m_pCatalog(_pParent) - { - } - }; + } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AView.hxx b/connectivity/source/inc/ado/AView.hxx index db81c4e70bb5..320140df4a68 100644 --- a/connectivity/source/inc/ado/AView.hxx +++ b/connectivity/source/inc/ado/AView.hxx @@ -25,23 +25,23 @@ namespace connectivity::ado { - typedef sdbcx::OView OView_ADO; - - class OAdoView : public OView_ADO - { - WpADOView m_aView; - - protected: - // OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const override; - public: - OAdoView(bool _bCase, ADOView* _pView=nullptr); - - WpADOView getImpl() const { return m_aView;} - }; + typedef sdbcx::OView OView_ADO; + + class OAdoView : public OView_ADO + { + WpADOView m_aView; + + protected: + // OPropertySetHelper + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + public: + OAdoView(bool _bCase, ADOView* _pView=nullptr); + + WpADOView getImpl() const { return m_aView;} + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/AViews.hxx b/connectivity/source/inc/ado/AViews.hxx index 8709bdc9fae8..5d3e322f4a89 100644 --- a/connectivity/source/inc/ado/AViews.hxx +++ b/connectivity/source/inc/ado/AViews.hxx @@ -27,25 +27,25 @@ namespace connectivity::ado { - class OViews : public sdbcx::OCollection + class OViews : public sdbcx::OCollection + { + WpADOViews m_aCollection; + OCatalog* m_pCatalog; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; + public: + OViews(OCatalog* _pParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + WpADOViews const & _rCollection,bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) { - WpADOViews m_aCollection; - OCatalog* m_pCatalog; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos,const OUString& _sElementName) override; - public: - OViews(OCatalog* _pParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - WpADOViews const & _rCollection,bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) - ,m_aCollection(_rCollection) - ,m_pCatalog(_pParent) - { - } - }; + } + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx index ba0653156a94..72929c37db73 100644 --- a/connectivity/source/inc/ado/Aolevariant.hxx +++ b/connectivity/source/inc/ado/Aolevariant.hxx @@ -33,91 +33,91 @@ namespace com::sun::star::util namespace connectivity::ado { - class OLEVariant : public ::tagVARIANT + class OLEVariant : public ::tagVARIANT + { + public: + OLEVariant(); + OLEVariant(const VARIANT& varSrc); + OLEVariant(const OLEVariant& varSrc) ; + OLEVariant(bool x) ; + OLEVariant(sal_Bool) = delete; + OLEVariant(sal_Int8 n) ; + OLEVariant(sal_Int16 n) ; + OLEVariant(sal_Int32 n) ; + OLEVariant(sal_Int64 x) ; + + OLEVariant(std::u16string_view us); + OLEVariant(const OUString& us) + : OLEVariant(std::u16string_view(us)) { - public: - OLEVariant(); - OLEVariant(const VARIANT& varSrc); - OLEVariant(const OLEVariant& varSrc) ; - OLEVariant(bool x) ; - OLEVariant(sal_Bool) = delete; - OLEVariant(sal_Int8 n) ; - OLEVariant(sal_Int16 n) ; - OLEVariant(sal_Int32 n) ; - OLEVariant(sal_Int64 x) ; - - OLEVariant(std::u16string_view us); - OLEVariant(const OUString& us) - : OLEVariant(std::u16string_view(us)) - { - } - ~OLEVariant() ; - OLEVariant(const css::util::Date& x ); - OLEVariant(const css::util::Time& x ); - OLEVariant(const css::util::DateTime& x ); - OLEVariant(float x); - OLEVariant(const double &x); - OLEVariant(IDispatch* pDispInterface); - OLEVariant(const css::uno::Sequence< sal_Int8 >& x); - OLEVariant& operator=(const OLEVariant& varSrc); - // Assign a const VARIANT& (::VariantCopy handles everything) - - OLEVariant& operator=(const tagVARIANT& varSrc); - // Assign a const VARIANT* (::VariantCopy handles everything) - - OLEVariant& operator=(const VARIANT* pSrc); - void setByte(sal_uInt8 n) ; - void setInt16(sal_Int16 n) ; - void setInt32(sal_Int32 n) ; - void setFloat(float f) ; - void setDouble(double d) ; - void setDate(DATE d) ; - void setChar(unsigned char a) ; - void setCurrency(double aCur) ; - void setBool(bool b) ; - void setString(std::u16string_view us); - void setNoArg() ; - - void setIDispatch(IDispatch* pDispInterface); - void setNull() ; - void setEmpty() ; - - void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr); - void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType); - bool isNull() const ; - bool isEmpty() const ; - - VARTYPE getType() const ; - void ChangeType(VARTYPE vartype, const OLEVariant* pSrc); - - OUString getString() const; - bool getBool() const; - IUnknown* getIUnknown() const; - IDispatch* getIDispatch() const; - sal_uInt8 getByte() const; - sal_Int16 getInt16() const; - sal_Int8 getInt8() const; - sal_Int32 getInt32() const; - sal_uInt32 getUInt32() const; - float getFloat() const; - double getDouble() const; - double getDateAsDouble() const; - CY getCurrency() const; - css::util::Date getDate() const; - css::util::Time getTime() const; - css::util::DateTime getDateTime() const; - css::uno::Sequence<sal_Int8> getByteSequence() const; - SAFEARRAY* getUI1SAFEARRAYPtr() const; - css::uno::Any makeAny() const; - - static VARIANT_BOOL VariantBool(bool bEinBoolean); - - private: - void CHS(); - - void set(double n); - - }; + } + ~OLEVariant() ; + OLEVariant(const css::util::Date& x ); + OLEVariant(const css::util::Time& x ); + OLEVariant(const css::util::DateTime& x ); + OLEVariant(float x); + OLEVariant(const double &x); + OLEVariant(IDispatch* pDispInterface); + OLEVariant(const css::uno::Sequence< sal_Int8 >& x); + OLEVariant& operator=(const OLEVariant& varSrc); + // Assign a const VARIANT& (::VariantCopy handles everything) + + OLEVariant& operator=(const tagVARIANT& varSrc); + // Assign a const VARIANT* (::VariantCopy handles everything) + + OLEVariant& operator=(const VARIANT* pSrc); + void setByte(sal_uInt8 n) ; + void setInt16(sal_Int16 n) ; + void setInt32(sal_Int32 n) ; + void setFloat(float f) ; + void setDouble(double d) ; + void setDate(DATE d) ; + void setChar(unsigned char a) ; + void setCurrency(double aCur) ; + void setBool(bool b) ; + void setString(std::u16string_view us); + void setNoArg() ; + + void setIDispatch(IDispatch* pDispInterface); + void setNull() ; + void setEmpty() ; + + void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr); + void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType); + bool isNull() const ; + bool isEmpty() const ; + + VARTYPE getType() const ; + void ChangeType(VARTYPE vartype, const OLEVariant* pSrc); + + OUString getString() const; + bool getBool() const; + IUnknown* getIUnknown() const; + IDispatch* getIDispatch() const; + sal_uInt8 getByte() const; + sal_Int16 getInt16() const; + sal_Int8 getInt8() const; + sal_Int32 getInt32() const; + sal_uInt32 getUInt32() const; + float getFloat() const; + double getDouble() const; + double getDateAsDouble() const; + CY getCurrency() const; + css::util::Date getDate() const; + css::util::Time getTime() const; + css::util::DateTime getDateTime() const; + css::uno::Sequence<sal_Int8> getByteSequence() const; + SAFEARRAY* getUI1SAFEARRAYPtr() const; + css::uno::Any makeAny() const; + + static VARIANT_BOOL VariantBool(bool bEinBoolean); + + private: + void CHS(); + + void set(double n); + + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/Aolewrap.hxx b/connectivity/source/inc/ado/Aolewrap.hxx index 9d402fcf21b1..6069d319c471 100644 --- a/connectivity/source/inc/ado/Aolewrap.hxx +++ b/connectivity/source/inc/ado/Aolewrap.hxx @@ -33,142 +33,142 @@ namespace rtl } namespace connectivity::ado { - // Template class WpOLEBase<class T> - // ================================== - // - // Objects of this class contain a pointer to an interface of the type T. + // Template class WpOLEBase<class T> + // ================================== + // + // Objects of this class contain a pointer to an interface of the type T. - template<class T> class WpOLEBase - { - protected: - sal::systools::COMReference<T> pInterface; + template<class T> class WpOLEBase + { + protected: + sal::systools::COMReference<T> pInterface; - public: - WpOLEBase(T* pInt = nullptr) : pInterface(pInt){} + public: + WpOLEBase(T* pInt = nullptr) : pInterface(pInt){} - WpOLEBase(const WpOLEBase<T>& aWrapper) - : pInterface( aWrapper.pInterface ) - { - } + WpOLEBase(const WpOLEBase<T>& aWrapper) + : pInterface( aWrapper.pInterface ) + { + } - //inline - WpOLEBase<T>& operator=(const WpOLEBase<T>& rhs) - { - pInterface = rhs.pInterface; - return *this; - }; - - operator T*() const { return pInterface.get(); } - T** operator&() { return &pInterface; } - bool IsValid() const { return pInterface.is(); } - void set(T* p) { pInterface = p; } - void clear() { pInterface.clear(); } + //inline + WpOLEBase<T>& operator=(const WpOLEBase<T>& rhs) + { + pInterface = rhs.pInterface; + return *this; }; - - // Template class WpOLECollection<class Ts, class WrapT> - // =============================================================== - // - // This class (derived from WpOLEBase<Ts>), abstracts away the properties - // common to DAO collections: - // - // They are accessed via an interface Ts (e.g. DAOFields) and can return - // Items of the type wrapped by WrapT (actually: with the interface, e.g. - // DAOField) via get_Item (here GetItem). - // - // This wrapper class exposes an object of the class WrapT. - - template<class Ts, class WrapT> class WpOLECollection : public WpOLEBase<Ts> + operator T*() const { return pInterface.get(); } + T** operator&() { return &pInterface; } + bool IsValid() const { return pInterface.is(); } + void set(T* p) { pInterface = p; } + void clear() { pInterface.clear(); } + }; + + + // Template class WpOLECollection<class Ts, class WrapT> + // =============================================================== + // + // This class (derived from WpOLEBase<Ts>), abstracts away the properties + // common to DAO collections: + // + // They are accessed via an interface Ts (e.g. DAOFields) and can return + // Items of the type wrapped by WrapT (actually: with the interface, e.g. + // DAOField) via get_Item (here GetItem). + // + // This wrapper class exposes an object of the class WrapT. + + template<class Ts, class WrapT> class WpOLECollection : public WpOLEBase<Ts> + { + public: + using WpOLEBase<Ts>::pInterface; + using WpOLEBase<Ts>::IsValid; + // Ctors, operator= + // They only call the superclass + WpOLECollection() = default; + WpOLECollection(const WpOLECollection& rhs) : WpOLEBase<Ts>(rhs) {} + WpOLECollection& operator=(const WpOLECollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; + + + void Refresh(){pInterface->Refresh();} + + sal_Int32 GetItemCount() const { - public: - using WpOLEBase<Ts>::pInterface; - using WpOLEBase<Ts>::IsValid; - // Ctors, operator= - // They only call the superclass - WpOLECollection() = default; - WpOLECollection(const WpOLECollection& rhs) : WpOLEBase<Ts>(rhs) {} - WpOLECollection& operator=(const WpOLECollection& rhs) - {WpOLEBase<Ts>::operator=(rhs); return *this;}; + sal_Int32 nCount = 0; + return pInterface ? (SUCCEEDED(pInterface->get_Count(&nCount)) ? nCount : sal_Int32(0)) : sal_Int32(0); + } + WrapT GetItem(sal_Int32 index) const + { + OSL_ENSURE(index >= 0 && index<GetItemCount(),"Wrong index for field!"); + WrapT aRet; + pInterface->get_Item(OLEVariant(index), &aRet); + return aRet; + } - void Refresh(){pInterface->Refresh();} - - sal_Int32 GetItemCount() const - { - sal_Int32 nCount = 0; - return pInterface ? (SUCCEEDED(pInterface->get_Count(&nCount)) ? nCount : sal_Int32(0)) : sal_Int32(0); - } - - WrapT GetItem(sal_Int32 index) const - { - OSL_ENSURE(index >= 0 && index<GetItemCount(),"Wrong index for field!"); - WrapT aRet; - pInterface->get_Item(OLEVariant(index), &aRet); - return aRet; - } - - WrapT GetItem(const OLEVariant& index) const - { - WrapT aRet; - pInterface->get_Item(index, &aRet); - return aRet; - } + WrapT GetItem(const OLEVariant& index) const + { + WrapT aRet; + pInterface->get_Item(index, &aRet); + return aRet; + } - WrapT GetItem(const OUString& sStr) const + WrapT GetItem(const OUString& sStr) const + { + WrapT aRet; + if (FAILED(pInterface->get_Item(OLEVariant(sStr), &aRet))) { - WrapT aRet; - if (FAILED(pInterface->get_Item(OLEVariant(sStr), &aRet))) - { #if OSL_DEBUG_LEVEL > 0 - OString sTemp("Unknown Item: " + OString(sStr.getStr(),sStr.getLength(),osl_getThreadTextEncoding())); - OSL_FAIL(sTemp.getStr()); + OString sTemp("Unknown Item: " + OString(sStr.getStr(),sStr.getLength(),osl_getThreadTextEncoding())); + OSL_FAIL(sTemp.getStr()); #endif - } - return aRet; } - void fillElementNames(::std::vector< OUString>& _rVector) + return aRet; + } + void fillElementNames(::std::vector< OUString>& _rVector) + { + if(IsValid()) { - if(IsValid()) + Refresh(); + sal_Int32 nCount = GetItemCount(); + _rVector.reserve(nCount); + for(sal_Int32 i=0;i< nCount;++i) { - Refresh(); - sal_Int32 nCount = GetItemCount(); - _rVector.reserve(nCount); - for(sal_Int32 i=0;i< nCount;++i) - { - WrapT aElement = GetItem(i); - if(aElement.IsValid()) - _rVector.push_back(aElement.get_Name()); - } + WrapT aElement = GetItem(i); + if(aElement.IsValid()) + _rVector.push_back(aElement.get_Name()); } } - }; + } + }; - template<class Ts, class WrapT> class WpOLEAppendCollection: - public WpOLECollection<Ts,WrapT> - { + template<class Ts, class WrapT> class WpOLEAppendCollection: + public WpOLECollection<Ts,WrapT> + { - public: - // Ctors, operator= - // They only call the superclass - using WpOLEBase<Ts>::pInterface; - WpOLEAppendCollection() = default; - WpOLEAppendCollection(const WpOLEAppendCollection& rhs) : WpOLECollection<Ts, WrapT>(rhs) {} - WpOLEAppendCollection& operator=(const WpOLEAppendCollection& rhs) - {WpOLEBase<Ts>::operator=(rhs); return *this;}; + public: + // Ctors, operator= + // They only call the superclass + using WpOLEBase<Ts>::pInterface; + WpOLEAppendCollection() = default; + WpOLEAppendCollection(const WpOLEAppendCollection& rhs) : WpOLECollection<Ts, WrapT>(rhs) {} + WpOLEAppendCollection& operator=(const WpOLEAppendCollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; - bool Append(const WrapT& aWrapT) - { - return SUCCEEDED(pInterface->Append(OLEVariant(aWrapT))); - }; + bool Append(const WrapT& aWrapT) + { + return SUCCEEDED(pInterface->Append(OLEVariant(aWrapT))); + }; - bool Delete(const OUString& sName) - { - return SUCCEEDED(pInterface->Delete(OLEVariant(sName))); - }; + bool Delete(const OUString& sName) + { + return SUCCEEDED(pInterface->Delete(OLEVariant(sName))); + }; - }; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx index bcdbe18b0dd9..a8b4b382a4fa 100644 --- a/connectivity/source/inc/ado/Awrapado.hxx +++ b/connectivity/source/inc/ado/Awrapado.hxx @@ -34,339 +34,339 @@ namespace connectivity::ado { - class WpADOConnection; - class WpADOCommand; - class WpADORecordset; - class WpADOField; - class WpADOParameter; - class WpADOError; - class WpADOProperty; - - typedef WpOLEAppendCollection< ADOFields, WpADOField> WpADOFields; - typedef WpOLECollection< ADOProperties, WpADOProperty> WpADOProperties; - - - class WpADOConnection : public WpOLEBase<ADOConnection> - { - public: - - WpADOConnection() = default; - - WpADOConnection(const WpADOConnection& rhs) : WpOLEBase<ADOConnection>(rhs) {} - - WpADOConnection& operator=(const WpADOConnection& rhs) - {WpOLEBase<ADOConnection>::operator=(rhs); return *this;} - - - WpADOProperties get_Properties() const; - - OUString GetConnectionString() const; - bool PutConnectionString(std::u16string_view aCon) const; - sal_Int32 GetCommandTimeout() const; - void PutCommandTimeout(sal_Int32 nRet); - sal_Int32 GetConnectionTimeout() const ; - void PutConnectionTimeout(sal_Int32 nRet); - - bool Close( ) ; - bool Execute(std::u16string_view CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset); - bool BeginTrans(); - bool CommitTrans( ) ; - bool RollbackTrans( ); - bool Open(std::u16string_view ConnectionString, std::u16string_view UserID,std::u16string_view Password,long Options); - bool GetErrors(ADOErrors** pErrors); - - OUString GetDefaultDatabase() const; - bool PutDefaultDatabase(std::u16string_view _bstr); - - IsolationLevelEnum get_IsolationLevel() const ; - bool put_IsolationLevel(const IsolationLevelEnum& eNum) ; - - sal_Int32 get_Attributes() const; - bool put_Attributes(sal_Int32 nRet); - - CursorLocationEnum get_CursorLocation() const; - bool put_CursorLocation(const CursorLocationEnum &eNum) ; - - ConnectModeEnum get_Mode() const; - bool put_Mode(const ConnectModeEnum &eNum) ; - - OUString get_Provider() const; - bool put_Provider(std::u16string_view _bstr); - - sal_Int32 get_State() const; - - bool OpenSchema(SchemaEnum eNum,OLEVariant const & Restrictions,OLEVariant const & SchemaID,ADORecordset**pprset); - - OUString get_Version() const; - - // special methods - ADORecordset* getExportedKeys( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table ); - ADORecordset* getImportedKeys( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table ); - ADORecordset* getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table ); - ADORecordset* getIndexInfo( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table, bool unique, bool approximate ); - ADORecordset* getTablePrivileges( const css::uno::Any& catalog, - const OUString& schemaPattern, - std::u16string_view tableNamePattern ); - ADORecordset* getCrossReference( const css::uno::Any& primaryCatalog, - const OUString& primarySchema, - std::u16string_view primaryTable, - const css::uno::Any& foreignCatalog, - const OUString& foreignSchema, - std::u16string_view foreignTable); - ADORecordset* getProcedures( const css::uno::Any& catalog, - const OUString& schemaPattern, - std::u16string_view procedureNamePattern ); - ADORecordset* getProcedureColumns( const css::uno::Any& catalog, - const OUString& schemaPattern, - std::u16string_view procedureNamePattern, - std::u16string_view columnNamePattern ); - ADORecordset* getTables( const css::uno::Any& catalog, - const OUString& schemaPattern, - std::u16string_view tableNamePattern, - const css::uno::Sequence< OUString >& types ); - ADORecordset* getColumns( const css::uno::Any& catalog, - const OUString& schemaPattern, - std::u16string_view tableNamePattern, - std::u16string_view columnNamePattern ); - ADORecordset* getColumnPrivileges( const css::uno::Any& catalog, - const OUString& schemaPattern, - std::u16string_view table, - std::u16string_view columnNamePattern ); - ADORecordset* getTypeInfo(DataTypeEnum _eType = adEmpty ); - }; - - - class WpADOCommand : public WpOLEBase<ADOCommand> - { - public: - WpADOCommand() = default; - // Ctors, operator= - // They only call the superclass - WpADOCommand(const WpADOCommand& rhs) : WpOLEBase<ADOCommand>(rhs) {} - - WpADOCommand& operator=(const WpADOCommand& rhs) - { - WpOLEBase<ADOCommand>::operator=(rhs); return *this;} - - - bool putref_ActiveConnection(const WpADOConnection& rCon); - - void put_ActiveConnection(/* [in] */ const OLEVariant& vConn); - void Create(); - sal_Int32 get_State() const; - OUString get_CommandText() const; - bool put_CommandText(std::u16string_view aCon) ; - sal_Int32 get_CommandTimeout() const; - void put_CommandTimeout(sal_Int32 nRet); - bool get_Prepared() const; - bool put_Prepared(VARIANT_BOOL bPrepared) const; - bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset); - ADOParameter* CreateParameter(std::u16string_view _bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value); - - ADOParameters* get_Parameters() const; - bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType); - CommandTypeEnum get_CommandType( ) const ; - // Returns the field's name - OUString GetName() const ; - bool put_Name(std::u16string_view Name); - bool Cancel(); - }; - - class WpADOError : public WpOLEBase<ADOError> - { - public: - - // Ctors, operator= - // They only call the superclass - WpADOError() = default; - - WpADOError(const WpADOError& rhs) : WpOLEBase<ADOError>(rhs) {} - - WpADOError& operator=(const WpADOError& rhs) - {WpOLEBase<ADOError>::operator=(rhs); return *this;} - - - OUString GetDescription() const; - OUString GetSource() const ; - sal_Int32 GetNumber() const ; - OUString GetSQLState() const ; - sal_Int32 GetNativeError() const ; - }; - - - class WpADOField : public WpOLEBase<ADOField> - { - // friend class WpADOFields; - public: - - // Ctors, operator= - // They only call the superclass - WpADOField() = default; - WpADOField(const WpADOField& rhs) : WpOLEBase<ADOField>(rhs) {} - - WpADOField& operator=(const WpADOField& rhs) - {WpOLEBase<ADOField>::operator=(rhs); return *this;} - - - WpADOProperties get_Properties(); - sal_Int32 GetActualSize() const ; - sal_Int32 GetAttributes() const ; - sal_Int32 GetStatus() const ; - sal_Int32 GetDefinedSize() const ; - // Returns the field's name - OUString GetName() const ; - DataTypeEnum GetADOType() const ; - void get_Value(OLEVariant& aValVar) const ; - OLEVariant get_Value() const; - bool PutValue(const OLEVariant& aVariant); - sal_Int32 GetPrecision() const ; - sal_Int32 GetNumericScale() const ; - bool AppendChunk(const OLEVariant& Variant); - OLEVariant GetChunk(long Length) const; - void GetChunk(long Length,OLEVariant &aValVar) const; - OLEVariant GetOriginalValue() const; - void GetOriginalValue(OLEVariant &aValVar) const; - OLEVariant GetUnderlyingValue() const; - - void GetUnderlyingValue(OLEVariant &aValVar) const; - - bool PutPrecision(sal_Int8 _prec); - - bool PutNumericScale(sal_Int8 _prec); - - void PutADOType(DataTypeEnum eType) ; - - bool PutDefinedSize(sal_Int32 _nDefSize); - - bool PutAttributes(sal_Int32 _nDefSize); - }; - - - class WpADOProperty: public WpOLEBase<ADOProperty> - { - public: - // Ctors, operator= - // They only call the superclass - WpADOProperty() = default; - WpADOProperty(const WpADOProperty& rhs) : WpOLEBase<ADOProperty>(rhs) {} - WpADOProperty& operator=(const WpADOProperty& rhs) - {WpOLEBase<ADOProperty>::operator=(rhs); return *this;} - - - OLEVariant GetValue() const; - void GetValue(OLEVariant &aValVar) const; - bool PutValue(const OLEVariant &aValVar) ; - OUString GetName() const ; - DataTypeEnum GetADOType() const ; - sal_Int32 GetAttributes() const ; - bool PutAttributes(sal_Int32 _nDefSize); - }; - - - class WpADORecordset : public WpOLEBase<ADORecordset> - { - - public: - // Ctors, operator= - // They only call the superclass - WpADORecordset() = default; - WpADORecordset(const WpADORecordset& rhs) : WpOLEBase<ADORecordset>() {operator=(rhs);} - WpADORecordset& operator=(const WpADORecordset& rhs) - { - WpOLEBase<ADORecordset>::operator=(rhs); - return *this; - } - - void Create(); - bool Open( - /* [optional][in] */ VARIANT Source, - /* [optional][in] */ VARIANT ActiveConnection, - /* [defaultvalue][in] */ CursorTypeEnum CursorType, - /* [defaultvalue][in] */ LockTypeEnum LockType, - /* [defaultvalue][in] */ sal_Int32 Options); - LockTypeEnum GetLockType(); - void Close(); - bool Cancel() const; - sal_Int32 get_State( ); - bool Supports( /* [in] */ CursorOptionEnum CursorOptions); - PositionEnum get_AbsolutePosition(); - void GetDataSource(IUnknown** pIUnknown) const ; - void PutRefDataSource(IUnknown* pIUnknown); - void GetBookmark(VARIANT& var); - OLEVariant GetBookmark(); - CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right); - bool SetBookmark(const OLEVariant &pSafeAr); - WpADOFields GetFields() const; - bool Move(sal_Int32 nRows, VARIANT aBmk); - bool MoveNext(); - bool MovePrevious(); - bool MoveFirst(); - bool MoveLast(); - - bool IsAtBOF() const; - bool IsAtEOF() const; - bool Delete(AffectEnum eNum); - bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values); - bool Update(const OLEVariant &FieldList,const OLEVariant &Values); - bool CancelUpdate(); - WpADOProperties get_Properties() const; - bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset); - bool get_RecordCount(long& _nRet) const; - bool get_MaxRecords(long& _nRet) const; - bool put_MaxRecords(ADO_LONGPTR _nRet); - bool get_CursorType(CursorTypeEnum &_nRet) const; - bool put_CursorType(CursorTypeEnum _nRet); - bool get_LockType(LockTypeEnum &_nRet) const; - bool put_LockType(LockTypeEnum _nRet); - bool get_CacheSize(sal_Int32 &_nRet) const; - bool put_CacheSize(sal_Int32 _nRet); - bool UpdateBatch(AffectEnum AffectRecords); - }; - - - class WpADOParameter:public WpOLEBase<ADOParameter> + class WpADOConnection; + class WpADOCommand; + class WpADORecordset; + class WpADOField; + class WpADOParameter; + class WpADOError; + class WpADOProperty; + + typedef WpOLEAppendCollection< ADOFields, WpADOField> WpADOFields; + typedef WpOLECollection< ADOProperties, WpADOProperty> WpADOProperties; + + + class WpADOConnection : public WpOLEBase<ADOConnection> + { + public: + + WpADOConnection() = default; + + WpADOConnection(const WpADOConnection& rhs) : WpOLEBase<ADOConnection>(rhs) {} + + WpADOConnection& operator=(const WpADOConnection& rhs) + {WpOLEBase<ADOConnection>::operator=(rhs); return *this;} + + + WpADOProperties get_Properties() const; + + OUString GetConnectionString() const; + bool PutConnectionString(std::u16string_view aCon) const; + sal_Int32 GetCommandTimeout() const; + void PutCommandTimeout(sal_Int32 nRet); + sal_Int32 GetConnectionTimeout() const ; + void PutConnectionTimeout(sal_Int32 nRet); + + bool Close( ) ; + bool Execute(std::u16string_view CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset); + bool BeginTrans(); + bool CommitTrans( ) ; + bool RollbackTrans( ); + bool Open(std::u16string_view ConnectionString, std::u16string_view UserID,std::u16string_view Password,long Options); + bool GetErrors(ADOErrors** pErrors); + + OUString GetDefaultDatabase() const; + bool PutDefaultDatabase(std::u16string_view _bstr); + + IsolationLevelEnum get_IsolationLevel() const ; + bool put_IsolationLevel(const IsolationLevelEnum& eNum) ; + + sal_Int32 get_Attributes() const; + bool put_Attributes(sal_Int32 nRet); + + CursorLocationEnum get_CursorLocation() const; + bool put_CursorLocation(const CursorLocationEnum &eNum) ; + + ConnectModeEnum get_Mode() const; + bool put_Mode(const ConnectModeEnum &eNum) ; + + OUString get_Provider() const; + bool put_Provider(std::u16string_view _bstr); + + sal_Int32 get_State() const; + + bool OpenSchema(SchemaEnum eNum,OLEVariant const & Restrictions,OLEVariant const & SchemaID,ADORecordset**pprset); + + OUString get_Version() const; + + // special methods + ADORecordset* getExportedKeys( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table ); + ADORecordset* getImportedKeys( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table ); + ADORecordset* getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table ); + ADORecordset* getIndexInfo( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table, bool unique, bool approximate ); + ADORecordset* getTablePrivileges( const css::uno::Any& catalog, + const OUString& schemaPattern, + std::u16string_view tableNamePattern ); + ADORecordset* getCrossReference( const css::uno::Any& primaryCatalog, + const OUString& primarySchema, + std::u16string_view primaryTable, + const css::uno::Any& foreignCatalog, + const OUString& foreignSchema, + std::u16string_view foreignTable); + ADORecordset* getProcedures( const css::uno::Any& catalog, + const OUString& schemaPattern, + std::u16string_view procedureNamePattern ); + ADORecordset* getProcedureColumns( const css::uno::Any& catalog, + const OUString& schemaPattern, + std::u16string_view procedureNamePattern, + std::u16string_view columnNamePattern ); + ADORecordset* getTables( const css::uno::Any& catalog, + const OUString& schemaPattern, + std::u16string_view tableNamePattern, + const css::uno::Sequence< OUString >& types ); + ADORecordset* getColumns( const css::uno::Any& catalog, + const OUString& schemaPattern, + std::u16string_view tableNamePattern, + std::u16string_view columnNamePattern ); + ADORecordset* getColumnPrivileges( const css::uno::Any& catalog, + const OUString& schemaPattern, + std::u16string_view table, + std::u16string_view columnNamePattern ); + ADORecordset* getTypeInfo(DataTypeEnum _eType = adEmpty ); + }; + + + class WpADOCommand : public WpOLEBase<ADOCommand> + { + public: + WpADOCommand() = default; + // Ctors, operator= + // They only call the superclass + WpADOCommand(const WpADOCommand& rhs) : WpOLEBase<ADOCommand>(rhs) {} + + WpADOCommand& operator=(const WpADOCommand& rhs) { - public: - // Ctors, operator= - // They only call the superclass - WpADOParameter() = default; - WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){} - WpADOParameter& operator=(const WpADOParameter& rhs) - {WpOLEBase<ADOParameter>::operator=(rhs); return *this;} - - - OUString GetName() const ; - DataTypeEnum GetADOType() const ; - void put_Type(const DataTypeEnum& _eType); - bool put_Size(sal_Int32 _nSize); - sal_Int32 GetAttributes() const ; - sal_Int32 GetPrecision() const ; - sal_Int32 GetNumericScale() const ; - ParameterDirectionEnum get_Direction() const; - void GetValue(OLEVariant& aValVar) const ; - OLEVariant GetValue() const; - bool PutValue(const OLEVariant& aVariant); - bool AppendChunk(const OLEVariant& aVariant); - }; - - class OTools + WpOLEBase<ADOCommand>::operator=(rhs); return *this;} + + + bool putref_ActiveConnection(const WpADOConnection& rCon); + + void put_ActiveConnection(/* [in] */ const OLEVariant& vConn); + void Create(); + sal_Int32 get_State() const; + OUString get_CommandText() const; + bool put_CommandText(std::u16string_view aCon) ; + sal_Int32 get_CommandTimeout() const; + void put_CommandTimeout(sal_Int32 nRet); + bool get_Prepared() const; + bool put_Prepared(VARIANT_BOOL bPrepared) const; + bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset); + ADOParameter* CreateParameter(std::u16string_view _bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value); + + ADOParameters* get_Parameters() const; + bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType); + CommandTypeEnum get_CommandType( ) const ; + // Returns the field's name + OUString GetName() const ; + bool put_Name(std::u16string_view Name); + bool Cancel(); + }; + + class WpADOError : public WpOLEBase<ADOError> + { + public: + + // Ctors, operator= + // They only call the superclass + WpADOError() = default; + + WpADOError(const WpADOError& rhs) : WpOLEBase<ADOError>(rhs) {} + + WpADOError& operator=(const WpADOError& rhs) + {WpOLEBase<ADOError>::operator=(rhs); return *this;} + + + OUString GetDescription() const; + OUString GetSource() const ; + sal_Int32 GetNumber() const ; + OUString GetSQLState() const ; + sal_Int32 GetNativeError() const ; + }; + + + class WpADOField : public WpOLEBase<ADOField> + { + // friend class WpADOFields; + public: + + // Ctors, operator= + // They only call the superclass + WpADOField() = default; + WpADOField(const WpADOField& rhs) : WpOLEBase<ADOField>(rhs) {} + + WpADOField& operator=(const WpADOField& rhs) + {WpOLEBase<ADOField>::operator=(rhs); return *this;} + + + WpADOProperties get_Properties(); + sal_Int32 GetActualSize() const ; + sal_Int32 GetAttributes() const ; + sal_Int32 GetStatus() const ; + sal_Int32 GetDefinedSize() const ; + // Returns the field's name + OUString GetName() const ; + DataTypeEnum GetADOType() const ; + void get_Value(OLEVariant& aValVar) const ; + OLEVariant get_Value() const; + bool PutValue(const OLEVariant& aVariant); + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + bool AppendChunk(const OLEVariant& Variant); + OLEVariant GetChunk(long Length) const; + void GetChunk(long Length,OLEVariant &aValVar) const; + OLEVariant GetOriginalValue() const; + void GetOriginalValue(OLEVariant &aValVar) const; + OLEVariant GetUnderlyingValue() const; + + void GetUnderlyingValue(OLEVariant &aValVar) const; + + bool PutPrecision(sal_Int8 _prec); + + bool PutNumericScale(sal_Int8 _prec); + + void PutADOType(DataTypeEnum eType) ; + + bool PutDefinedSize(sal_Int32 _nDefSize); + + bool PutAttributes(sal_Int32 _nDefSize); + }; + + + class WpADOProperty: public WpOLEBase<ADOProperty> + { + public: + // Ctors, operator= + // They only call the superclass + WpADOProperty() = default; + WpADOProperty(const WpADOProperty& rhs) : WpOLEBase<ADOProperty>(rhs) {} + WpADOProperty& operator=(const WpADOProperty& rhs) + {WpOLEBase<ADOProperty>::operator=(rhs); return *this;} + + + OLEVariant GetValue() const; + void GetValue(OLEVariant &aValVar) const; + bool PutValue(const OLEVariant &aValVar) ; + OUString GetName() const ; + DataTypeEnum GetADOType() const ; + sal_Int32 GetAttributes() const ; + bool PutAttributes(sal_Int32 _nDefSize); + }; + + + class WpADORecordset : public WpOLEBase<ADORecordset> + { + + public: + // Ctors, operator= + // They only call the superclass + WpADORecordset() = default; + WpADORecordset(const WpADORecordset& rhs) : WpOLEBase<ADORecordset>() {operator=(rhs);} + WpADORecordset& operator=(const WpADORecordset& rhs) { - public: - /** putValue set the property value at the ado column - @param _rProps the properties where to set - @param _aPosition which property to set - @param _aValVar the value to set - */ - static void putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar); - - /** getValue returns a specific property value - @param _rProps the properties where to set - @param _aPosition the property - - @return the property value - */ - static OLEVariant getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition); - }; + WpOLEBase<ADORecordset>::operator=(rhs); + return *this; + } + + void Create(); + bool Open( + /* [optional][in] */ VARIANT Source, + /* [optional][in] */ VARIANT ActiveConnection, + /* [defaultvalue][in] */ CursorTypeEnum CursorType, + /* [defaultvalue][in] */ LockTypeEnum LockType, + /* [defaultvalue][in] */ sal_Int32 Options); + LockTypeEnum GetLockType(); + void Close(); + bool Cancel() const; + sal_Int32 get_State( ); + bool Supports( /* [in] */ CursorOptionEnum CursorOptions); + PositionEnum get_AbsolutePosition(); + void GetDataSource(IUnknown** pIUnknown) const ; + void PutRefDataSource(IUnknown* pIUnknown); + void GetBookmark(VARIANT& var); + OLEVariant GetBookmark(); + CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right); + bool SetBookmark(const OLEVariant &pSafeAr); + WpADOFields GetFields() const; + bool Move(sal_Int32 nRows, VARIANT aBmk); + bool MoveNext(); + bool MovePrevious(); + bool MoveFirst(); + bool MoveLast(); + + bool IsAtBOF() const; + bool IsAtEOF() const; + bool Delete(AffectEnum eNum); + bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values); + bool Update(const OLEVariant &FieldList,const OLEVariant &Values); + bool CancelUpdate(); + WpADOProperties get_Properties() const; + bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset); + bool get_RecordCount(long& _nRet) const; + bool get_MaxRecords(long& _nRet) const; + bool put_MaxRecords(ADO_LONGPTR _nRet); + bool get_CursorType(CursorTypeEnum &_nRet) const; + bool put_CursorType(CursorTypeEnum _nRet); + bool get_LockType(LockTypeEnum &_nRet) const; + bool put_LockType(LockTypeEnum _nRet); + bool get_CacheSize(sal_Int32 &_nRet) const; + bool put_CacheSize(sal_Int32 _nRet); + bool UpdateBatch(AffectEnum AffectRecords); + }; + + + class WpADOParameter:public WpOLEBase<ADOParameter> + { + public: + // Ctors, operator= + // They only call the superclass + WpADOParameter() = default; + WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){} + WpADOParameter& operator=(const WpADOParameter& rhs) + {WpOLEBase<ADOParameter>::operator=(rhs); return *this;} + + + OUString GetName() const ; + DataTypeEnum GetADOType() const ; + void put_Type(const DataTypeEnum& _eType); + bool put_Size(sal_Int32 _nSize); + sal_Int32 GetAttributes() const ; + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + ParameterDirectionEnum get_Direction() const; + void GetValue(OLEVariant& aValVar) const ; + OLEVariant GetValue() const; + bool PutValue(const OLEVariant& aVariant); + bool AppendChunk(const OLEVariant& aVariant); + }; + + class OTools + { + public: + /** putValue set the property value at the ado column + @param _rProps the properties where to set + @param _aPosition which property to set + @param _aValVar the value to set + */ + static void putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar); + + /** getValue returns a specific property value + @param _rProps the properties where to set + @param _aPosition the property + + @return the property value + */ + static OLEVariant getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapCatalog.hxx b/connectivity/source/inc/ado/WrapCatalog.hxx index 0bcff441c23a..edfd846bbedc 100644 --- a/connectivity/source/inc/ado/WrapCatalog.hxx +++ b/connectivity/source/inc/ado/WrapCatalog.hxx @@ -26,25 +26,25 @@ namespace connectivity::ado { - class WpADOCatalog : public WpOLEBase<_ADOCatalog> - { - public: - WpADOCatalog(_ADOCatalog* pInt = nullptr) : WpOLEBase<_ADOCatalog>(pInt){} - WpADOCatalog(const WpADOCatalog& rhs) : WpOLEBase<_ADOCatalog>(rhs) {} - - WpADOCatalog& operator=(const WpADOCatalog& rhs) - {WpOLEBase<_ADOCatalog>::operator=(rhs); return *this;} - - OUString GetObjectOwner(std::u16string_view _rName, ObjectTypeEnum _eNum); - - void putref_ActiveConnection(IDispatch* pCon); - WpADOTables get_Tables(); - WpADOViews get_Views(); - WpADOGroups get_Groups(); - WpADOUsers get_Users(); - ADOProcedures* get_Procedures(); - void Create(); - }; + class WpADOCatalog : public WpOLEBase<_ADOCatalog> + { + public: + WpADOCatalog(_ADOCatalog* pInt = nullptr) : WpOLEBase<_ADOCatalog>(pInt){} + WpADOCatalog(const WpADOCatalog& rhs) : WpOLEBase<_ADOCatalog>(rhs) {} + + WpADOCatalog& operator=(const WpADOCatalog& rhs) + {WpOLEBase<_ADOCatalog>::operator=(rhs); return *this;} + + OUString GetObjectOwner(std::u16string_view _rName, ObjectTypeEnum _eNum); + + void putref_ActiveConnection(IDispatch* pCon); + WpADOTables get_Tables(); + WpADOViews get_Views(); + WpADOGroups get_Groups(); + WpADOUsers get_Users(); + ADOProcedures* get_Procedures(); + void Create(); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapColumn.hxx b/connectivity/source/inc/ado/WrapColumn.hxx index f1b73585fba9..e5c277a92555 100644 --- a/connectivity/source/inc/ado/WrapColumn.hxx +++ b/connectivity/source/inc/ado/WrapColumn.hxx @@ -28,35 +28,35 @@ namespace connectivity::ado { - class WpADOColumn : public WpOLEBase<_ADOColumn> - { - public: - WpADOColumn() = default; - WpADOColumn(const WpADOColumn& rhs) : WpOLEBase<_ADOColumn>(rhs) {} - - void Create(); - - WpADOColumn& operator=(const WpADOColumn& rhs) - {WpOLEBase<_ADOColumn>::operator=(rhs); return *this;} - - OUString get_Name() const; - OUString get_RelatedColumn() const; - void put_Name(std::u16string_view _rName); - void put_RelatedColumn(std::u16string_view _rName); - DataTypeEnum get_Type() const; - void put_Type(const DataTypeEnum& _eNum) ; - sal_Int32 get_Precision() const; - void put_Precision(sal_Int32 _nPre) ; - sal_uInt8 get_NumericScale() const; - void put_NumericScale(sal_Int8 _nScale); - SortOrderEnum get_SortOrder() const; - void put_SortOrder(SortOrderEnum _nScale); - sal_Int32 get_DefinedSize() const; - ColumnAttributesEnum get_Attributes() const; - bool put_Attributes(const ColumnAttributesEnum& _eNum); - WpADOProperties get_Properties() const; - void put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); - }; + class WpADOColumn : public WpOLEBase<_ADOColumn> + { + public: + WpADOColumn() = default; + WpADOColumn(const WpADOColumn& rhs) : WpOLEBase<_ADOColumn>(rhs) {} + + void Create(); + + WpADOColumn& operator=(const WpADOColumn& rhs) + {WpOLEBase<_ADOColumn>::operator=(rhs); return *this;} + + OUString get_Name() const; + OUString get_RelatedColumn() const; + void put_Name(std::u16string_view _rName); + void put_RelatedColumn(std::u16string_view _rName); + DataTypeEnum get_Type() const; + void put_Type(const DataTypeEnum& _eNum) ; + sal_Int32 get_Precision() const; + void put_Precision(sal_Int32 _nPre) ; + sal_uInt8 get_NumericScale() const; + void put_NumericScale(sal_Int8 _nScale); + SortOrderEnum get_SortOrder() const; + void put_SortOrder(SortOrderEnum _nScale); + sal_Int32 get_DefinedSize() const; + ColumnAttributesEnum get_Attributes() const; + bool put_Attributes(const ColumnAttributesEnum& _eNum); + WpADOProperties get_Properties() const; + void put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapIndex.hxx b/connectivity/source/inc/ado/WrapIndex.hxx index 4444bb340ae5..1644007424ce 100644 --- a/connectivity/source/inc/ado/WrapIndex.hxx +++ b/connectivity/source/inc/ado/WrapIndex.hxx @@ -26,27 +26,27 @@ namespace connectivity::ado { - class WpADOIndex : public WpOLEBase<_ADOIndex> - { - public: - WpADOIndex() = default; - WpADOIndex(const WpADOIndex& rhs) : WpOLEBase<_ADOIndex>(rhs) {} - - WpADOIndex& operator=(const WpADOIndex& rhs) - {WpOLEBase<_ADOIndex>::operator=(rhs); return *this;} - - void Create(); - - OUString get_Name() const; - void put_Name(std::u16string_view _rName); - bool get_Clustered() const; - void put_Clustered(bool _b); - bool get_Unique() const; - void put_Unique(bool _b); - bool get_PrimaryKey() const; - void put_PrimaryKey(bool _b); - WpADOColumns get_Columns() const; - }; + class WpADOIndex : public WpOLEBase<_ADOIndex> + { + public: + WpADOIndex() = default; + WpADOIndex(const WpADOIndex& rhs) : WpOLEBase<_ADOIndex>(rhs) {} + + WpADOIndex& operator=(const WpADOIndex& rhs) + {WpOLEBase<_ADOIndex>::operator=(rhs); return *this;} + + void Create(); + + OUString get_Name() const; + void put_Name(std::u16string_view _rName); + bool get_Clustered() const; + void put_Clustered(bool _b); + bool get_Unique() const; + void put_Unique(bool _b); + bool get_PrimaryKey() const; + void put_PrimaryKey(bool _b); + WpADOColumns get_Columns() const; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapKey.hxx b/connectivity/source/inc/ado/WrapKey.hxx index 1f984445b8ae..682da4fdffa8 100644 --- a/connectivity/source/inc/ado/WrapKey.hxx +++ b/connectivity/source/inc/ado/WrapKey.hxx @@ -26,29 +26,29 @@ namespace connectivity::ado { - class WpADOKey : public WpOLEBase<ADOKey> - { - public: - WpADOKey() = default; - WpADOKey(const WpADOKey& rhs) : WpOLEBase<ADOKey>(rhs) {} - - WpADOKey& operator=(const WpADOKey& rhs) - {WpOLEBase<ADOKey>::operator=(rhs); return *this;} - - void Create(); - - OUString get_Name() const; - void put_Name(std::u16string_view _rName); - KeyTypeEnum get_Type() const; - void put_Type(const KeyTypeEnum& _eNum) ; - OUString get_RelatedTable() const; - void put_RelatedTable(std::u16string_view _rName); - RuleEnum get_DeleteRule() const; - void put_DeleteRule(const RuleEnum& _eNum) ; - RuleEnum get_UpdateRule() const; - void put_UpdateRule(const RuleEnum& _eNum) ; - WpADOColumns get_Columns() const; - }; + class WpADOKey : public WpOLEBase<ADOKey> + { + public: + WpADOKey() = default; + WpADOKey(const WpADOKey& rhs) : WpOLEBase<ADOKey>(rhs) {} + + WpADOKey& operator=(const WpADOKey& rhs) + {WpOLEBase<ADOKey>::operator=(rhs); return *this;} + + void Create(); + + OUString get_Name() const; + void put_Name(std::u16string_view _rName); + KeyTypeEnum get_Type() const; + void put_Type(const KeyTypeEnum& _eNum) ; + OUString get_RelatedTable() const; + void put_RelatedTable(std::u16string_view _rName); + RuleEnum get_DeleteRule() const; + void put_DeleteRule(const RuleEnum& _eNum) ; + RuleEnum get_UpdateRule() const; + void put_UpdateRule(const RuleEnum& _eNum) ; + WpADOColumns get_Columns() const; + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapTable.hxx b/connectivity/source/inc/ado/WrapTable.hxx index dc06dbc03a8e..0519db42a435 100644 --- a/connectivity/source/inc/ado/WrapTable.hxx +++ b/connectivity/source/inc/ado/WrapTable.hxx @@ -26,32 +26,32 @@ namespace connectivity::ado { - class WpADOCatalog; + class WpADOCatalog; - class WpADOTable : public WpOLEBase<_ADOTable> - { - public: - WpADOTable() = default; - WpADOTable(const WpADOTable& rhs) : WpOLEBase<_ADOTable>(rhs) {} + class WpADOTable : public WpOLEBase<_ADOTable> + { + public: + WpADOTable() = default; + WpADOTable(const WpADOTable& rhs) : WpOLEBase<_ADOTable>(rhs) {} - WpADOTable& operator=(const WpADOTable& rhs) - {WpOLEBase<_ADOTable>::operator=(rhs); return *this;} + WpADOTable& operator=(const WpADOTable& rhs) + {WpOLEBase<_ADOTable>::operator=(rhs); return *this;} - void Create(); + void Create(); - OUString get_Name() const; - void put_Name(std::u16string_view _rName); - OUString get_Type() const; - WpADOColumns get_Columns() const; - WpADOIndexes get_Indexes() const; - WpADOKeys get_Keys() const; - WpADOCatalog get_ParentCatalog() const; - WpADOProperties get_Properties() const; - void putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); - }; + OUString get_Name() const; + void put_Name(std::u16string_view _rName); + OUString get_Type() const; + WpADOColumns get_Columns() const; + WpADOIndexes get_Indexes() const; + WpADOKeys get_Keys() const; + WpADOCatalog get_ParentCatalog() const; + WpADOProperties get_Properties() const; + void putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); + }; - typedef WpOLEAppendCollection<ADOTables, WpADOTable> WpADOTables; + typedef WpOLEAppendCollection<ADOTables, WpADOTable> WpADOTables; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/WrapTypeDefs.hxx b/connectivity/source/inc/ado/WrapTypeDefs.hxx index 91bea8453480..a5bd3dea02b6 100644 --- a/connectivity/source/inc/ado/WrapTypeDefs.hxx +++ b/connectivity/source/inc/ado/WrapTypeDefs.hxx @@ -21,21 +21,21 @@ namespace connectivity::ado { - class WpADOTable; - class WpADOKey; - class WpADOIndex; - class WpADOColumn; - class WpADOGroup; - class WpADOView; - class WpADOUser; + class WpADOTable; + class WpADOKey; + class WpADOIndex; + class WpADOColumn; + class WpADOGroup; + class WpADOView; + class WpADOUser; - typedef WpOLEAppendCollection<ADOTables, WpADOTable> WpADOTables; - typedef WpOLEAppendCollection<ADOKeys, WpADOKey> WpADOKeys; - typedef WpOLEAppendCollection<ADOIndexes, WpADOIndex> WpADOIndexes; - typedef WpOLEAppendCollection<ADOColumns, WpADOColumn> WpADOColumns; - typedef WpOLEAppendCollection<ADOGroups, WpADOGroup> WpADOGroups; - typedef WpOLEAppendCollection<ADOViews, WpADOView> WpADOViews; - typedef WpOLEAppendCollection<ADOUsers, WpADOUser> WpADOUsers; + typedef WpOLEAppendCollection<ADOTables, WpADOTable> WpADOTables; + typedef WpOLEAppendCollection<ADOKeys, WpADOKey> WpADOKeys; + typedef WpOLEAppendCollection<ADOIndexes, WpADOIndex> WpADOIndexes; + typedef WpOLEAppendCollection<ADOColumns, WpADOColumn> WpADOColumns; + typedef WpOLEAppendCollection<ADOGroups, WpADOGroup> WpADOGroups; + typedef WpOLEAppendCollection<ADOViews, WpADOView> WpADOViews; + typedef WpOLEAppendCollection<ADOUsers, WpADOUser> WpADOUsers; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx index b1bb1548716e..41a5f1c18370 100644 --- a/connectivity/source/inc/ado/adoimp.hxx +++ b/connectivity/source/inc/ado/adoimp.hxx @@ -27,61 +27,61 @@ struct ADOConnection; namespace connectivity::ado { - class WpADOField; - class ADOS - { - public: - static BSTR GetKeyStr(); + class WpADOField; + class ADOS + { + public: + static BSTR GetKeyStr(); - static const CLSID CLSID_ADOCATALOG_25; - static const IID IID_ADOCATALOG_25; + static const CLSID CLSID_ADOCATALOG_25; + static const IID IID_ADOCATALOG_25; - static const CLSID CLSID_ADOCONNECTION_21; - static const IID IID_ADOCONNECTION_21; + static const CLSID CLSID_ADOCONNECTION_21; + static const IID IID_ADOCONNECTION_21; - static const CLSID CLSID_ADOCOMMAND_21; - static const IID IID_ADOCOMMAND_21; + static const CLSID CLSID_ADOCOMMAND_21; + static const IID IID_ADOCOMMAND_21; - static const CLSID CLSID_ADORECORDSET_21; - static const IID IID_ADORECORDSET_21; + static const CLSID CLSID_ADORECORDSET_21; + static const IID IID_ADORECORDSET_21; - static const CLSID CLSID_ADOINDEX_25; - static const IID IID_ADOINDEX_25; + static const CLSID CLSID_ADOINDEX_25; + static const IID IID_ADOINDEX_25; - static const CLSID CLSID_ADOCOLUMN_25; - static const IID IID_ADOCOLUMN_25; + static const CLSID CLSID_ADOCOLUMN_25; + static const IID IID_ADOCOLUMN_25; - static const CLSID CLSID_ADOKEY_25; - static const IID IID_ADOKEY_25; + static const CLSID CLSID_ADOKEY_25; + static const IID IID_ADOKEY_25; - static const CLSID CLSID_ADOTABLE_25; - static const IID IID_ADOTABLE_25; + static const CLSID CLSID_ADOTABLE_25; + static const IID IID_ADOTABLE_25; - static const CLSID CLSID_ADOGROUP_25; - static const IID IID_ADOGROUP_25; + static const CLSID CLSID_ADOGROUP_25; + static const IID IID_ADOGROUP_25; - static const CLSID CLSID_ADOUSER_25; - static const IID IID_ADOUSER_25; + static const CLSID CLSID_ADOUSER_25; + static const IID IID_ADOUSER_25; - static const CLSID CLSID_ADOVIEW_25; - static const IID IID_ADOVIEW_25; + static const CLSID CLSID_ADOVIEW_25; + static const IID IID_ADOVIEW_25; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static void ThrowException(ADOConnection* _pAdoCon,const css::uno::Reference< css::uno::XInterface >& _xInterface); - static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); - static DataTypeEnum MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine); - static bool isJetEngine(sal_Int32 _nEngineType); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static void ThrowException(ADOConnection* _pAdoCon,const css::uno::Reference< css::uno::XInterface >& _xInterface); + static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + static DataTypeEnum MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine); + static bool isJetEngine(sal_Int32 _nEngineType); - static ObjectTypeEnum mapObjectType2Ado(sal_Int32 objType); - static sal_Int32 mapAdoType2Object(ObjectTypeEnum objType); - static sal_Int32 mapAdoRights2Sdbc(RightsEnum eRights); - static sal_Int32 mapRights2Ado(sal_Int32 nRights); + static ObjectTypeEnum mapObjectType2Ado(sal_Int32 objType); + static sal_Int32 mapAdoType2Object(ObjectTypeEnum objType); + static sal_Int32 mapAdoRights2Sdbc(RightsEnum eRights); + static sal_Int32 mapRights2Ado(sal_Int32 nRights); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static WpADOField getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex); - }; + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static WpADOField getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex); + }; } diff --git a/connectivity/source/inc/calc/CCatalog.hxx b/connectivity/source/inc/calc/CCatalog.hxx index 466e96ece829..facca4166617 100644 --- a/connectivity/source/inc/calc/CCatalog.hxx +++ b/connectivity/source/inc/calc/CCatalog.hxx @@ -23,15 +23,15 @@ namespace connectivity::calc { - class OCalcConnection; - class OCalcCatalog : public file::OFileCatalog - { - public: - virtual void refreshTables() override; + class OCalcConnection; + class OCalcCatalog : public file::OFileCatalog + { +public: + virtual void refreshTables() override; - public: - OCalcCatalog(OCalcConnection* _pCon); - }; + public: + OCalcCatalog(OCalcConnection* _pCon); + }; } diff --git a/connectivity/source/inc/calc/CConnection.hxx b/connectivity/source/inc/calc/CConnection.hxx index 6eabeccef5ff..f9f1b8b07afb 100644 --- a/connectivity/source/inc/calc/CConnection.hxx +++ b/connectivity/source/inc/calc/CConnection.hxx @@ -34,115 +34,115 @@ namespace utl { class CloseVeto; } namespace connectivity::calc +{ + class ODriver; + class OCalcConnection : public file::OConnection { - class ODriver; - class OCalcConnection : public file::OConnection + // the spreadsheet document: + css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDoc; + OUString m_sPassword; + OUString m_aFileName; + oslInterlockedCount m_nDocCount; + + class CloseVetoButTerminateListener : public cppu::WeakComponentImplHelper<css::frame::XTerminateListener> { - // the spreadsheet document: - css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDoc; - OUString m_sPassword; - OUString m_aFileName; - oslInterlockedCount m_nDocCount; + private: + /// close listener that vetoes so nobody else disposes m_xDoc + std::unique_ptr<utl::CloseVeto> m_pCloseListener; + /// but also listen to XDesktop and if app is terminating anyway, dispose m_xDoc while + /// its still possible to do so properly + css::uno::Reference<css::frame::XDesktop2> m_xDesktop; + osl::Mutex m_aMutex; + public: + CloseVetoButTerminateListener() + : cppu::WeakComponentImplHelper<css::frame::XTerminateListener>(m_aMutex) + { + } - class CloseVetoButTerminateListener : public cppu::WeakComponentImplHelper<css::frame::XTerminateListener> + void start(const css::uno::Reference<css::uno::XInterface>& rCloseable, + const css::uno::Reference<css::frame::XDesktop2>& rDesktop) { - private: - /// close listener that vetoes so nobody else disposes m_xDoc - std::unique_ptr<utl::CloseVeto> m_pCloseListener; - /// but also listen to XDesktop and if app is terminating anyway, dispose m_xDoc while - /// its still possible to do so properly - css::uno::Reference<css::frame::XDesktop2> m_xDesktop; - osl::Mutex m_aMutex; - public: - CloseVetoButTerminateListener() - : cppu::WeakComponentImplHelper<css::frame::XTerminateListener>(m_aMutex) - { - } - - void start(const css::uno::Reference<css::uno::XInterface>& rCloseable, - const css::uno::Reference<css::frame::XDesktop2>& rDesktop) - { - m_xDesktop = rDesktop; - m_xDesktop->addTerminateListener(this); - m_pCloseListener.reset(new utl::CloseVeto(rCloseable, true)); - } - - void stop() - { - m_pCloseListener.reset(); - if (!m_xDesktop.is()) - return; - m_xDesktop->removeTerminateListener(this); - m_xDesktop.clear(); - } - - // XTerminateListener - virtual void SAL_CALL queryTermination(const css::lang::EventObject& /*rEvent*/) override - { - } - - virtual void SAL_CALL notifyTermination(const css::lang::EventObject& /*rEvent*/) override - { - stop(); - } + m_xDesktop = rDesktop; + m_xDesktop->addTerminateListener(this); + m_pCloseListener.reset(new utl::CloseVeto(rCloseable, true)); + } - virtual void SAL_CALL disposing() override - { - stop(); - cppu::WeakComponentImplHelperBase::disposing(); - } + void stop() + { + m_pCloseListener.reset(); + if (!m_xDesktop.is()) + return; + m_xDesktop->removeTerminateListener(this); + m_xDesktop.clear(); + } + + // XTerminateListener + virtual void SAL_CALL queryTermination(const css::lang::EventObject& /*rEvent*/) override + { + } + + virtual void SAL_CALL notifyTermination(const css::lang::EventObject& /*rEvent*/) override + { + stop(); + } - virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override - { - const bool bShutDown = (rEvent.Source == m_xDesktop); - if (bShutDown) - stop(); - } - }; + virtual void SAL_CALL disposing() override + { + stop(); + cppu::WeakComponentImplHelperBase::disposing(); + } - rtl::Reference<CloseVetoButTerminateListener> m_xCloseVetoButTerminateListener; + virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override + { + const bool bShutDown = (rEvent.Source == m_xDesktop); + if (bShutDown) + stop(); + } + }; - public: - OCalcConnection(ODriver* _pDriver); - virtual ~OCalcConnection() override; + rtl::Reference<CloseVetoButTerminateListener> m_xCloseVetoButTerminateListener; - virtual void construct(const OUString& _rUrl, - const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ) override; + public: + OCalcConnection(ODriver* _pDriver); + virtual ~OCalcConnection() override; - // XServiceInfo - DECLARE_SERVICE_INFO(); + virtual void construct(const OUString& _rUrl, + const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ) override; - // OComponentHelper - virtual void SAL_CALL disposing() override; + // XServiceInfo + DECLARE_SERVICE_INFO(); - // XConnection - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // no interface methods - css::uno::Reference< css::sheet::XSpreadsheetDocument> const & acquireDoc(); - void releaseDoc(); + // XConnection + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - class ODocHolder + // no interface methods + css::uno::Reference< css::sheet::XSpreadsheetDocument> const & acquireDoc(); + void releaseDoc(); + + class ODocHolder + { + OCalcConnection* m_pConnection; + css::uno::Reference< css::sheet::XSpreadsheetDocument> m_xDoc; + public: + ODocHolder(OCalcConnection* _pConnection) : m_pConnection(_pConnection) + { + m_xDoc = m_pConnection->acquireDoc(); + } + ~ODocHolder() { - OCalcConnection* m_pConnection; - css::uno::Reference< css::sheet::XSpreadsheetDocument> m_xDoc; - public: - ODocHolder(OCalcConnection* _pConnection) : m_pConnection(_pConnection) - { - m_xDoc = m_pConnection->acquireDoc(); - } - ~ODocHolder() - { - m_xDoc.clear(); - m_pConnection->releaseDoc(); - } - const css::uno::Reference< css::sheet::XSpreadsheetDocument>& getDoc() const { return m_xDoc; } - }; + m_xDoc.clear(); + m_pConnection->releaseDoc(); + } + const css::uno::Reference< css::sheet::XSpreadsheetDocument>& getDoc() const { return m_xDoc; } }; + }; } diff --git a/connectivity/source/inc/calc/CDatabaseMetaData.hxx b/connectivity/source/inc/calc/CDatabaseMetaData.hxx index 61f9f6aa7ea2..b58f5c1d84e7 100644 --- a/connectivity/source/inc/calc/CDatabaseMetaData.hxx +++ b/connectivity/source/inc/calc/CDatabaseMetaData.hxx @@ -22,20 +22,20 @@ #include <component/CDatabaseMetaData.hxx> namespace connectivity::calc - { +{ - //************ Class: java.sql.DatabaseMetaDataDate + //************ Class: java.sql.DatabaseMetaDataDate - class OCalcDatabaseMetaData : public component::OComponentDatabaseMetaData - { - virtual OUString SAL_CALL getURL( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; - protected: - virtual ~OCalcDatabaseMetaData() override; - public: - OCalcDatabaseMetaData(file::OConnection* _pCon); - }; + class OCalcDatabaseMetaData : public component::OComponentDatabaseMetaData + { + virtual OUString SAL_CALL getURL( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; + protected: + virtual ~OCalcDatabaseMetaData() override; + public: + OCalcDatabaseMetaData(file::OConnection* _pCon); + }; } diff --git a/connectivity/source/inc/calc/CDriver.hxx b/connectivity/source/inc/calc/CDriver.hxx index 99200d23ee54..6ca822229436 100644 --- a/connectivity/source/inc/calc/CDriver.hxx +++ b/connectivity/source/inc/calc/CDriver.hxx @@ -24,27 +24,27 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> namespace connectivity::calc +{ + /// @throws css::uno::Exception + css::uno::Reference< css::uno::XInterface > + ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); + + class ODriver : public file::OFileDriver { - /// @throws css::uno::Exception - css::uno::Reference< css::uno::XInterface > - ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); - - class ODriver : public file::OFileDriver - { - public: - ODriver(const css::uno::Reference< - css::uno::XComponentContext >& _rxContext) : - file::OFileDriver(_rxContext) {} - - OUString SAL_CALL getImplementationName( ) override; - - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL - connect( const OUString& url, const css::uno::Sequence< - css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - }; + public: + ODriver(const css::uno::Reference< + css::uno::XComponentContext >& _rxContext) : + file::OFileDriver(_rxContext) {} + + OUString SAL_CALL getImplementationName( ) override; + + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL + connect( const OUString& url, const css::uno::Sequence< + css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + }; } diff --git a/connectivity/source/inc/calc/CTable.hxx b/connectivity/source/inc/calc/CTable.hxx index b4751fd876d7..17dcab61b2f7 100644 --- a/connectivity/source/inc/calc/CTable.hxx +++ b/connectivity/source/inc/calc/CTable.hxx @@ -32,40 +32,40 @@ namespace com::sun::star::util { namespace connectivity::calc - { - typedef component::OComponentTable OCalcTable_BASE; - class OCalcConnection; +{ + typedef component::OComponentTable OCalcTable_BASE; + class OCalcConnection; - class OCalcTable : public OCalcTable_BASE - { - private: - std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset - css::uno::Reference< css::sheet::XSpreadsheet > m_xSheet; - OCalcConnection* m_pCalcConnection; - sal_Int32 m_nStartCol; - sal_Int32 m_nStartRow; - sal_Int32 m_nDataCols; - bool m_bHasHeaders; - css::uno::Reference< css::util::XNumberFormats > m_xFormats; - ::Date m_aNullDate; + class OCalcTable : public OCalcTable_BASE + { + private: + std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset + css::uno::Reference< css::sheet::XSpreadsheet > m_xSheet; + OCalcConnection* m_pCalcConnection; + sal_Int32 m_nStartCol; + sal_Int32 m_nStartRow; + sal_Int32 m_nDataCols; + bool m_bHasHeaders; + css::uno::Reference< css::util::XNumberFormats > m_xFormats; + ::Date m_aNullDate; - void fillColumns(); + void fillColumns(); - public: - OCalcTable( sdbcx::OCollection* _pTables,OCalcConnection* _pConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description = OUString(), - const OUString& SchemaName = OUString(), - const OUString& CatalogName = OUString() - ); + public: + OCalcTable( sdbcx::OCollection* _pTables,OCalcConnection* _pConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description = OUString(), + const OUString& SchemaName = OUString(), + const OUString& CatalogName = OUString() + ); - virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override; + virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override; - virtual void SAL_CALL disposing() override; + virtual void SAL_CALL disposing() override; - void construct() override; - }; + void construct() override; + }; } diff --git a/connectivity/source/inc/calc/CTables.hxx b/connectivity/source/inc/calc/CTables.hxx index 0fb9ac54c08a..39c427fdd696 100644 --- a/connectivity/source/inc/calc/CTables.hxx +++ b/connectivity/source/inc/calc/CTables.hxx @@ -22,18 +22,18 @@ #include <file/FTables.hxx> namespace connectivity::calc - { - typedef file::OTables OCalcTables_BASE; +{ + typedef file::OTables OCalcTables_BASE; - class OCalcTables : public OCalcTables_BASE - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - public: - OCalcTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : OCalcTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) - {} - }; + class OCalcTables : public OCalcTables_BASE + { + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + public: + OCalcTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : OCalcTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) + {} + }; } diff --git a/connectivity/source/inc/component/CColumns.hxx b/connectivity/source/inc/component/CColumns.hxx index b0cbde89f577..5c20a3626a74 100644 --- a/connectivity/source/inc/component/CColumns.hxx +++ b/connectivity/source/inc/component/CColumns.hxx @@ -22,20 +22,20 @@ #include <file/FColumns.hxx> namespace connectivity::component +{ + /// Columns implementation for Writer tables and Calc sheets. + class OComponentColumns : public file::OColumns { - /// Columns implementation for Writer tables and Calc sheets. - class OComponentColumns : public file::OColumns - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - public: - OComponentColumns(file::OFileTable* _pTable, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector - ) : file::OColumns(_pTable,_rMutex,_rVector) - {} + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + public: + OComponentColumns(file::OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector + ) : file::OColumns(_pTable,_rMutex,_rVector) + {} - }; + }; } diff --git a/connectivity/source/inc/component/CDatabaseMetaData.hxx b/connectivity/source/inc/component/CDatabaseMetaData.hxx index c4721ecadb9f..e46614e54356 100644 --- a/connectivity/source/inc/component/CDatabaseMetaData.hxx +++ b/connectivity/source/inc/component/CDatabaseMetaData.hxx @@ -22,25 +22,25 @@ #include <file/FDatabaseMetaData.hxx> namespace connectivity::component - { +{ + + //************ Class: java.sql.DatabaseMetaDataDate - //************ Class: java.sql.DatabaseMetaDataDate - - - class OOO_DLLPUBLIC_FILE OComponentDatabaseMetaData : public file::ODatabaseMetaData - { - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - protected: - virtual ~OComponentDatabaseMetaData() override; - public: - OComponentDatabaseMetaData(file::OConnection* _pCon); - }; + + class OOO_DLLPUBLIC_FILE OComponentDatabaseMetaData : public file::ODatabaseMetaData + { + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + protected: + virtual ~OComponentDatabaseMetaData() override; + public: + OComponentDatabaseMetaData(file::OConnection* _pCon); + }; } diff --git a/connectivity/source/inc/component/CPreparedStatement.hxx b/connectivity/source/inc/component/CPreparedStatement.hxx index d39a3edad136..340a744ab9cc 100644 --- a/connectivity/source/inc/component/CPreparedStatement.hxx +++ b/connectivity/source/inc/component/CPreparedStatement.hxx @@ -22,17 +22,17 @@ #include <file/FPreparedStatement.hxx> namespace connectivity::component +{ + class OConnection; + /// Prepared statement implementation for Writer tables and Calc sheets. + class OOO_DLLPUBLIC_FILE OComponentPreparedStatement : public file::OPreparedStatement { - class OConnection; - /// Prepared statement implementation for Writer tables and Calc sheets. - class OOO_DLLPUBLIC_FILE OComponentPreparedStatement : public file::OPreparedStatement - { - protected: - virtual rtl::Reference<file::OResultSet> createResultSet() override; - public: - OComponentPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; + protected: + virtual rtl::Reference<file::OResultSet> createResultSet() override; + public: + OComponentPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/source/inc/component/CResultSet.hxx b/connectivity/source/inc/component/CResultSet.hxx index 4874f22151b6..8758ba063bd2 100644 --- a/connectivity/source/inc/component/CResultSet.hxx +++ b/connectivity/source/inc/component/CResultSet.hxx @@ -24,55 +24,55 @@ #include <cppuhelper/implbase2.hxx> namespace connectivity::component - { - class OComponentResultSet; - // these typedef's are only necessary for the compiler - typedef ::cppu::ImplHelper2< css::sdbcx::XRowLocate, - css::sdbcx::XDeleteRows> OComponentResultSet_BASE; - typedef file::OResultSet OComponentResultSet_BASE2; - typedef ::comphelper::OPropertyArrayUsageHelper<OComponentResultSet> OComponentResultSet_BASE3; +{ + class OComponentResultSet; + // these typedef's are only necessary for the compiler + typedef ::cppu::ImplHelper2< css::sdbcx::XRowLocate, + css::sdbcx::XDeleteRows> OComponentResultSet_BASE; + typedef file::OResultSet OComponentResultSet_BASE2; + typedef ::comphelper::OPropertyArrayUsageHelper<OComponentResultSet> OComponentResultSet_BASE3; - /// ResultSet implementation for Writer tables and Calc sheets. - class OComponentResultSet : public OComponentResultSet_BASE2, - public OComponentResultSet_BASE, - public OComponentResultSet_BASE3 - { - bool m_bBookmarkable; - protected: - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual bool fillIndexValues(const css::uno::Reference< css::sdbcx::XColumnsSupplier> &_xIndex) override; - public: - DECLARE_SERVICE_INFO(); + /// ResultSet implementation for Writer tables and Calc sheets. + class OComponentResultSet : public OComponentResultSet_BASE2, + public OComponentResultSet_BASE, + public OComponentResultSet_BASE3 + { + bool m_bBookmarkable; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual bool fillIndexValues(const css::uno::Reference< css::sdbcx::XColumnsSupplier> &_xIndex) override; + public: + DECLARE_SERVICE_INFO(); - OComponentResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + OComponentResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); - private: - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + private: + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XRowLocate - virtual css::uno::Any SAL_CALL getBookmark( ) override; - virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; - virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; - virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; - // XDeleteRows - virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; + // XRowLocate + virtual css::uno::Any SAL_CALL getBookmark( ) override; + virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; + virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; + virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; + // XDeleteRows + virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; - virtual bool isRowDeleted() const override { return false; } + virtual bool isRowDeleted() const override { return false; } - }; + }; } diff --git a/connectivity/source/inc/component/CStatement.hxx b/connectivity/source/inc/component/CStatement.hxx index 10346e7c8559..70b8937250bf 100644 --- a/connectivity/source/inc/component/CStatement.hxx +++ b/connectivity/source/inc/component/CStatement.hxx @@ -22,17 +22,17 @@ #include <file/FStatement.hxx> namespace connectivity::component +{ + class OConnection; + /// Statement implementation for Writer tables and Calc sheets. + class OOO_DLLPUBLIC_FILE OComponentStatement : public file::OStatement { - class OConnection; - /// Statement implementation for Writer tables and Calc sheets. - class OOO_DLLPUBLIC_FILE OComponentStatement : public file::OStatement - { - protected: - virtual rtl::Reference<file::OResultSet> createResultSet() override; - public: - OComponentStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; + protected: + virtual rtl::Reference<file::OResultSet> createResultSet() override; + public: + OComponentStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/source/inc/component/CTable.hxx b/connectivity/source/inc/component/CTable.hxx index 3ace6f922ae0..5204dc9ed134 100644 --- a/connectivity/source/inc/component/CTable.hxx +++ b/connectivity/source/inc/component/CTable.hxx @@ -31,35 +31,35 @@ namespace com::sun::star::util { namespace connectivity::component - { - typedef file::OFileTable OComponentTable_BASE; +{ + typedef file::OFileTable OComponentTable_BASE; - /// Shared Table base class for Writer tables and Calc sheets. - class OOO_DLLPUBLIC_FILE OComponentTable : public OComponentTable_BASE - { - protected: - sal_Int32 m_nDataRows; + /// Shared Table base class for Writer tables and Calc sheets. + class OOO_DLLPUBLIC_FILE OComponentTable : public OComponentTable_BASE + { + protected: + sal_Int32 m_nDataRows; - virtual void FileClose() override; - public: - OComponentTable( sdbcx::OCollection* _pTables,file::OConnection* _pConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description, - const OUString& SchemaName, - const OUString& CatalogName - ); + virtual void FileClose() override; + public: + OComponentTable( sdbcx::OCollection* _pTables,file::OConnection* _pConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description, + const OUString& SchemaName, + const OUString& CatalogName + ); - virtual void refreshColumns() override; - virtual void refreshIndexes() override; + virtual void refreshColumns() override; + virtual void refreshIndexes() override; - virtual sal_Int32 getCurrentLastPos() const override; - virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override; + virtual sal_Int32 getCurrentLastPos() const override; + virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override; - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - }; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + }; } diff --git a/connectivity/source/inc/dbase/DCatalog.hxx b/connectivity/source/inc/dbase/DCatalog.hxx index f8954d012211..9004080aedf6 100644 --- a/connectivity/source/inc/dbase/DCatalog.hxx +++ b/connectivity/source/inc/dbase/DCatalog.hxx @@ -22,16 +22,16 @@ #include <file/FCatalog.hxx> namespace connectivity::dbase +{ + class ODbaseConnection; + class ODbaseCatalog : public file::OFileCatalog { - class ODbaseConnection; - class ODbaseCatalog : public file::OFileCatalog - { - public: - virtual void refreshTables() override; +public: + virtual void refreshTables() override; - public: - ODbaseCatalog(ODbaseConnection* _pCon); - }; + public: + ODbaseCatalog(ODbaseConnection* _pCon); + }; } diff --git a/connectivity/source/inc/dbase/DColumns.hxx b/connectivity/source/inc/dbase/DColumns.hxx index c9bbf2eebe90..5237ef67b5a7 100644 --- a/connectivity/source/inc/dbase/DColumns.hxx +++ b/connectivity/source/inc/dbase/DColumns.hxx @@ -22,22 +22,22 @@ #include <file/FColumns.hxx> namespace connectivity::dbase +{ + class ODbaseColumns : public file::OColumns { - class ODbaseColumns : public file::OColumns - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; - public: - ODbaseColumns(file::OFileTable* _pTable, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector - ) : file::OColumns(_pTable,_rMutex,_rVector) - {} - }; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; + public: + ODbaseColumns(file::OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector + ) : file::OColumns(_pTable,_rMutex,_rVector) + {} + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/dbase/DConnection.hxx b/connectivity/source/inc/dbase/DConnection.hxx index 864e9a22c870..26a51efb8e8b 100644 --- a/connectivity/source/inc/dbase/DConnection.hxx +++ b/connectivity/source/inc/dbase/DConnection.hxx @@ -22,24 +22,24 @@ #include <file/FConnection.hxx> namespace connectivity::dbase +{ + class ODriver; + class ODbaseConnection : public file::OConnection { - class ODriver; - class ODbaseConnection : public file::OConnection - { - protected: - virtual ~ODbaseConnection() override; - public: - ODbaseConnection(ODriver* _pDriver); - // XServiceInfo - DECLARE_SERVICE_INFO(); + protected: + virtual ~ODbaseConnection() override; + public: + ODbaseConnection(ODriver* _pDriver); + // XServiceInfo + DECLARE_SERVICE_INFO(); - // XConnection - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - }; + // XConnection + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + }; } diff --git a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx index fed3fcc70ea9..05a7fd8c8614 100644 --- a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx +++ b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx @@ -22,35 +22,35 @@ #include <file/FDatabaseMetaData.hxx> namespace connectivity::dbase - { +{ + + //************ Class: java.sql.DatabaseMetaDataDate - //************ Class: java.sql.DatabaseMetaDataDate - - - class ODbaseDatabaseMetaData : public file::ODatabaseMetaData - { - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; - - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - - virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; - virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; - - virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; - virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override; - protected: - virtual ~ODbaseDatabaseMetaData() override; - public: - ODbaseDatabaseMetaData(file::OConnection* _pCon); - }; + + class ODbaseDatabaseMetaData : public file::ODatabaseMetaData + { + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; + + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override; + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override; + + virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; + virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override; + protected: + virtual ~ODbaseDatabaseMetaData() override; + public: + ODbaseDatabaseMetaData(file::OConnection* _pCon); + }; } diff --git a/connectivity/source/inc/dbase/DDriver.hxx b/connectivity/source/inc/dbase/DDriver.hxx index 310f9b1dc8d5..e832d8ad91eb 100644 --- a/connectivity/source/inc/dbase/DDriver.hxx +++ b/connectivity/source/inc/dbase/DDriver.hxx @@ -24,22 +24,22 @@ #include <file/FDriver.hxx> namespace connectivity::dbase - { - /// @throws css::uno::Exception - css::uno::Reference< css::uno::XInterface > ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); +{ + /// @throws css::uno::Exception + css::uno::Reference< css::uno::XInterface > ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); - class ODriver : public file::OFileDriver - { - public: - ODriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) : file::OFileDriver(_rxContext){} + class ODriver : public file::OFileDriver + { + public: + ODriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) : file::OFileDriver(_rxContext){} - OUString SAL_CALL getImplementationName( ) override; + OUString SAL_CALL getImplementationName( ) override; - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - }; + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + }; } diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx index 3cc7da9ad1d3..9b3755913644 100644 --- a/connectivity/source/inc/dbase/DIndex.hxx +++ b/connectivity/source/inc/dbase/DIndex.hxx @@ -26,109 +26,109 @@ inline constexpr OString dBASE_III_GROUP = "dBase III"_ostr; namespace connectivity::dbase +{ + class OIndexIterator; + class ONDXKey; + + typedef sdbcx::OIndex ODbaseIndex_BASE; + + class ODbaseIndex : public ODbaseIndex_BASE { - class OIndexIterator; - class ONDXKey; + friend SvStream& WriteODbaseIndex(SvStream &rStream, const ODbaseIndex&); + friend SvStream& operator >> (SvStream &rStream, ODbaseIndex&); + + friend class ONDXNode; + friend class ONDXPage; + friend class ONDXPagePtr; + friend class OIndexIterator; - typedef sdbcx::OIndex ODbaseIndex_BASE; + public: - class ODbaseIndex : public ODbaseIndex_BASE + // Header struct - stays in memory + + struct NDXHeader { - friend SvStream& WriteODbaseIndex(SvStream &rStream, const ODbaseIndex&); - friend SvStream& operator >> (SvStream &rStream, ODbaseIndex&); - - friend class ONDXNode; - friend class ONDXPage; - friend class ONDXPagePtr; - friend class OIndexIterator; - - public: - - // Header struct - stays in memory - - struct NDXHeader - { - sal_uInt32 db_rootpage; /* Rootpage position */ - sal_uInt32 db_pagecount; /* Page count */ - sal_uInt8 db_free[4]; /* Reserved */ - sal_uInt16 db_keylen; /* Key length */ - sal_uInt16 db_maxkeys; /* Maximum number of keys per page */ - sal_uInt16 db_keytype; /* Type of key: - 0 = Text - 1 = Numerical */ - sal_uInt16 db_keyrec; /* Length of an index record - RecordNumber + keylen */ - sal_uInt8 db_free1[3]; /* Reserved */ - sal_uInt8 db_unique; /* Unique */ - char db_name[488]; /* index_name (field name) */ - }; - - private: - std::unique_ptr<SvStream> m_pFileStream; // Stream to read/write the index - NDXHeader m_aHeader = {}; - std::vector<ONDXPage*> - m_aCollector; // Pool of obsolete pages - ONDXPagePtr m_aRoot, // Root of the B+ tree - m_aCurLeaf; // Current leaf - sal_uInt16 m_nCurNode; // Position of the current node - - sal_uInt32 m_nPageCount, - m_nRootPage; - - ODbaseTable* m_pTable; - bool m_bUseCollector : 1; // Use the Garbage Collector - - OUString getCompletePath() const; - void closeImpl(); - // Closes and kills the index file and throws an error - void impl_killFileAndthrowError_throw(TranslateId pErrorId, const OUString& _sFile); - protected: - virtual ~ODbaseIndex() override; - public: - ODbaseIndex(ODbaseTable* _pTable); - ODbaseIndex(ODbaseTable* _pTable,const NDXHeader& _aHeader,const OUString& Name); - - void openIndexFile(); - virtual void refreshColumns() override; - - const ODbaseTable* getTable() const { return m_pTable; } - const NDXHeader& getHeader() const { return m_aHeader; } - std::unique_ptr<OIndexIterator> createIterator(); - - void SetRootPos(sal_uInt32 nPos) {m_nRootPage = nPos;} - void SetPageCount(sal_uInt32 nCount) {m_nPageCount = nCount;} - - sal_uInt32 GetPageCount() const {return m_nPageCount;} - - sal_uInt16 GetMaxNodes() const {return m_aHeader.db_maxkeys;} - - bool Insert(sal_uInt32 nRec, const ORowSetValue& rValue); - bool Update(sal_uInt32 nRec, const ORowSetValue&, const ORowSetValue&); - bool Delete(sal_uInt32 nRec, const ORowSetValue& rValue); - bool Find(sal_uInt32 nRec, const ORowSetValue& rValue); - - void createINFEntry(); - void CreateImpl(); - void DropImpl(); - - DECLARE_SERVICE_INFO(); - protected: - - ONDXPage* CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent = nullptr, bool bLoad = false); - void Collect(ONDXPage*); - ONDXPagePtr const & getRoot(); - - bool isUnique() const { return m_IsUnique; } - bool UseCollector() const {return m_bUseCollector;} - // Tree operations - void Release(bool bSave = true); - bool ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue); + sal_uInt32 db_rootpage; /* Rootpage position */ + sal_uInt32 db_pagecount; /* Page count */ + sal_uInt8 db_free[4]; /* Reserved */ + sal_uInt16 db_keylen; /* Key length */ + sal_uInt16 db_maxkeys; /* Maximum number of keys per page */ + sal_uInt16 db_keytype; /* Type of key: + 0 = Text + 1 = Numerical */ + sal_uInt16 db_keyrec; /* Length of an index record + RecordNumber + keylen */ + sal_uInt8 db_free1[3]; /* Reserved */ + sal_uInt8 db_unique; /* Unique */ + char db_name[488]; /* index_name (field name) */ }; - SvStream& WriteODbaseIndex(SvStream &rStream, const ODbaseIndex&); - SvStream& operator >> (SvStream &rStream, ODbaseIndex&); + private: + std::unique_ptr<SvStream> m_pFileStream; // Stream to read/write the index + NDXHeader m_aHeader = {}; + std::vector<ONDXPage*> + m_aCollector; // Pool of obsolete pages + ONDXPagePtr m_aRoot, // Root of the B+ tree + m_aCurLeaf; // Current leaf + sal_uInt16 m_nCurNode; // Position of the current node + + sal_uInt32 m_nPageCount, + m_nRootPage; + + ODbaseTable* m_pTable; + bool m_bUseCollector : 1; // Use the Garbage Collector + + OUString getCompletePath() const; + void closeImpl(); + // Closes and kills the index file and throws an error + void impl_killFileAndthrowError_throw(TranslateId pErrorId, const OUString& _sFile); + protected: + virtual ~ODbaseIndex() override; + public: + ODbaseIndex(ODbaseTable* _pTable); + ODbaseIndex(ODbaseTable* _pTable,const NDXHeader& _aHeader,const OUString& Name); + + void openIndexFile(); + virtual void refreshColumns() override; + + const ODbaseTable* getTable() const { return m_pTable; } + const NDXHeader& getHeader() const { return m_aHeader; } + std::unique_ptr<OIndexIterator> createIterator(); + + void SetRootPos(sal_uInt32 nPos) {m_nRootPage = nPos;} + void SetPageCount(sal_uInt32 nCount) {m_nPageCount = nCount;} + + sal_uInt32 GetPageCount() const {return m_nPageCount;} + + sal_uInt16 GetMaxNodes() const {return m_aHeader.db_maxkeys;} + + bool Insert(sal_uInt32 nRec, const ORowSetValue& rValue); + bool Update(sal_uInt32 nRec, const ORowSetValue&, const ORowSetValue&); + bool Delete(sal_uInt32 nRec, const ORowSetValue& rValue); + bool Find(sal_uInt32 nRec, const ORowSetValue& rValue); + + void createINFEntry(); + void CreateImpl(); + void DropImpl(); + + DECLARE_SERVICE_INFO(); + protected: + + ONDXPage* CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent = nullptr, bool bLoad = false); + void Collect(ONDXPage*); + ONDXPagePtr const & getRoot(); + + bool isUnique() const { return m_IsUnique; } + bool UseCollector() const {return m_bUseCollector;} + // Tree operations + void Release(bool bSave = true); + bool ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue); + }; + + SvStream& WriteODbaseIndex(SvStream &rStream, const ODbaseIndex&); + SvStream& operator >> (SvStream &rStream, ODbaseIndex&); - void ReadHeader(SvStream & rStream, ODbaseIndex::NDXHeader & rHeader); + void ReadHeader(SvStream & rStream, ODbaseIndex::NDXHeader & rHeader); } diff --git a/connectivity/source/inc/dbase/DIndexColumns.hxx b/connectivity/source/inc/dbase/DIndexColumns.hxx index eaf2f5cc0ccf..0d97cea113f6 100644 --- a/connectivity/source/inc/dbase/DIndexColumns.hxx +++ b/connectivity/source/inc/dbase/DIndexColumns.hxx @@ -24,24 +24,24 @@ #include <dbase/DTable.hxx> namespace connectivity::dbase +{ + class ODbaseIndexColumns : public sdbcx::OCollection { - class ODbaseIndexColumns : public sdbcx::OCollection - { - ODbaseIndex* m_pIndex; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - public: - ODbaseIndexColumns( ODbaseIndex* _pIndex, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) - : sdbcx::OCollection(*_pIndex,_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) - , m_pIndex(_pIndex) - {} + ODbaseIndex* m_pIndex; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + public: + ODbaseIndexColumns( ODbaseIndex* _pIndex, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) + : sdbcx::OCollection(*_pIndex,_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + , m_pIndex(_pIndex) + {} - }; + }; } diff --git a/connectivity/source/inc/dbase/DIndexIter.hxx b/connectivity/source/inc/dbase/DIndexIter.hxx index 2de327be1138..353f1081b9db 100644 --- a/connectivity/source/inc/dbase/DIndexIter.hxx +++ b/connectivity/source/inc/dbase/DIndexIter.hxx @@ -24,43 +24,43 @@ #include <dbase/dindexnode.hxx> namespace connectivity::dbase - { +{ - // IndexIterator + // IndexIterator - class OIndexIterator final - { - file::OBoolOperator* m_pOperator; - const file::OOperand* m_pOperand; - rtl::Reference<ODbaseIndex> m_xIndex; - ONDXPagePtr m_aRoot, - m_aCurLeaf; - sal_uInt16 m_nCurNode; + class OIndexIterator final + { + file::OBoolOperator* m_pOperator; + const file::OOperand* m_pOperand; + rtl::Reference<ODbaseIndex> m_xIndex; + ONDXPagePtr m_aRoot, + m_aCurLeaf; + sal_uInt16 m_nCurNode; - sal_uInt32 Find(bool bFirst); - sal_uInt32 GetCompare(bool bFirst); - sal_uInt32 GetLike(bool bFirst); - sal_uInt32 GetNull(bool bFirst); - sal_uInt32 GetNotNull(bool bFirst); + sal_uInt32 Find(bool bFirst); + sal_uInt32 GetCompare(bool bFirst); + sal_uInt32 GetLike(bool bFirst); + sal_uInt32 GetNull(bool bFirst); + sal_uInt32 GetNotNull(bool bFirst); - ONDXKey* GetFirstKey(ONDXPage* pPage, - const file::OOperand& rKey); - ONDXKey* GetNextKey(); + ONDXKey* GetFirstKey(ONDXPage* pPage, + const file::OOperand& rKey); + ONDXKey* GetNextKey(); - public: - OIndexIterator(ODbaseIndex* pInd) - :m_pOperator(nullptr) - ,m_pOperand(nullptr) - ,m_xIndex(pInd) - ,m_nCurNode(NODE_NOTFOUND) - { - } + public: + OIndexIterator(ODbaseIndex* pInd) + :m_pOperator(nullptr) + ,m_pOperand(nullptr) + ,m_xIndex(pInd) + ,m_nCurNode(NODE_NOTFOUND) + { + } - ~OIndexIterator(); - sal_uInt32 First(); - sal_uInt32 Next(); + ~OIndexIterator(); + sal_uInt32 First(); + sal_uInt32 Next(); - }; + }; } diff --git a/connectivity/source/inc/dbase/DIndexes.hxx b/connectivity/source/inc/dbase/DIndexes.hxx index aadb531f4107..73987dbe700e 100644 --- a/connectivity/source/inc/dbase/DIndexes.hxx +++ b/connectivity/source/inc/dbase/DIndexes.hxx @@ -23,27 +23,27 @@ #include <dbase/DTable.hxx> namespace connectivity::dbase +{ + class ODbaseTable; + + typedef sdbcx::OCollection ODbaseIndexes_BASE; + + class ODbaseIndexes : public ODbaseIndexes_BASE { - class ODbaseTable; - - typedef sdbcx::OCollection ODbaseIndexes_BASE; - - class ODbaseIndexes : public ODbaseIndexes_BASE - { - ODbaseTable* m_pTable; - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; - public: - ODbaseIndexes(ODbaseTable* _pTable, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : ODbaseIndexes_BASE(*_pTable,_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) - , m_pTable(_pTable) - {} - - }; + ODbaseTable* m_pTable; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; + public: + ODbaseIndexes(ODbaseTable* _pTable, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : ODbaseIndexes_BASE(*_pTable,_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + , m_pTable(_pTable) + {} + + }; } diff --git a/connectivity/source/inc/dbase/DPreparedStatement.hxx b/connectivity/source/inc/dbase/DPreparedStatement.hxx index a2a792f62342..55f73e6d1913 100644 --- a/connectivity/source/inc/dbase/DPreparedStatement.hxx +++ b/connectivity/source/inc/dbase/DPreparedStatement.hxx @@ -22,16 +22,16 @@ #include <file/FPreparedStatement.hxx> namespace connectivity::dbase +{ + class OConnection; + class ODbasePreparedStatement : public file::OPreparedStatement { - class OConnection; - class ODbasePreparedStatement : public file::OPreparedStatement - { - protected: - virtual rtl::Reference<file::OResultSet> createResultSet() override; - public: - ODbasePreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; + protected: + virtual rtl::Reference<file::OResultSet> createResultSet() override; + public: + ODbasePreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/source/inc/dbase/DResultSet.hxx b/connectivity/source/inc/dbase/DResultSet.hxx index 106a63cbb842..4dfbc3317c2c 100644 --- a/connectivity/source/inc/dbase/DResultSet.hxx +++ b/connectivity/source/inc/dbase/DResultSet.hxx @@ -24,54 +24,54 @@ #include <cppuhelper/implbase2.hxx> namespace connectivity::dbase - { - class ODbaseResultSet; - // these typedef's are only necessary for the compiler - typedef ::cppu::ImplHelper2< css::sdbcx::XRowLocate, - css::sdbcx::XDeleteRows> ODbaseResultSet_BASE; - typedef file::OResultSet ODbaseResultSet_BASE2; - typedef ::comphelper::OPropertyArrayUsageHelper<ODbaseResultSet> ODbaseResultSet_BASE3; +{ + class ODbaseResultSet; + // these typedef's are only necessary for the compiler + typedef ::cppu::ImplHelper2< css::sdbcx::XRowLocate, + css::sdbcx::XDeleteRows> ODbaseResultSet_BASE; + typedef file::OResultSet ODbaseResultSet_BASE2; + typedef ::comphelper::OPropertyArrayUsageHelper<ODbaseResultSet> ODbaseResultSet_BASE3; - class ODbaseResultSet : public ODbaseResultSet_BASE2, - public ODbaseResultSet_BASE, - public ODbaseResultSet_BASE3 - { - bool m_bBookmarkable; - protected: - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual bool fillIndexValues(const css::uno::Reference< css::sdbcx::XColumnsSupplier> &_xIndex) override; - public: - DECLARE_SERVICE_INFO(); + class ODbaseResultSet : public ODbaseResultSet_BASE2, + public ODbaseResultSet_BASE, + public ODbaseResultSet_BASE3 + { + bool m_bBookmarkable; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual bool fillIndexValues(const css::uno::Reference< css::sdbcx::XColumnsSupplier> &_xIndex) override; + public: + DECLARE_SERVICE_INFO(); - ODbaseResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + ODbaseResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XRowLocate - virtual css::uno::Any SAL_CALL getBookmark( ) override; - virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; - virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; - virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; - // XDeleteRows - virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; + // XRowLocate + virtual css::uno::Any SAL_CALL getBookmark( ) override; + virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; + virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; + virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; + // XDeleteRows + virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; - // own methods - sal_Int32 getCurrentFilePos() const; + // own methods + sal_Int32 getCurrentFilePos() const; - }; + }; } diff --git a/connectivity/source/inc/dbase/DStatement.hxx b/connectivity/source/inc/dbase/DStatement.hxx index cb4b1d8e4a03..83fc73aa2b9c 100644 --- a/connectivity/source/inc/dbase/DStatement.hxx +++ b/connectivity/source/inc/dbase/DStatement.hxx @@ -22,16 +22,16 @@ #include <file/FStatement.hxx> namespace connectivity::dbase +{ + class OConnection; + class ODbaseStatement : public file::OStatement { - class OConnection; - class ODbaseStatement : public file::OStatement - { - protected: - virtual rtl::Reference<file::OResultSet> createResultSet() override; - public: - ODbaseStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; + protected: + virtual rtl::Reference<file::OResultSet> createResultSet() override; + public: + ODbaseStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index bb0b6baa5fa2..ea7d8e8a6626 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -25,166 +25,166 @@ namespace connectivity::dbase - { - typedef file::OFileTable ODbaseTable_BASE; - class ODbaseConnection; +{ + typedef file::OFileTable ODbaseTable_BASE; + class ODbaseConnection; - class ODbaseTable : public ODbaseTable_BASE + class ODbaseTable : public ODbaseTable_BASE + { + // The first byte of a dBase file specifies its type + public: + enum DBFType { dBaseIII = 0x03, + dBaseIV = 0x04, + dBaseV = 0x05, + VisualFoxPro = 0x30, + VisualFoxProAuto = 0x31, // Visual FoxPro with AutoIncrement field + dBaseFS = 0x43, + dBaseFSMemo = 0xB3, + dBaseIIIMemo = 0x83, + dBaseIVMemo = 0x8B, + dBaseIVMemoSQL = 0x8E, + FoxProMemo = 0xF5 + }; + enum DBFMemoType { MemodBaseIII = 0, + MemodBaseIV, + MemoFoxPro + }; + + private: + // sources: https://www.clicketyclick.dk/databases/xbase/format/dbf.html (dBASE III and 5) + // http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm (dBASE 7) which is similar at least for this part + struct DBFHeader { // address/pos in trailer + DBFType type; // dBASE/xBASE type, see DBFType 00h + sal_uInt8 dateElems[3]; // Date of last change (YYMMDD) 01h + sal_uInt32 nbRecords; // Number of records 04h + sal_uInt16 headerLength; // 08h + sal_uInt16 recordLength; // Length of 1 record 10h + sal_uInt8 trailer[20]; + // this last field contains these data: + // - reserved:2 bytes:should be filled with 0 12h/0 + // - incomplete transaction:1 byte:dBASE IV 14h/2 + // 00h Transaction ended (or rolled back) + // 01h Transaction started + // - encryptionFlag:1 byte: dBASE IV 15h/3 + // 00h not encrypted + // 01h for encrypted + // - freeRecordThread:4 bytes:reserved for LAN only 16h/4 + // - multiUserdBASE:8 bytes:reserved for multi-user dBASE (dBASE III+) 20h/8 + // - MDXFlag:1 byte:dBASE IV 28h/16 + // 0x01 if a production .MDX file exists for this table + // 0x00 if no .MDX file exists + // - languageDriver:1 byte:codepage (from Foxpro) 29h/17 + // - reserved:2 bytes: should be filled with 0 30h/18 + }; + struct DBFColumn { /* Column descriptors */ + sal_uInt8 db_fnm[11]; /* Field name */ + sal_uInt8 db_typ; /* Field type */ + sal_uInt32 db_adr; /* Field address */ + sal_uInt8 db_flng; /* Field length */ + sal_uInt8 db_dez; /* Decimal places for N */ + sal_uInt8 db_free2[14]; /* Reserved */ + }; + struct DBFMemoHeader { - // The first byte of a dBase file specifies its type - public: - enum DBFType { dBaseIII = 0x03, - dBaseIV = 0x04, - dBaseV = 0x05, - VisualFoxPro = 0x30, - VisualFoxProAuto = 0x31, // Visual FoxPro with AutoIncrement field - dBaseFS = 0x43, - dBaseFSMemo = 0xB3, - dBaseIIIMemo = 0x83, - dBaseIVMemo = 0x8B, - dBaseIVMemoSQL = 0x8E, - FoxProMemo = 0xF5 - }; - enum DBFMemoType { MemodBaseIII = 0, - MemodBaseIV, - MemoFoxPro - }; - - private: - // sources: https://www.clicketyclick.dk/databases/xbase/format/dbf.html (dBASE III and 5) - // http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm (dBASE 7) which is similar at least for this part - struct DBFHeader { // address/pos in trailer - DBFType type; // dBASE/xBASE type, see DBFType 00h - sal_uInt8 dateElems[3]; // Date of last change (YYMMDD) 01h - sal_uInt32 nbRecords; // Number of records 04h - sal_uInt16 headerLength; // 08h - sal_uInt16 recordLength; // Length of 1 record 10h - sal_uInt8 trailer[20]; - // this last field contains these data: - // - reserved:2 bytes:should be filled with 0 12h/0 - // - incomplete transaction:1 byte:dBASE IV 14h/2 - // 00h Transaction ended (or rolled back) - // 01h Transaction started - // - encryptionFlag:1 byte: dBASE IV 15h/3 - // 00h not encrypted - // 01h for encrypted - // - freeRecordThread:4 bytes:reserved for LAN only 16h/4 - // - multiUserdBASE:8 bytes:reserved for multi-user dBASE (dBASE III+) 20h/8 - // - MDXFlag:1 byte:dBASE IV 28h/16 - // 0x01 if a production .MDX file exists for this table - // 0x00 if no .MDX file exists - // - languageDriver:1 byte:codepage (from Foxpro) 29h/17 - // - reserved:2 bytes: should be filled with 0 30h/18 - }; - struct DBFColumn { /* Column descriptors */ - sal_uInt8 db_fnm[11]; /* Field name */ - sal_uInt8 db_typ; /* Field type */ - sal_uInt32 db_adr; /* Field address */ - sal_uInt8 db_flng; /* Field length */ - sal_uInt8 db_dez; /* Decimal places for N */ - sal_uInt8 db_free2[14]; /* Reserved */ - }; - struct DBFMemoHeader + DBFMemoType db_typ; /* File type */ + sal_uInt32 db_next; /* Next free block */ + sal_uInt16 db_size; /* Block size: dBase 3 fixed */ + DBFMemoHeader() + : db_typ(MemodBaseIII) + , db_next(0) + , db_size(0) { - DBFMemoType db_typ; /* File type */ - sal_uInt32 db_next; /* Next free block */ - sal_uInt16 db_size; /* Block size: dBase 3 fixed */ - DBFMemoHeader() - : db_typ(MemodBaseIII) - , db_next(0) - , db_size(0) - { - } - }; - - std::vector<sal_Int32> m_aTypes; // holds all types for columns just to avoid to ask the propertyset - std::vector<sal_Int32> m_aPrecisions; // same as above - std::vector<sal_Int32> m_aScales; - std::vector<sal_Int32> m_aRealFieldLengths; - DBFHeader m_aHeader = {}; - DBFMemoHeader m_aMemoHeader; - std::unique_ptr<SvStream> m_pMemoStream; - rtl_TextEncoding m_eEncoding; - - void alterColumn(sal_Int32 index, - const css::uno::Reference< css::beans::XPropertySet>& descriptor , - const css::uno::Reference< css::sdbcx::XDataDescriptorFactory>& xOldColumn ); - void readHeader(); - void fillColumns(); - OUString createTempFile(); - void copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos); - bool CreateFile(const INetURLObject& aFile, bool& bCreateMemo); - bool CreateMemoFile(const INetURLObject& aFile); - bool HasMemoFields() const; - void ReadMemoHeader(); - bool ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable); - - void WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr); - bool WriteBuffer(); - bool UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols, bool bForceAllFields); - css::uno::Reference< css::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos); - bool AllocBuffer(); - - void throwInvalidDbaseFormat(); - /// @throws css::sdbc::SQLException - /// @throws css::container::ElementExistException - /// @throws css::uno::RuntimeException - void renameImpl( const OUString& newName ); - void throwInvalidColumnType(TranslateId pErrorId, const OUString& _sColumnName); - - protected: - virtual void FileClose() override; + } + }; + + std::vector<sal_Int32> m_aTypes; // holds all types for columns just to avoid to ask the propertyset + std::vector<sal_Int32> m_aPrecisions; // same as above + std::vector<sal_Int32> m_aScales; + std::vector<sal_Int32> m_aRealFieldLengths; + DBFHeader m_aHeader = {}; + DBFMemoHeader m_aMemoHeader; + std::unique_ptr<SvStream> m_pMemoStream; + rtl_TextEncoding m_eEncoding; + + void alterColumn(sal_Int32 index, + const css::uno::Reference< css::beans::XPropertySet>& descriptor , + const css::uno::Reference< css::sdbcx::XDataDescriptorFactory>& xOldColumn ); + void readHeader(); + void fillColumns(); + OUString createTempFile(); + void copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos); + bool CreateFile(const INetURLObject& aFile, bool& bCreateMemo); + bool CreateMemoFile(const INetURLObject& aFile); + bool HasMemoFields() const; + void ReadMemoHeader(); + bool ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable); + + void WriteMemo(const ORowSetValue& aVariable, std::size_t& rBlockNr); + bool WriteBuffer(); + bool UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols, bool bForceAllFields); + css::uno::Reference< css::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos); + bool AllocBuffer(); + + void throwInvalidDbaseFormat(); + /// @throws css::sdbc::SQLException + /// @throws css::container::ElementExistException + /// @throws css::uno::RuntimeException + void renameImpl( const OUString& newName ); + void throwInvalidColumnType(TranslateId pErrorId, const OUString& _sColumnName); + + protected: + virtual void FileClose() override; // using ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper; - public: - virtual void refreshColumns() override; - virtual void refreshIndexes() override; + public: + virtual void refreshColumns() override; + virtual void refreshIndexes() override; - public: - ODbaseTable( sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection); - ODbaseTable( sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description = OUString(), - const OUString& SchemaName = OUString(), - const OUString& CatalogName = OUString() - ); + public: + ODbaseTable( sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection); + ODbaseTable( sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description = OUString(), + const OUString& SchemaName = OUString(), + const OUString& CatalogName = OUString() + ); - void construct() override; // can throw any exception + void construct() override; // can throw any exception - virtual sal_Int32 getCurrentLastPos() const override; - virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override; - virtual bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, bool bRetrieveData) override; + virtual sal_Int32 getCurrentLastPos() const override; + virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override; + virtual bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, bool bRetrieveData) override; - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - virtual void SAL_CALL disposing() override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual void SAL_CALL disposing() override; - // XAlterTable - virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - // XRename - virtual void SAL_CALL rename( const OUString& newName ) override; + // XAlterTable + virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + // XRename + virtual void SAL_CALL rename( const OUString& newName ) override; - bool DropImpl(); - bool CreateImpl(); + bool DropImpl(); + bool CreateImpl(); - virtual bool InsertRow(OValueRefVector& rRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols) override; - virtual bool DeleteRow(const OSQLColumns& _rCols) override; - virtual bool UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const css::uno::Reference< css::container::XIndexAccess>& _xCols) override; + virtual bool InsertRow(OValueRefVector& rRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols) override; + virtual bool DeleteRow(const OSQLColumns& _rCols) override; + virtual bool UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const css::uno::Reference< css::container::XIndexAccess>& _xCols) override; - virtual void addColumn(const css::uno::Reference< css::beans::XPropertySet>& descriptor) override; - virtual void dropColumn(sal_Int32 _nPos) override; + virtual void addColumn(const css::uno::Reference< css::beans::XPropertySet>& descriptor) override; + virtual void dropColumn(sal_Int32 _nPos) override; - static OUString getEntry(file::OConnection const * _pConnection, std::u16string_view _sURL ); - static bool Drop_Static(std::u16string_view _sUrl, bool _bHasMemoFields, sdbcx::OCollection* _pIndexes ); + static OUString getEntry(file::OConnection const * _pConnection, std::u16string_view _sURL ); + static bool Drop_Static(std::u16string_view _sUrl, bool _bHasMemoFields, sdbcx::OCollection* _pIndexes ); - virtual void refreshHeader() override; + virtual void refreshHeader() override; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const override; - }; + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const override; + }; } diff --git a/connectivity/source/inc/dbase/DTables.hxx b/connectivity/source/inc/dbase/DTables.hxx index 058ea0802f4a..f364a3d9dd83 100644 --- a/connectivity/source/inc/dbase/DTables.hxx +++ b/connectivity/source/inc/dbase/DTables.hxx @@ -22,24 +22,24 @@ #include <file/FTables.hxx> namespace connectivity::dbase - { - typedef file::OTables ODbaseTables_BASE; +{ + typedef file::OTables ODbaseTables_BASE; - class ODbaseTables : public ODbaseTables_BASE - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; - public: - ODbaseTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : ODbaseTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) - {} + class ODbaseTables : public ODbaseTables_BASE + { + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; + public: + ODbaseTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : ODbaseTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) + {} - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - }; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + }; } diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx index c1db23f76b60..181c6ff74322 100644 --- a/connectivity/source/inc/dbase/dindexnode.hxx +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -28,277 +28,277 @@ class SvStream; namespace connectivity::dbase +{ + + class ONDXNode; + class ODbaseIndex; + + // Index Key + + typedef file::OOperand ONDXKey_BASE; + class ONDXKey : public ONDXKey_BASE { + friend class ONDXNode; + sal_uInt32 nRecord; /* Record pointer */ + ORowSetValue xValue; /* Key values */ + + public: + ONDXKey(); + ONDXKey(ORowSetValue aVal, sal_Int32 eType, sal_uInt32 nRec); + ONDXKey(const OUString& aStr, sal_uInt32 nRec); + ONDXKey(double aVal, sal_uInt32 nRec); + + inline ONDXKey(const ONDXKey& rKey); + + inline ONDXKey& operator= (const ONDXKey& rKey); + virtual void setValue(const ORowSetValue& _rVal) override; + + virtual const ORowSetValue& getValue() const override; + + sal_uInt32 GetRecord() const { return nRecord; } + void setRecord(sal_uInt32 _nRec) { nRecord = _nRec; } + void ResetRecord() { nRecord = 0; } + + bool operator == (const ONDXKey& rKey) const; + bool operator != (const ONDXKey& rKey) const; + bool operator < (const ONDXKey& rKey) const; + bool operator <= (const ONDXKey& rKey) const; + bool operator > (const ONDXKey& rKey) const; + + static bool IsText(sal_Int32 eType); - class ONDXNode; - class ODbaseIndex; - - // Index Key - - typedef file::OOperand ONDXKey_BASE; - class ONDXKey : public ONDXKey_BASE - { - friend class ONDXNode; - sal_uInt32 nRecord; /* Record pointer */ - ORowSetValue xValue; /* Key values */ - - public: - ONDXKey(); - ONDXKey(ORowSetValue aVal, sal_Int32 eType, sal_uInt32 nRec); - ONDXKey(const OUString& aStr, sal_uInt32 nRec); - ONDXKey(double aVal, sal_uInt32 nRec); - - inline ONDXKey(const ONDXKey& rKey); - - inline ONDXKey& operator= (const ONDXKey& rKey); - virtual void setValue(const ORowSetValue& _rVal) override; - - virtual const ORowSetValue& getValue() const override; - - sal_uInt32 GetRecord() const { return nRecord; } - void setRecord(sal_uInt32 _nRec) { nRecord = _nRec; } - void ResetRecord() { nRecord = 0; } - - bool operator == (const ONDXKey& rKey) const; - bool operator != (const ONDXKey& rKey) const; - bool operator < (const ONDXKey& rKey) const; - bool operator <= (const ONDXKey& rKey) const; - bool operator > (const ONDXKey& rKey) const; - - static bool IsText(sal_Int32 eType); - - private: - int Compare(const ONDXKey& rKey) const; - }; - - - class ONDXPage; - - // Index Page Pointer - // This is ref-count pointer class - class ONDXPagePtr - { - friend SvStream& WriteONDXPagePtr(SvStream &rStream, const ONDXPagePtr&); - friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); - - ONDXPage* mpPage; - sal_uInt32 nPagePos; // Position in the index file - - public: - ONDXPagePtr(); - ONDXPagePtr(ONDXPagePtr&& rObj) noexcept; - ONDXPagePtr(ONDXPagePtr const & rRef); - ONDXPagePtr(ONDXPage* pRefPage); - ~ONDXPagePtr(); - void Clear(); - ONDXPagePtr& operator=(ONDXPagePtr const & rRef); - ONDXPagePtr& operator=(ONDXPagePtr && rRef); - bool Is() const { return mpPage != nullptr; } - - ONDXPage * operator ->() const { assert(mpPage != nullptr); return mpPage; } - operator ONDXPage *() const { return mpPage; } - - sal_uInt32 GetPagePos() const {return nPagePos;} - bool HasPage() const {return nPagePos != 0;} - }; - - // Index Page - // This is a ref-counted class, with re-cycling - class ONDXPage - { - friend class ODbaseIndex; - friend class ONDXPagePtr; - - friend SvStream& WriteONDXPage(SvStream &rStream, const ONDXPage&); - friend SvStream& operator >> (SvStream &rStream, ONDXPage&); - - // work around a clang 3.5 optimization bug: if the bNoDelete is *first* - // it mis-compiles "if (--nRefCount == 0)" and never deletes any object - unsigned int nRefCount : 31; - // the only reason this is not bool is because MSVC cannot handle mixed type bitfields - unsigned int bNoDelete : 1; - sal_uInt32 nPagePos; // Position in the index file - bool bModified : 1; - sal_uInt16 nCount; - - ONDXPagePtr aParent, // Parent page - aChild; // Pointer to the right child page - ODbaseIndex& rIndex; - std::unique_ptr<ONDXNode[]> - ppNodes; // Array of nodes - - public: - // Node operations - sal_uInt16 Count() const {return nCount;} - - bool Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft = 0); - bool Insert(sal_uInt16 nIndex, ONDXNode& rNode); - bool Append(ONDXNode& rNode); - void Delete(sal_uInt16); - void Remove(sal_uInt16); - void Release(bool bSave = true); - void ReleaseFull(); - - // Split and merge - ONDXNode Split(ONDXPage& rPage); - void Merge(sal_uInt16 nParentNodePos, const ONDXPagePtr& xPage); - - // Access operators - ONDXNode& operator[] (sal_uInt16 nPos); - const ONDXNode& operator[] (sal_uInt16 nPos) const; - - bool IsRoot() const; - bool IsLeaf() const; - bool IsModified() const; - bool HasParent() const; - - bool IsFull() const; - - sal_uInt32 GetPagePos() const {return nPagePos;} - ONDXPagePtr& GetChild(ODbaseIndex const * pIndex = nullptr); - - // Parent does not need to be reloaded - const ONDXPagePtr& GetParent() const; - ODbaseIndex& GetIndex() {return rIndex;} - const ODbaseIndex& GetIndex() const {return rIndex;} - - // Setting the child, via reference to retain the PagePos - void SetChild(const ONDXPagePtr& rCh); - void SetParent(const ONDXPagePtr& rPa); - - sal_uInt16 Search(const ONDXKey& rSearch); - sal_uInt16 Search(const ONDXPage* pPage); - void SearchAndReplace(const ONDXKey& rSearch, ONDXKey const & rReplace); - - protected: - ONDXPage(ODbaseIndex& rIndex, sal_uInt32 nPos, ONDXPage*); - ~ONDXPage(); - - void ReleaseRef(); - void QueryDelete(); - void AddNextRef() - { - assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" ); - ++nRefCount; - } - void AddFirstRef() - { - assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" ); - if( bNoDelete ) - bNoDelete = 0; - ++nRefCount; - } - - void SetModified(bool bMod) {bModified = bMod;} - void SetPagePos(sal_uInt32 nPage) {nPagePos = nPage;} - - bool Find(const ONDXKey&); // Descend recursively - sal_uInt16 FindPos(const ONDXKey& rKey) const; + private: + int Compare(const ONDXKey& rKey) const; + }; + + + class ONDXPage; + + // Index Page Pointer + // This is ref-count pointer class + class ONDXPagePtr + { + friend SvStream& WriteONDXPagePtr(SvStream &rStream, const ONDXPagePtr&); + friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + ONDXPage* mpPage; + sal_uInt32 nPagePos; // Position in the index file + + public: + ONDXPagePtr(); + ONDXPagePtr(ONDXPagePtr&& rObj) noexcept; + ONDXPagePtr(ONDXPagePtr const & rRef); + ONDXPagePtr(ONDXPage* pRefPage); + ~ONDXPagePtr(); + void Clear(); + ONDXPagePtr& operator=(ONDXPagePtr const & rRef); + ONDXPagePtr& operator=(ONDXPagePtr && rRef); + bool Is() const { return mpPage != nullptr; } + + ONDXPage * operator ->() const { assert(mpPage != nullptr); return mpPage; } + operator ONDXPage *() const { return mpPage; } + + sal_uInt32 GetPagePos() const {return nPagePos;} + bool HasPage() const {return nPagePos != 0;} + }; + + // Index Page + // This is a ref-counted class, with re-cycling + class ONDXPage + { + friend class ODbaseIndex; + friend class ONDXPagePtr; + + friend SvStream& WriteONDXPage(SvStream &rStream, const ONDXPage&); + friend SvStream& operator >> (SvStream &rStream, ONDXPage&); + + // work around a clang 3.5 optimization bug: if the bNoDelete is *first* + // it mis-compiles "if (--nRefCount == 0)" and never deletes any object + unsigned int nRefCount : 31; + // the only reason this is not bool is because MSVC cannot handle mixed type bitfields + unsigned int bNoDelete : 1; + sal_uInt32 nPagePos; // Position in the index file + bool bModified : 1; + sal_uInt16 nCount; + + ONDXPagePtr aParent, // Parent page + aChild; // Pointer to the right child page + ODbaseIndex& rIndex; + std::unique_ptr<ONDXNode[]> + ppNodes; // Array of nodes + + public: + // Node operations + sal_uInt16 Count() const {return nCount;} + + bool Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft = 0); + bool Insert(sal_uInt16 nIndex, ONDXNode& rNode); + bool Append(ONDXNode& rNode); + void Delete(sal_uInt16); + void Remove(sal_uInt16); + void Release(bool bSave = true); + void ReleaseFull(); + + // Split and merge + ONDXNode Split(ONDXPage& rPage); + void Merge(sal_uInt16 nParentNodePos, const ONDXPagePtr& xPage); + + // Access operators + ONDXNode& operator[] (sal_uInt16 nPos); + const ONDXNode& operator[] (sal_uInt16 nPos) const; + + bool IsRoot() const; + bool IsLeaf() const; + bool IsModified() const; + bool HasParent() const; + + bool IsFull() const; + + sal_uInt32 GetPagePos() const {return nPagePos;} + ONDXPagePtr& GetChild(ODbaseIndex const * pIndex = nullptr); + + // Parent does not need to be reloaded + const ONDXPagePtr& GetParent() const; + ODbaseIndex& GetIndex() {return rIndex;} + const ODbaseIndex& GetIndex() const {return rIndex;} + + // Setting the child, via reference to retain the PagePos + void SetChild(const ONDXPagePtr& rCh); + void SetParent(const ONDXPagePtr& rPa); + + sal_uInt16 Search(const ONDXKey& rSearch); + sal_uInt16 Search(const ONDXPage* pPage); + void SearchAndReplace(const ONDXKey& rSearch, ONDXKey const & rReplace); + + protected: + ONDXPage(ODbaseIndex& rIndex, sal_uInt32 nPos, ONDXPage*); + ~ONDXPage(); + + void ReleaseRef(); + void QueryDelete(); + void AddNextRef() + { + assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" ); + ++nRefCount; + } + void AddFirstRef() + { + assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" ); + if( bNoDelete ) + bNoDelete = 0; + ++nRefCount; + } + + void SetModified(bool bMod) {bModified = bMod;} + void SetPagePos(sal_uInt32 nPage) {nPagePos = nPage;} + + bool Find(const ONDXKey&); // Descend recursively + sal_uInt16 FindPos(const ONDXKey& rKey) const; #if OSL_DEBUG_LEVEL > 1 - void PrintPage(); + void PrintPage(); #endif - }; - - SvStream& WriteONDXPagePtr(SvStream &rStream, const ONDXPagePtr&); - SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); - - inline bool ONDXPage::IsRoot() const {return !aParent.Is();} - inline bool ONDXPage::IsLeaf() const {return !aChild.HasPage();} - inline bool ONDXPage::IsModified() const {return bModified;} - inline bool ONDXPage::HasParent() const {return aParent.Is();} - inline const ONDXPagePtr& ONDXPage::GetParent() const {return aParent;} - - inline void ONDXPage::SetParent(const ONDXPagePtr& rPa = ONDXPagePtr()) - { - aParent = rPa; - } - - inline void ONDXPage::SetChild(const ONDXPagePtr& rCh = ONDXPagePtr()) - { - aChild = rCh; - if (aChild.Is()) - aChild->SetParent(this); - } - SvStream& operator >> (SvStream &rStream, ONDXPage& rPage); - SvStream& WriteONDXPage(SvStream &rStream, const ONDXPage& rPage); - - - // Index Node - - class ONDXNode - { - friend class ONDXPage; - ONDXPagePtr aChild; /* Next page reference */ - ONDXKey aKey; - - public: - ONDXNode(){} - ONDXNode(const ONDXKey& rKey) - :aKey(rKey) {} - - // Does the node point to a page? - bool HasChild() const {return aChild.HasPage();} - // If an index is provided, we may be able to retrieve the page - ONDXPagePtr& GetChild(ODbaseIndex* pIndex = nullptr, ONDXPage* = nullptr); - - const ONDXKey& GetKey() const { return aKey;} - ONDXKey& GetKey() { return aKey;} - - // Setting the child, via reference to retain the PagePos - void SetChild(const ONDXPagePtr& rCh = ONDXPagePtr(), ONDXPage* = nullptr); - - void Write(SvStream &rStream, const ONDXPage& rPage) const; - void Read(SvStream &rStream, ODbaseIndex const &); - }; - - inline ONDXKey::ONDXKey(const ONDXKey& rKey) - : ONDXKey_BASE(rKey.getDBType()) - ,nRecord(rKey.nRecord) - ,xValue(rKey.xValue) - { - } - - inline ONDXKey& ONDXKey::operator=(const ONDXKey& rKey) - { - if(&rKey == this) - return *this; - - xValue = rKey.xValue; - nRecord = rKey.nRecord; - m_eDBType = rKey.getDBType(); + }; + + SvStream& WriteONDXPagePtr(SvStream &rStream, const ONDXPagePtr&); + SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + inline bool ONDXPage::IsRoot() const {return !aParent.Is();} + inline bool ONDXPage::IsLeaf() const {return !aChild.HasPage();} + inline bool ONDXPage::IsModified() const {return bModified;} + inline bool ONDXPage::HasParent() const {return aParent.Is();} + inline const ONDXPagePtr& ONDXPage::GetParent() const {return aParent;} + + inline void ONDXPage::SetParent(const ONDXPagePtr& rPa = ONDXPagePtr()) + { + aParent = rPa; + } + + inline void ONDXPage::SetChild(const ONDXPagePtr& rCh = ONDXPagePtr()) + { + aChild = rCh; + if (aChild.Is()) + aChild->SetParent(this); + } + SvStream& operator >> (SvStream &rStream, ONDXPage& rPage); + SvStream& WriteONDXPage(SvStream &rStream, const ONDXPage& rPage); + + + // Index Node + + class ONDXNode + { + friend class ONDXPage; + ONDXPagePtr aChild; /* Next page reference */ + ONDXKey aKey; + + public: + ONDXNode(){} + ONDXNode(const ONDXKey& rKey) + :aKey(rKey) {} + + // Does the node point to a page? + bool HasChild() const {return aChild.HasPage();} + // If an index is provided, we may be able to retrieve the page + ONDXPagePtr& GetChild(ODbaseIndex* pIndex = nullptr, ONDXPage* = nullptr); + + const ONDXKey& GetKey() const { return aKey;} + ONDXKey& GetKey() { return aKey;} + + // Setting the child, via reference to retain the PagePos + void SetChild(const ONDXPagePtr& rCh = ONDXPagePtr(), ONDXPage* = nullptr); + + void Write(SvStream &rStream, const ONDXPage& rPage) const; + void Read(SvStream &rStream, ODbaseIndex const &); + }; + + inline ONDXKey::ONDXKey(const ONDXKey& rKey) + : ONDXKey_BASE(rKey.getDBType()) + ,nRecord(rKey.nRecord) + ,xValue(rKey.xValue) + { + } + + inline ONDXKey& ONDXKey::operator=(const ONDXKey& rKey) + { + if(&rKey == this) return *this; - } - - inline bool ONDXKey::operator == (const ONDXKey& rKey) const - { - if(&rKey == this) - return true; - return Compare(rKey) == 0; - } - inline bool ONDXKey::operator != (const ONDXKey& rKey) const - { - return !operator== (rKey); - } - inline bool ONDXKey::operator < (const ONDXKey& rKey) const - { - return Compare(rKey) < 0; - } - inline bool ONDXKey::operator > (const ONDXKey& rKey) const - { - return Compare(rKey) > 0; - } - inline bool ONDXKey::operator <= (const ONDXKey& rKey) const - { - return !operator > (rKey); - } - - inline void ONDXNode::SetChild(const ONDXPagePtr& rCh, ONDXPage* pParent) - { - aChild = rCh; - if (aChild.Is()) - aChild->SetParent(pParent); - } + + xValue = rKey.xValue; + nRecord = rKey.nRecord; + m_eDBType = rKey.getDBType(); + return *this; + } + + inline bool ONDXKey::operator == (const ONDXKey& rKey) const + { + if(&rKey == this) + return true; + return Compare(rKey) == 0; + } + inline bool ONDXKey::operator != (const ONDXKey& rKey) const + { + return !operator== (rKey); + } + inline bool ONDXKey::operator < (const ONDXKey& rKey) const + { + return Compare(rKey) < 0; + } + inline bool ONDXKey::operator > (const ONDXKey& rKey) const + { + return Compare(rKey) > 0; + } + inline bool ONDXKey::operator <= (const ONDXKey& rKey) const + { + return !operator > (rKey); + } + + inline void ONDXNode::SetChild(const ONDXPagePtr& rCh, ONDXPage* pParent) + { + aChild = rCh; + if (aChild.Is()) + aChild->SetParent(pParent); + } } diff --git a/connectivity/source/inc/file/FCatalog.hxx b/connectivity/source/inc/file/FCatalog.hxx index 2bcf82df2a57..84d3a36226e3 100644 --- a/connectivity/source/inc/file/FCatalog.hxx +++ b/connectivity/source/inc/file/FCatalog.hxx @@ -24,36 +24,36 @@ #include <file/filedllapi.hxx> namespace connectivity::file +{ + class OConnection; + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OFileCatalog : + public connectivity::sdbcx::OCatalog { - class OConnection; - class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OFileCatalog : - public connectivity::sdbcx::OCatalog - { - protected: - OConnection* m_pConnection; - - /** builds the name which should be used to access the object later on in the collection. - Will only be called in fillNames. - @param _xRow - The current row from the resultset given to fillNames. - */ - virtual OUString buildName( const css::uno::Reference< css::sdbc::XRow >& _xRow) override; - - public: - virtual void refreshTables() override; - virtual void refreshViews() override; - virtual void refreshGroups() override; - virtual void refreshUsers() override; - - public: - OFileCatalog(OConnection* _pCon); - OConnection* getConnection() { return m_pConnection; } - - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - // ::cppu::OComponentHelper - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - virtual void SAL_CALL disposing() override; - }; + protected: + OConnection* m_pConnection; + + /** builds the name which should be used to access the object later on in the collection. + Will only be called in fillNames. + @param _xRow + The current row from the resultset given to fillNames. + */ + virtual OUString buildName( const css::uno::Reference< css::sdbc::XRow >& _xRow) override; + + public: + virtual void refreshTables() override; + virtual void refreshViews() override; + virtual void refreshGroups() override; + virtual void refreshUsers() override; + + public: + OFileCatalog(OConnection* _pCon); + OConnection* getConnection() { return m_pConnection; } + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + // ::cppu::OComponentHelper + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual void SAL_CALL disposing() override; + }; } diff --git a/connectivity/source/inc/file/FColumns.hxx b/connectivity/source/inc/file/FColumns.hxx index b3710e3083cc..3e45c265af7d 100644 --- a/connectivity/source/inc/file/FColumns.hxx +++ b/connectivity/source/inc/file/FColumns.hxx @@ -25,22 +25,22 @@ #include <file/filedllapi.hxx> namespace connectivity::file +{ + class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OColumns : public sdbcx::OCollection { - class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OColumns : public sdbcx::OCollection - { - protected: - OFileTable* m_pTable; + protected: + OFileTable* m_pTable; - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - public: - OColumns( OFileTable* _pTable, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector - ) : sdbcx::OCollection(*_pTable,_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) - ,m_pTable(_pTable) - {} - }; + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + public: + OColumns( OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector + ) : sdbcx::OCollection(*_pTable,_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + ,m_pTable(_pTable) + {} + }; } diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx index 344445e9d322..210d2314f2b8 100644 --- a/connectivity/source/inc/file/FConnection.hxx +++ b/connectivity/source/inc/file/FConnection.hxx @@ -31,104 +31,104 @@ namespace connectivity::sdbcx { class OCatalog; } namespace connectivity::file - { - class ODatabaseMetaData; - class OFileDriver; +{ + class ODatabaseMetaData; + class OFileDriver; - class OOO_DLLPUBLIC_FILE OConnection : public connectivity::OMetaConnection + class OOO_DLLPUBLIC_FILE OConnection : public connectivity::OMetaConnection + { + protected: + + // Data attributes + + unotools::WeakReference< ::connectivity::sdbcx::OCatalog > m_xCatalog; + + OUString m_aFilenameExtension; + OFileDriver* m_pDriver; // Pointer to the owning + // driver object + css::uno::Reference< css::ucb::XDynamicResultSet > m_xDir; // directory + css::uno::Reference< css::ucb::XContent> m_xContent; + + bool m_bAutoCommit; + bool m_bReadOnly; + bool m_bShowDeleted; + bool m_bCaseSensitiveExtension; + bool m_bCheckSQL92; + bool m_bDefaultTextEncoding; + + + void throwUrlNotValid(const OUString & _rsUrl,const OUString & _rsMessage); + + virtual ~OConnection() override; + public: + + OConnection(OFileDriver* _pDriver); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + /// @throws css::uno::DeploymentException + virtual void construct(const OUString& _rUrl, const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ); + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; + virtual sal_Bool SAL_CALL getAutoCommit( ) override; + virtual void SAL_CALL commit( ) override; + virtual void SAL_CALL rollback( ) override; + virtual sal_Bool SAL_CALL isClosed( ) override final; + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual void SAL_CALL setCatalog( const OUString& catalog ) override; + virtual OUString SAL_CALL getCatalog( ) override; + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; + virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + // XCloseable + virtual void SAL_CALL close( ) override final; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + // no interface methods + css::uno::Reference< css::ucb::XDynamicResultSet > getDir() const; + const css::uno::Reference< css::ucb::XContent>& getContent() const { return m_xContent; } + // create a catalog or return the catalog already created + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); + + bool matchesExtension( const OUString& _rExt ) const; + + const OUString& getExtension() const { return m_aFilenameExtension; } + bool isCaseSensitiveExtension() const { return m_bCaseSensitiveExtension; } + OFileDriver* getDriver() const { return m_pDriver; } + bool showDeleted() const { return m_bShowDeleted; } + bool isCheckEnabled() const { return m_bCheckSQL92; } + bool isTextEncodingDefaulted() const { return m_bDefaultTextEncoding; } + + public: + struct GrantAccess { - protected: - - // Data attributes - - unotools::WeakReference< ::connectivity::sdbcx::OCatalog > m_xCatalog; - - OUString m_aFilenameExtension; - OFileDriver* m_pDriver; // Pointer to the owning - // driver object - css::uno::Reference< css::ucb::XDynamicResultSet > m_xDir; // directory - css::uno::Reference< css::ucb::XContent> m_xContent; - - bool m_bAutoCommit; - bool m_bReadOnly; - bool m_bShowDeleted; - bool m_bCaseSensitiveExtension; - bool m_bCheckSQL92; - bool m_bDefaultTextEncoding; - - - void throwUrlNotValid(const OUString & _rsUrl,const OUString & _rsMessage); - - virtual ~OConnection() override; - public: - - OConnection(OFileDriver* _pDriver); - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - /// @throws css::uno::DeploymentException - virtual void construct(const OUString& _rUrl, const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ); - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XServiceInfo - DECLARE_SERVICE_INFO(); - - // XConnection - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; - virtual sal_Bool SAL_CALL getAutoCommit( ) override; - virtual void SAL_CALL commit( ) override; - virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override final; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual void SAL_CALL setCatalog( const OUString& catalog ) override; - virtual OUString SAL_CALL getCatalog( ) override; - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; - virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - // XCloseable - virtual void SAL_CALL close( ) override final; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - - // no interface methods - css::uno::Reference< css::ucb::XDynamicResultSet > getDir() const; - const css::uno::Reference< css::ucb::XContent>& getContent() const { return m_xContent; } - // create a catalog or return the catalog already created - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); - - bool matchesExtension( const OUString& _rExt ) const; - - const OUString& getExtension() const { return m_aFilenameExtension; } - bool isCaseSensitiveExtension() const { return m_bCaseSensitiveExtension; } - OFileDriver* getDriver() const { return m_pDriver; } - bool showDeleted() const { return m_bShowDeleted; } - bool isCheckEnabled() const { return m_bCheckSQL92; } - bool isTextEncodingDefaulted() const { return m_bDefaultTextEncoding; } - - public: - struct GrantAccess - { - friend class ODatabaseMetaData; - private: - GrantAccess() { } - }; - - void setCaseSensitiveExtension( bool _bIsCS, GrantAccess ) { m_bCaseSensitiveExtension = _bIsCS; } + friend class ODatabaseMetaData; + private: + GrantAccess() { } }; + void setCaseSensitiveExtension( bool _bIsCS, GrantAccess ) { m_bCaseSensitiveExtension = _bIsCS; } + }; + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/file/FDatabaseMetaData.hxx b/connectivity/source/inc/file/FDatabaseMetaData.hxx index 5c766c31d1f4..0dcce0f0cb34 100644 --- a/connectivity/source/inc/file/FDatabaseMetaData.hxx +++ b/connectivity/source/inc/file/FDatabaseMetaData.hxx @@ -24,162 +24,162 @@ #include <file/filedllapi.hxx> namespace connectivity::file - { +{ - //************ Class: ODatabaseMetaData + //************ Class: ODatabaseMetaData - class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE ODatabaseMetaData : - public ODatabaseMetaDataBase - { - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - // cached database information - virtual OUString impl_getIdentifierQuoteString_throw( ) override; - virtual bool impl_isCatalogAtStart_throw( ) override; - virtual OUString impl_getCatalogSeparator_throw( ) override; - virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; - virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ; - virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; - virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ; - virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override; - virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; - virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; - virtual sal_Int32 impl_getMaxStatements_throw( ) override; - virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; - virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; - protected: - OConnection* m_pConnection; // I need the native class not only the interface - virtual ~ODatabaseMetaData() override; - public: + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE ODatabaseMetaData : + public ODatabaseMetaDataBase + { + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + // cached database information + virtual OUString impl_getIdentifierQuoteString_throw( ) override; + virtual bool impl_isCatalogAtStart_throw( ) override; + virtual OUString impl_getCatalogSeparator_throw( ) override; + virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; + virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ; + virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; + virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ; + virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override; + virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; + virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; + virtual sal_Int32 impl_getMaxStatements_throw( ) override; + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; + virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; + protected: + OConnection* m_pConnection; // I need the native class not only the interface + virtual ~ODatabaseMetaData() override; + public: - ODatabaseMetaData(OConnection* _pCon); - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual OUString SAL_CALL getUserName( ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; - virtual OUString SAL_CALL getDatabaseProductName( ) override; - virtual OUString SAL_CALL getDatabaseProductVersion( ) override; - virtual OUString SAL_CALL getDriverName( ) override; - virtual OUString SAL_CALL getDriverVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; - virtual sal_Bool SAL_CALL usesLocalFiles( ) override; - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; - virtual OUString SAL_CALL getSQLKeywords( ) override; - virtual OUString SAL_CALL getNumericFunctions( ) override; - virtual OUString SAL_CALL getStringFunctions( ) override; - virtual OUString SAL_CALL getSystemFunctions( ) override; - virtual OUString SAL_CALL getTimeDateFunctions( ) override; - virtual OUString SAL_CALL getSearchStringEscape( ) override; - virtual OUString SAL_CALL getExtraNameCharacters( ) override; - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; - virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupBy( ) override; - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; - virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; - virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; - virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; - virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; - virtual OUString SAL_CALL getSchemaTerm( ) override; - virtual OUString SAL_CALL getProcedureTerm( ) override; - virtual OUString SAL_CALL getCatalogTerm( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; - virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; - virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; - virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; - virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; - virtual sal_Bool SAL_CALL supportsUnion( ) override; - virtual sal_Bool SAL_CALL supportsUnionAll( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - virtual sal_Int32 SAL_CALL getMaxConnections( ) override; - virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; - virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; - virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; - virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; - virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; - virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; - virtual sal_Bool SAL_CALL supportsTransactions( ) override; - virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; - virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; - virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; - virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; - virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; + ODatabaseMetaData(OConnection* _pCon); + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual OUString SAL_CALL getUserName( ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; + virtual OUString SAL_CALL getDatabaseProductName( ) override; + virtual OUString SAL_CALL getDatabaseProductVersion( ) override; + virtual OUString SAL_CALL getDriverName( ) override; + virtual OUString SAL_CALL getDriverVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; + virtual sal_Bool SAL_CALL usesLocalFiles( ) override; + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; + virtual OUString SAL_CALL getSQLKeywords( ) override; + virtual OUString SAL_CALL getNumericFunctions( ) override; + virtual OUString SAL_CALL getStringFunctions( ) override; + virtual OUString SAL_CALL getSystemFunctions( ) override; + virtual OUString SAL_CALL getTimeDateFunctions( ) override; + virtual OUString SAL_CALL getSearchStringEscape( ) override; + virtual OUString SAL_CALL getExtraNameCharacters( ) override; + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; + virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupBy( ) override; + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; + virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; + virtual OUString SAL_CALL getSchemaTerm( ) override; + virtual OUString SAL_CALL getProcedureTerm( ) override; + virtual OUString SAL_CALL getCatalogTerm( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; + virtual sal_Bool SAL_CALL supportsUnion( ) override; + virtual sal_Bool SAL_CALL supportsUnionAll( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + virtual sal_Int32 SAL_CALL getMaxConnections( ) override; + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; + virtual sal_Bool SAL_CALL supportsTransactions( ) override; + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; - virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL supportsBatchUpdates( ) override; + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; + 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::XResultSet > SAL_CALL getUDTs( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const css::uno::Sequence< sal_Int32 >& types ) override; + }; } diff --git a/connectivity/source/inc/file/FDateFunctions.hxx b/connectivity/source/inc/file/FDateFunctions.hxx index e8eb12d0cf24..8451eb0fbf7f 100644 --- a/connectivity/source/inc/file/FDateFunctions.hxx +++ b/connectivity/source/inc/file/FDateFunctions.hxx @@ -22,206 +22,206 @@ #include <file/fcode.hxx> namespace connectivity::file +{ + /** DAYOFWEEK(date) + Returns the weekday index for date (1 = Sunday, 2 = Monday, ... 7 = Saturday). These index values correspond to the ODBC standard. + + > SELECT DAYOFWEEK('1998-02-03'); + -> 3 + */ + class OOp_DayOfWeek : public OUnaryOperator { - /** DAYOFWEEK(date) - Returns the weekday index for date (1 = Sunday, 2 = Monday, ... 7 = Saturday). These index values correspond to the ODBC standard. - - > SELECT DAYOFWEEK('1998-02-03'); - -> 3 - */ - class OOp_DayOfWeek : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** DAYOFMONTH(date) - Returns the day of the month for date, in the range 1 to 31: - - > SELECT DAYOFMONTH('1998-02-03'); - -> 3 - */ - class OOp_DayOfMonth : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** DAYOFYEAR(date) - Returns the day of the year for date, in the range 1 to 366: - - > SELECT DAYOFYEAR('1998-02-03'); - -> 34 - - */ - class OOp_DayOfYear : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** MONTH(date) - Returns the month for date, in the range 1 to 12: - - > SELECT MONTH('1998-02-03'); - -> 2 - */ - class OOp_Month : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** DAYNAME(date) - Returns the name of the weekday for date: - - > SELECT DAYNAME('1998-02-05'); - -> 'Thursday' - - */ - class OOp_DayName : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** MONTHNAME(date) - Returns the name of the month for date: - - > SELECT MONTHNAME('1998-02-05'); - -> 'February' - - */ - class OOp_MonthName : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** QUARTER(date) - Returns the quarter of the year for date, in the range 1 to 4: - - > SELECT QUARTER('98-04-01'); - -> 2 - - */ - class OOp_Quarter : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** WEEK(date) - WEEK(date,first) - With a single argument, returns the week for date, in the range 0 to 53 (yes, there may be the beginnings of a week 53), for locations where Sunday is the first day of the week. The two-argument form of WEEK() allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range 0-53 or 1-52. Here is a table for how the second argument works: - Value Meaning - 0 Week starts on Sunday and return value is in range 0-53 - 1 Week starts on Monday and return value is in range 0-53 - 2 Week starts on Sunday and return value is in range 1-53 - 3 Week starts on Monday and return value is in range 1-53 (ISO 8601) - - > SELECT WEEK('1998-02-20'); - -> 7 - > SELECT WEEK('1998-02-20',0); - -> 7 - > SELECT WEEK('1998-02-20',1); - -> 8 - > SELECT WEEK('1998-12-31',1); - -> 53 - - */ - class OOp_Week : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** YEAR(date) - Returns the year for date, in the range 1000 to 9999: - - > SELECT YEAR('98-02-03'); - -> 1998 - */ - class OOp_Year : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** HOUR(time) - Returns the hour for time, in the range 0 to 23: - - > SELECT HOUR('10:05:03'); - -> 10 - */ - class OOp_Hour : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** MINUTE(time) - Returns the minute for time, in the range 0 to 59: - - > SELECT MINUTE('98-02-03 10:05:03'); - -> 5 - - */ - class OOp_Minute : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** SECOND(time) - Returns the second for time, in the range 0 to 59: - - > SELECT SECOND('10:05:03'); - -> 3 - */ - class OOp_Second : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** CURDATE() - CURRENT_DATE - Returns today's date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context: - - > SELECT CURDATE(); - -> '1997-12-15' - */ - class OOp_CurDate : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** CURTIME() - CURRENT_TIME - Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context: - - > SELECT CURTIME(); - -> '23:50:26' - */ - class OOp_CurTime : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** NOW() - Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context: - - > SELECT NOW(); - -> '1997-12-15 23:50:26' - */ - class OOp_Now : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** DAYOFMONTH(date) + Returns the day of the month for date, in the range 1 to 31: + + > SELECT DAYOFMONTH('1998-02-03'); + -> 3 + */ + class OOp_DayOfMonth : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** DAYOFYEAR(date) + Returns the day of the year for date, in the range 1 to 366: + + > SELECT DAYOFYEAR('1998-02-03'); + -> 34 + + */ + class OOp_DayOfYear : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** MONTH(date) + Returns the month for date, in the range 1 to 12: + + > SELECT MONTH('1998-02-03'); + -> 2 + */ + class OOp_Month : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** DAYNAME(date) + Returns the name of the weekday for date: + + > SELECT DAYNAME('1998-02-05'); + -> 'Thursday' + + */ + class OOp_DayName : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** MONTHNAME(date) + Returns the name of the month for date: + + > SELECT MONTHNAME('1998-02-05'); + -> 'February' + + */ + class OOp_MonthName : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** QUARTER(date) + Returns the quarter of the year for date, in the range 1 to 4: + + > SELECT QUARTER('98-04-01'); + -> 2 + + */ + class OOp_Quarter : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** WEEK(date) + WEEK(date,first) + With a single argument, returns the week for date, in the range 0 to 53 (yes, there may be the beginnings of a week 53), for locations where Sunday is the first day of the week. The two-argument form of WEEK() allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range 0-53 or 1-52. Here is a table for how the second argument works: + Value Meaning + 0 Week starts on Sunday and return value is in range 0-53 + 1 Week starts on Monday and return value is in range 0-53 + 2 Week starts on Sunday and return value is in range 1-53 + 3 Week starts on Monday and return value is in range 1-53 (ISO 8601) + + > SELECT WEEK('1998-02-20'); + -> 7 + > SELECT WEEK('1998-02-20',0); + -> 7 + > SELECT WEEK('1998-02-20',1); + -> 8 + > SELECT WEEK('1998-12-31',1); + -> 53 + + */ + class OOp_Week : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** YEAR(date) + Returns the year for date, in the range 1000 to 9999: + + > SELECT YEAR('98-02-03'); + -> 1998 + */ + class OOp_Year : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** HOUR(time) + Returns the hour for time, in the range 0 to 23: + + > SELECT HOUR('10:05:03'); + -> 10 + */ + class OOp_Hour : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** MINUTE(time) + Returns the minute for time, in the range 0 to 59: + + > SELECT MINUTE('98-02-03 10:05:03'); + -> 5 + + */ + class OOp_Minute : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** SECOND(time) + Returns the second for time, in the range 0 to 59: + + > SELECT SECOND('10:05:03'); + -> 3 + */ + class OOp_Second : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** CURDATE() + CURRENT_DATE + Returns today's date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context: + + > SELECT CURDATE(); + -> '1997-12-15' + */ + class OOp_CurDate : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** CURTIME() + CURRENT_TIME + Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context: + + > SELECT CURTIME(); + -> '23:50:26' + */ + class OOp_CurTime : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** NOW() + Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context: + + > SELECT NOW(); + -> '1997-12-15 23:50:26' + */ + class OOp_Now : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; } diff --git a/connectivity/source/inc/file/FDriver.hxx b/connectivity/source/inc/file/FDriver.hxx index e48ced409736..0452b0ab17c8 100644 --- a/connectivity/source/inc/file/FDriver.hxx +++ b/connectivity/source/inc/file/FDriver.hxx @@ -28,46 +28,46 @@ #include <unotools/weakref.hxx> namespace connectivity::file - { - class OConnection; +{ + class OConnection; - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, - css::lang::XServiceInfo, - css::sdbcx::XDataDefinitionSupplier> ODriver_BASE; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, + css::lang::XServiceInfo, + css::sdbcx::XDataDefinitionSupplier> ODriver_BASE; - class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OFileDriver : public ODriver_BASE - { - protected: - ::osl::Mutex m_aMutex; + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OFileDriver : public ODriver_BASE + { + protected: + ::osl::Mutex m_aMutex; - std::vector<unotools::WeakReference<OConnection>> m_xConnections; // vector containing a list - // of all the Connection objects - // for this Driver - css::uno::Reference< css::uno::XComponentContext > m_xContext; - public: - OFileDriver(css::uno::Reference< css::uno::XComponentContext > _xContext); + std::vector<unotools::WeakReference<OConnection>> m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + css::uno::Reference< css::uno::XComponentContext > m_xContext; + public: + OFileDriver(css::uno::Reference< css::uno::XComponentContext > _xContext); - // OComponentHelper - virtual void SAL_CALL disposing() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Int32 SAL_CALL getMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getMinorVersion( ) override; + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Int32 SAL_CALL getMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getMinorVersion( ) override; - // XDataDefinitionSupplier - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + // XDataDefinitionSupplier + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() const { return m_xContext; } - }; + const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() const { return m_xContext; } + }; } diff --git a/connectivity/source/inc/file/FNumericFunctions.hxx b/connectivity/source/inc/file/FNumericFunctions.hxx index 765f2cde8223..8ed560903685 100644 --- a/connectivity/source/inc/file/FNumericFunctions.hxx +++ b/connectivity/source/inc/file/FNumericFunctions.hxx @@ -22,340 +22,340 @@ #include <file/fcode.hxx> namespace connectivity::file +{ + /** ABS(X) + Returns the absolute value of X: + + > SELECT ABS(2); + -> 2 + > SELECT ABS(-32); + -> 32 + + */ + class OOp_Abs : public OUnaryOperator { - /** ABS(X) - Returns the absolute value of X: + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; - > SELECT ABS(2); - -> 2 - > SELECT ABS(-32); - -> 32 - - */ - class OOp_Abs : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** SIGN(X) - Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive: - - > SELECT SIGN(-32); - -> -1 - > SELECT SIGN(0); - -> 0 - > SELECT SIGN(234); - -> 1 - - */ - class OOp_Sign : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** MOD(N,M) - % - Modulo (like the % operator in C). Returns the remainder of N divided by M: - - > SELECT MOD(234, 10); - -> 4 - > SELECT 253 % 7; - -> 1 - > SELECT MOD(29,9); - -> 2 - > SELECT 29 MOD 9; - -> 2 - */ - class OOp_Mod : public OBinaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; - }; - - /** FLOOR(X) - Returns the largest integer value not greater than X: - - > SELECT FLOOR(1.23); + /** SIGN(X) + Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive: + + > SELECT SIGN(-32); + -> -1 + > SELECT SIGN(0); + -> 0 + > SELECT SIGN(234); -> 1 - > SELECT FLOOR(-1.23); - -> -2 - */ - class OOp_Floor : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; + */ + class OOp_Sign : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; - /** CEILING(X) - Returns the smallest integer value not less than X: + /** MOD(N,M) + % + Modulo (like the % operator in C). Returns the remainder of N divided by M: - > SELECT CEILING(1.23); + > SELECT MOD(234, 10); + -> 4 + > SELECT 253 % 7; + -> 1 + > SELECT MOD(29,9); -> 2 - > SELECT CEILING(-1.23); + > SELECT 29 MOD 9; + -> 2 + */ + class OOp_Mod : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; + }; + + /** FLOOR(X) + Returns the largest integer value not greater than X: + + > SELECT FLOOR(1.23); + -> 1 + > SELECT FLOOR(-1.23); + -> -2 + + */ + class OOp_Floor : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** CEILING(X) + Returns the smallest integer value not less than X: + + > SELECT CEILING(1.23); + -> 2 + > SELECT CEILING(-1.23); + -> -1 + + */ + class OOp_Ceiling : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** ROUND(X) + ROUND(X,D) + Returns the argument X, rounded to the nearest integer. With two arguments rounded to a number to D decimals. + + > SELECT ROUND(-1.23); -> -1 + > SELECT ROUND(-1.58); + -> -2 + > SELECT ROUND(1.58); + -> 2 + > SELECT ROUND(1.298, 1); + -> 1.3 + > SELECT ROUND(1.298, 0); + -> 1 + > SELECT ROUND(23.298, -1); + -> 20 + */ + class OOp_Round : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** EXP(X) + Returns the value of e (the base of natural logarithms) raised to the power of X: + + > SELECT EXP(2); + -> 7.389056 + > SELECT EXP(-2); + -> 0.135335 + */ + class OOp_Exp : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** LN(X) + Returns the natural logarithm of X: - */ - class OOp_Ceiling : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** ROUND(X) - ROUND(X,D) - Returns the argument X, rounded to the nearest integer. With two arguments rounded to a number to D decimals. - - > SELECT ROUND(-1.23); - -> -1 - > SELECT ROUND(-1.58); - -> -2 - > SELECT ROUND(1.58); - -> 2 - > SELECT ROUND(1.298, 1); - -> 1.3 - > SELECT ROUND(1.298, 0); - -> 1 - > SELECT ROUND(23.298, -1); - -> 20 - */ - class OOp_Round : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** EXP(X) - Returns the value of e (the base of natural logarithms) raised to the power of X: - - > SELECT EXP(2); - -> 7.389056 - > SELECT EXP(-2); - -> 0.135335 - */ - class OOp_Exp : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** LN(X) - Returns the natural logarithm of X: - - > SELECT LN(2); + > SELECT LN(2); + -> 0.693147 + > SELECT LN(-2); + -> NULL + + */ + class OOp_Ln : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** LOG(X) + LOG(B,X) + If called with one parameter, this function returns the natural logarithm of X: + + > SELECT LOG(2); -> 0.693147 - > SELECT LN(-2); + > SELECT LOG(-2); -> NULL - */ - class OOp_Ln : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** LOG(X) - LOG(B,X) - If called with one parameter, this function returns the natural logarithm of X: - - > SELECT LOG(2); - -> 0.693147 - > SELECT LOG(-2); - -> NULL - - If called with two parameters, this function returns the logarithm of X for an arbitrary base B: - - > SELECT LOG(2,65536); - -> 16.000000 - > SELECT LOG(1,100); - -> NULL - */ - class OOp_Log : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** LOG10(X) - Returns the base-10 logarithm of X: - - > SELECT LOG10(2); - -> 0.301030 - > SELECT LOG10(100); - -> 2.000000 - > SELECT LOG10(-100); - -> NULL - */ - class OOp_Log10 : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** POWER(X,Y) - Returns the value of X raised to the power of Y: - - > SELECT POW(2,2); - -> 4.000000 - > SELECT POW(2,-2); - -> 0.250000 - */ - class OOp_Pow : public OBinaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; - }; - - /** SQRT(X) - Returns the non-negative square root of X: - - > SELECT SQRT(4); - -> 2.000000 - > SELECT SQRT(20); - -> 4.472136 - */ - class OOp_Sqrt : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** PI() - Returns the value of PI. The default shown number of decimals is 5, but internally uses the full double precision for PI. - - > SELECT PI(); - -> 3.141593 - > SELECT PI()+0.000000000000000000; - -> 3.141592653589793238 - - */ - class OOp_Pi : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** COS(X) - Returns the cosine of X, where X is given in radians: - - > SELECT COS(PI()); - -> -1.000000 - */ - class OOp_Cos : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** SIN(X) - Returns the sine of X, where X is given in radians: - - > SELECT SIN(PI()); - -> 0.000000 - - */ - class OOp_Sin : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - /** TAN(X) - Returns the tangent of X, where X is given in radians: - - > SELECT TAN(PI()+1); - -> 1.557408 - */ - class OOp_Tan : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** ACOS(X) - Returns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1: - - > SELECT ACOS(1); - -> 0.000000 - > SELECT ACOS(1.0001); + If called with two parameters, this function returns the logarithm of X for an arbitrary base B: + + > SELECT LOG(2,65536); + -> 16.000000 + > SELECT LOG(1,100); -> NULL - > SELECT ACOS(0); - -> 1.570796 - */ - class OOp_ACos : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** ASIN(X) - Returns the arc sine of X, that is, the value whose sine is X. Returns NULL if X is not in the range -1 to 1: - - > SELECT ASIN(0.2); - -> 0.201358 - > SELECT ASIN('foo'); - -> 0.000000 - */ - class OOp_ASin : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** ATAN(X) - Returns the arc tangent of X, that is, the value whose tangent is X: - - > SELECT ATAN(2); - -> 1.107149 - > SELECT ATAN(-2); - -> -1.107149 - */ - class OOp_ATan : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** ATAN2(Y,X) - Returns the arc tangent of the two variables X and Y. It is similar to calculating the arc tangent of Y / X, except that the signs of both arguments are used to determine the quadrant of the result: - - > SELECT ATAN2(-2,2); - -> -0.785398 - > SELECT ATAN2(PI(),0); - -> 1.570796 - - */ - class OOp_ATan2 : public OBinaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; - }; - - /** DEGREES(X) - Returns the argument X, converted from radians to degrees: - - > SELECT DEGREES(PI()); - -> 180.000000 - */ - class OOp_Degrees : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** RADIANS(X) - Returns the argument X, converted from degrees to radians: - - > SELECT RADIANS(90); - -> 1.570796 - - */ - class OOp_Radians : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; + */ + class OOp_Log : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** LOG10(X) + Returns the base-10 logarithm of X: + + > SELECT LOG10(2); + -> 0.301030 + > SELECT LOG10(100); + -> 2.000000 + > SELECT LOG10(-100); + -> NULL + */ + class OOp_Log10 : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** POWER(X,Y) + Returns the value of X raised to the power of Y: + + > SELECT POW(2,2); + -> 4.000000 + > SELECT POW(2,-2); + -> 0.250000 + */ + class OOp_Pow : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; + }; + + /** SQRT(X) + Returns the non-negative square root of X: + + > SELECT SQRT(4); + -> 2.000000 + > SELECT SQRT(20); + -> 4.472136 + */ + class OOp_Sqrt : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** PI() + Returns the value of PI. The default shown number of decimals is 5, but internally uses the full double precision for PI. + + > SELECT PI(); + -> 3.141593 + > SELECT PI()+0.000000000000000000; + -> 3.141592653589793238 + + */ + class OOp_Pi : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** COS(X) + Returns the cosine of X, where X is given in radians: + + > SELECT COS(PI()); + -> -1.000000 + */ + class OOp_Cos : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** SIN(X) + Returns the sine of X, where X is given in radians: + + > SELECT SIN(PI()); + -> 0.000000 + + */ + class OOp_Sin : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + /** TAN(X) + Returns the tangent of X, where X is given in radians: + + > SELECT TAN(PI()+1); + -> 1.557408 + */ + class OOp_Tan : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** ACOS(X) + Returns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1: + + > SELECT ACOS(1); + -> 0.000000 + > SELECT ACOS(1.0001); + -> NULL + > SELECT ACOS(0); + -> 1.570796 + */ + class OOp_ACos : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** ASIN(X) + Returns the arc sine of X, that is, the value whose sine is X. Returns NULL if X is not in the range -1 to 1: + + > SELECT ASIN(0.2); + -> 0.201358 + > SELECT ASIN('foo'); + -> 0.000000 + */ + class OOp_ASin : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** ATAN(X) + Returns the arc tangent of X, that is, the value whose tangent is X: + + > SELECT ATAN(2); + -> 1.107149 + > SELECT ATAN(-2); + -> -1.107149 + */ + class OOp_ATan : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** ATAN2(Y,X) + Returns the arc tangent of the two variables X and Y. It is similar to calculating the arc tangent of Y / X, except that the signs of both arguments are used to determine the quadrant of the result: + + > SELECT ATAN2(-2,2); + -> -0.785398 + > SELECT ATAN2(PI(),0); + -> 1.570796 + + */ + class OOp_ATan2 : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; + }; + + /** DEGREES(X) + Returns the argument X, converted from radians to degrees: + + > SELECT DEGREES(PI()); + -> 180.000000 + */ + class OOp_Degrees : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** RADIANS(X) + Returns the argument X, converted from degrees to radians: + + > SELECT RADIANS(90); + -> 1.570796 + + */ + class OOp_Radians : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; } diff --git a/connectivity/source/inc/file/FPreparedStatement.hxx b/connectivity/source/inc/file/FPreparedStatement.hxx index 7adbf40d2b7f..822278eb02d2 100644 --- a/connectivity/source/inc/file/FPreparedStatement.hxx +++ b/connectivity/source/inc/file/FPreparedStatement.hxx @@ -28,95 +28,95 @@ #include <file/FResultSet.hxx> namespace connectivity::file +{ + class OResultSetMetaData; + + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OPreparedStatement : public OStatement_BASE2, + public css::sdbc::XPreparedStatement, + public css::sdbc::XParameters, + public css::sdbc::XResultSetMetaDataSupplier, + public css::lang::XServiceInfo + { - class OResultSetMetaData; - - class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OPreparedStatement : public OStatement_BASE2, - public css::sdbc::XPreparedStatement, - public css::sdbc::XParameters, - public css::sdbc::XResultSetMetaDataSupplier, - public css::lang::XServiceInfo - - { - protected: - - // Data attributes - - OValueRefRow m_aParameterRow; - rtl::Reference<OResultSetMetaData> m_xMetaData; - - ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns - - // factory method for resultset's - virtual rtl::Reference<OResultSet> createResultSet() override; - ::rtl::Reference< OResultSet > makeResultSet(); - void initResultSet(OResultSet*); - - void checkAndResizeParameters(sal_Int32 parameterIndex); - void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x); - - sal_uInt32 AddParameter(connectivity::OSQLParseNode const * pParameter, - const css::uno::Reference< css::beans::XPropertySet>& _xCol); - void scanParameter(OSQLParseNode* pParseNode,std::vector< OSQLParseNode*>& _rParaNodes); - void describeColumn(OSQLParseNode const * _pParameter, OSQLParseNode const * _pNode, const OSQLTable& _xTable); - void describeParameter(); - - virtual void parseParamterElem(const OUString& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem) override; - virtual void initializeResultSet(OResultSet* _pResult) override; - - virtual ~OPreparedStatement() override; - public: - DECLARE_SERVICE_INFO(); - // a Constructor, that is needed for when Returning the Object is needed: - OPreparedStatement( OConnection* _pConnection); - - virtual void construct(const OUString& sql) override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPreparedStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; - virtual sal_Int32 SAL_CALL executeUpdate( ) override; - virtual sal_Bool SAL_CALL execute( ) override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; - // XParameters - virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; - virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; - virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; - virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; - virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; - virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; - virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; - virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; - virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; - virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; - virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; - virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; - virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; - virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; - virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; - virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; - virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; - virtual void SAL_CALL clearParameters( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - - const rtl::Reference<OResultSetMetaData> & getMetaDataImpl(); - }; + protected: + + // Data attributes + + OValueRefRow m_aParameterRow; + rtl::Reference<OResultSetMetaData> m_xMetaData; + + ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns + + // factory method for resultset's + virtual rtl::Reference<OResultSet> createResultSet() override; + ::rtl::Reference< OResultSet > makeResultSet(); + void initResultSet(OResultSet*); + + void checkAndResizeParameters(sal_Int32 parameterIndex); + void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x); + + sal_uInt32 AddParameter(connectivity::OSQLParseNode const * pParameter, + const css::uno::Reference< css::beans::XPropertySet>& _xCol); + void scanParameter(OSQLParseNode* pParseNode,std::vector< OSQLParseNode*>& _rParaNodes); + void describeColumn(OSQLParseNode const * _pParameter, OSQLParseNode const * _pNode, const OSQLTable& _xTable); + void describeParameter(); + + virtual void parseParamterElem(const OUString& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem) override; + virtual void initializeResultSet(OResultSet* _pResult) override; + + virtual ~OPreparedStatement() override; + public: + DECLARE_SERVICE_INFO(); + // a Constructor, that is needed for when Returning the Object is needed: + OPreparedStatement( OConnection* _pConnection); + + virtual void construct(const OUString& sql) override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPreparedStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; + virtual sal_Int32 SAL_CALL executeUpdate( ) override; + virtual sal_Bool SAL_CALL execute( ) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; + virtual void SAL_CALL clearParameters( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + + const rtl::Reference<OResultSetMetaData> & getMetaDataImpl(); + }; } diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx index b4c1786fd2d5..9b60dae420c4 100644 --- a/connectivity/source/inc/file/FResultSet.hxx +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -44,259 +44,259 @@ #include "FResultSetMetaData.hxx" namespace connectivity::file +{ + class OResultSetMetaData; + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XWarningsSupplier, + css::sdbc::XResultSetUpdate, + css::sdbc::XRowUpdate, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate, + css::lang::XServiceInfo, + css::lang::XEventListener> OResultSet_BASE; + + class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OResultSet : + public cppu::BaseMutex, + public ::connectivity::IResultSetHelper, + public OResultSet_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> { - class OResultSetMetaData; - - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XWarningsSupplier, - css::sdbc::XResultSetUpdate, - css::sdbc::XRowUpdate, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate, - css::lang::XServiceInfo, - css::lang::XEventListener> OResultSet_BASE; - - class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OResultSet : - public cppu::BaseMutex, - public ::connectivity::IResultSetHelper, - public OResultSet_BASE, - public ::comphelper::OPropertyContainer, - public ::comphelper::OPropertyArrayUsageHelper<OResultSet> - { - protected: - std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time - - std::vector<sal_Int32> m_aOrderbyColumnNumber; - std::vector<TAscendingOrder> m_aOrderbyAscending; - - OValueRefRow m_aSelectRow; - OValueRefRow m_aRow; - OValueRefRow m_aEvaluateRow; // contains all values of a row - OValueRefRow m_aInsertRow; // needed for insert by cursor - ORefAssignValues m_aAssignValues; // needed for insert,update and parameters - // to compare with the restrictions - OSkipDeletedSet m_aSkipDeletedSet; - - ::rtl::Reference<OKeySet> m_pFileSet; - OKeySet::iterator m_aFileSetIter; - - - std::unique_ptr<OSortIndex> m_pSortIndex; - ::rtl::Reference<connectivity::OSQLColumns> m_xColumns; // this are the select columns - rtl::Reference<OFileTable> m_pTable; - connectivity::OSQLParseNode* m_pParseTree; - - OSQLAnalyzer* m_pSQLAnalyzer; - connectivity::OSQLParseTreeIterator& m_aSQLIterator; - - sal_Int32 m_nFetchSize; - sal_Int32 m_nResultSetType; - sal_Int32 m_nFetchDirection; - sal_Int32 m_nResultSetConcurrency; - - css::uno::Reference< css::uno::XInterface> m_xStatement; - rtl::Reference< OResultSetMetaData> m_xMetaData; - css::uno::Reference< css::container::XNameAccess> m_xColNames; // table columns - css::uno::Reference< css::container::XIndexAccess> m_xColsIdx; // table columns - - - sal_Int32 m_nRowPos; - sal_Int32 m_nFilePos; - sal_Int32 m_nLastVisitedPos; - sal_Int32 m_nRowCountResult; - sal_Int32 m_nColumnCount; - bool m_bWasNull; - bool m_bInserted; // true when moveToInsertRow was called - // set to false when cursor moved or cancel - bool m_bRowUpdated; - bool m_bRowInserted; - bool m_bRowDeleted; - bool m_bShowDeleted; - bool m_bIsCount; - - static void initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount); - void construct(); - //sal_Bool evaluate(); - - bool ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition, - sal_Int32 nOffset = 1, - bool bEvaluate = true, - bool bRetrieveData = true); - - std::unique_ptr<OKeyValue> GetOrderbyKeyValue(OValueRefRow const & _rRow); - bool IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] >= 0;} - - // return true when the select statement is "select count(*) from table" - bool isCount() const { return m_bIsCount; } - /// @throws css::sdbc::SQLException - void checkIndex(sal_Int32 columnIndex ); - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - const ORowSetValue& getValue(sal_Int32 columnIndex); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ); - // clear insert row - void clearInsertRow(); - void sortRows(); - protected: - - using OResultSet_BASE::rBHelper; - - bool Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, bool bRetrieveData); - virtual bool fillIndexValues(const css::uno::Reference< css::sdbcx::XColumnsSupplier> &_xIndex); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - virtual ~OResultSet() override; - public: - DECLARE_SERVICE_INFO(); - // a Constructor, that is needed for when Returning the Object is needed: - OResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override final; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XResultSet - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XResultSetUpdate - virtual void SAL_CALL insertRow( ) override; - virtual void SAL_CALL updateRow( ) override; - virtual void SAL_CALL deleteRow( ) override; - virtual void SAL_CALL cancelRowUpdates( ) override; - virtual void SAL_CALL moveToInsertRow( ) override; - virtual void SAL_CALL moveToCurrentRow( ) override; - // XRowUpdate - virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - //XEventlistener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - // special methods - inline sal_Int32 mapColumn(sal_Int32 column); - void OpenImpl(); - void doTableSpecials(const OSQLTable& _xTable); - - sal_Int32 getRowCountResult() const { return m_nRowCountResult; } - void setEvaluationRow(const OValueRefRow& _aRow) { m_aEvaluateRow = _aRow; } - void setAssignValues(const ORefAssignValues& _aAssignValues) { m_aAssignValues = _aAssignValues; } - void setBindingRow(const OValueRefRow& _aRow) { m_aRow = _aRow; } - void setSelectRow(const OValueRefRow& _rRow) - { - m_aSelectRow = _rRow; - m_nColumnCount = m_aSelectRow->size(); - } - void setColumnMapping(std::vector<sal_Int32>&& _aColumnMapping) { m_aColMapping = std::move(_aColumnMapping); } - void setSqlAnalyzer(OSQLAnalyzer* _pSQLAnalyzer) { m_pSQLAnalyzer = _pSQLAnalyzer; } - - void setOrderByColumns(std::vector<sal_Int32>&& _aColumnOrderBy) { m_aOrderbyColumnNumber = std::move(_aColumnOrderBy); } - void setOrderByAscending(std::vector<TAscendingOrder>&& _aOrderbyAsc) { m_aOrderbyAscending = std::move(_aOrderbyAsc); } - void setMetaData(const rtl::Reference< OResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} - - static void setBoundedColumns(const OValueRefRow& _rRow, - const OValueRefRow& _rSelectRow, - const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns, - const css::uno::Reference< css::container::XIndexAccess>& _xNames, - bool _bSetColumnMapping, - const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData, - std::vector<sal_Int32>& _rColMapping); - - // IResultSetHelper - virtual bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData) override; - virtual sal_Int32 getDriverPos() const override; - virtual bool isRowDeleted() const override; - }; - - inline sal_Int32 OResultSet::mapColumn(sal_Int32 column) + protected: + std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time + + std::vector<sal_Int32> m_aOrderbyColumnNumber; + std::vector<TAscendingOrder> m_aOrderbyAscending; + + OValueRefRow m_aSelectRow; + OValueRefRow m_aRow; + OValueRefRow m_aEvaluateRow; // contains all values of a row + OValueRefRow m_aInsertRow; // needed for insert by cursor + ORefAssignValues m_aAssignValues; // needed for insert,update and parameters + // to compare with the restrictions + OSkipDeletedSet m_aSkipDeletedSet; + + ::rtl::Reference<OKeySet> m_pFileSet; + OKeySet::iterator m_aFileSetIter; + + + std::unique_ptr<OSortIndex> m_pSortIndex; + ::rtl::Reference<connectivity::OSQLColumns> m_xColumns; // this are the select columns + rtl::Reference<OFileTable> m_pTable; + connectivity::OSQLParseNode* m_pParseTree; + + OSQLAnalyzer* m_pSQLAnalyzer; + connectivity::OSQLParseTreeIterator& m_aSQLIterator; + + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + + css::uno::Reference< css::uno::XInterface> m_xStatement; + rtl::Reference< OResultSetMetaData> m_xMetaData; + css::uno::Reference< css::container::XNameAccess> m_xColNames; // table columns + css::uno::Reference< css::container::XIndexAccess> m_xColsIdx; // table columns + + + sal_Int32 m_nRowPos; + sal_Int32 m_nFilePos; + sal_Int32 m_nLastVisitedPos; + sal_Int32 m_nRowCountResult; + sal_Int32 m_nColumnCount; + bool m_bWasNull; + bool m_bInserted; // true when moveToInsertRow was called + // set to false when cursor moved or cancel + bool m_bRowUpdated; + bool m_bRowInserted; + bool m_bRowDeleted; + bool m_bShowDeleted; + bool m_bIsCount; + + static void initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount); + void construct(); + //sal_Bool evaluate(); + + bool ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition, + sal_Int32 nOffset = 1, + bool bEvaluate = true, + bool bRetrieveData = true); + + std::unique_ptr<OKeyValue> GetOrderbyKeyValue(OValueRefRow const & _rRow); + bool IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] >= 0;} + + // return true when the select statement is "select count(*) from table" + bool isCount() const { return m_bIsCount; } + /// @throws css::sdbc::SQLException + void checkIndex(sal_Int32 columnIndex ); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + const ORowSetValue& getValue(sal_Int32 columnIndex); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ); + // clear insert row + void clearInsertRow(); + void sortRows(); + protected: + + using OResultSet_BASE::rBHelper; + + bool Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, bool bRetrieveData); + virtual bool fillIndexValues(const css::uno::Reference< css::sdbcx::XColumnsSupplier> &_xIndex); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual ~OResultSet() override; + public: + DECLARE_SERVICE_INFO(); + // a Constructor, that is needed for when Returning the Object is needed: + OResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override final; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XResultSet + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) override; + virtual void SAL_CALL updateRow( ) override; + virtual void SAL_CALL deleteRow( ) override; + virtual void SAL_CALL cancelRowUpdates( ) override; + virtual void SAL_CALL moveToInsertRow( ) override; + virtual void SAL_CALL moveToCurrentRow( ) override; + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + //XEventlistener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // special methods + inline sal_Int32 mapColumn(sal_Int32 column); + void OpenImpl(); + void doTableSpecials(const OSQLTable& _xTable); + + sal_Int32 getRowCountResult() const { return m_nRowCountResult; } + void setEvaluationRow(const OValueRefRow& _aRow) { m_aEvaluateRow = _aRow; } + void setAssignValues(const ORefAssignValues& _aAssignValues) { m_aAssignValues = _aAssignValues; } + void setBindingRow(const OValueRefRow& _aRow) { m_aRow = _aRow; } + void setSelectRow(const OValueRefRow& _rRow) { - sal_Int32 map = column; + m_aSelectRow = _rRow; + m_nColumnCount = m_aSelectRow->size(); + } + void setColumnMapping(std::vector<sal_Int32>&& _aColumnMapping) { m_aColMapping = std::move(_aColumnMapping); } + void setSqlAnalyzer(OSQLAnalyzer* _pSQLAnalyzer) { m_pSQLAnalyzer = _pSQLAnalyzer; } + + void setOrderByColumns(std::vector<sal_Int32>&& _aColumnOrderBy) { m_aOrderbyColumnNumber = std::move(_aColumnOrderBy); } + void setOrderByAscending(std::vector<TAscendingOrder>&& _aOrderbyAsc) { m_aOrderbyAscending = std::move(_aOrderbyAsc); } + void setMetaData(const rtl::Reference< OResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} + + static void setBoundedColumns(const OValueRefRow& _rRow, + const OValueRefRow& _rSelectRow, + const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns, + const css::uno::Reference< css::container::XIndexAccess>& _xNames, + bool _bSetColumnMapping, + const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData, + std::vector<sal_Int32>& _rColMapping); + + // IResultSetHelper + virtual bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData) override; + virtual sal_Int32 getDriverPos() const override; + virtual bool isRowDeleted() const override; + }; + + inline sal_Int32 OResultSet::mapColumn(sal_Int32 column) + { + sal_Int32 map = column; - OSL_ENSURE(column > 0, "file::OResultSet::mapColumn: invalid column index!"); - // the first column (index 0) is for convenience only. The first real select column is number 1. - if ((column > 0) && (o3tl::make_unsigned(column) < m_aColMapping.size())) - map = m_aColMapping[column]; + OSL_ENSURE(column > 0, "file::OResultSet::mapColumn: invalid column index!"); + // the first column (index 0) is for convenience only. The first real select column is number 1. + if ((column > 0) && (o3tl::make_unsigned(column) < m_aColMapping.size())) + map = m_aColMapping[column]; - return map; - } + return map; + } } diff --git a/connectivity/source/inc/file/FResultSetMetaData.hxx b/connectivity/source/inc/file/FResultSetMetaData.hxx index dee656a915f4..a99507803a7f 100644 --- a/connectivity/source/inc/file/FResultSetMetaData.hxx +++ b/connectivity/source/inc/file/FResultSetMetaData.hxx @@ -25,51 +25,51 @@ #include <rtl/ref.hxx> namespace connectivity::file - { - class OFileTable; +{ + class OFileTable; - //************ Class: ResultSetMetaData + //************ Class: ResultSetMetaData - typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; - class OResultSetMetaData : - public OResultSetMetaData_BASE - { - OUString m_aTableName; - ::rtl::Reference<connectivity::OSQLColumns> m_xColumns; - OFileTable* m_pTable; + class OResultSetMetaData : + public OResultSetMetaData_BASE + { + OUString m_aTableName; + ::rtl::Reference<connectivity::OSQLColumns> m_xColumns; + OFileTable* m_pTable; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void checkColumnIndex(sal_Int32 column); - protected: - virtual ~OResultSetMetaData() override; - public: - // a Constructor, that is needed for when Returning the Object is needed: - OResultSetMetaData(::rtl::Reference<connectivity::OSQLColumns> _xColumns, OUString _aTableName, OFileTable* _pTable); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void checkColumnIndex(sal_Int32 column); + protected: + virtual ~OResultSetMetaData() override; + public: + // a Constructor, that is needed for when Returning the Object is needed: + OResultSetMetaData(::rtl::Reference<connectivity::OSQLColumns> _xColumns, OUString _aTableName, OFileTable* _pTable); - virtual sal_Int32 SAL_CALL getColumnCount( ) override; - virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; - virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; - virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; - virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; - }; + virtual sal_Int32 SAL_CALL getColumnCount( ) override; + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; + virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; + virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; + virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; + }; } diff --git a/connectivity/source/inc/file/FStatement.hxx b/connectivity/source/inc/file/FStatement.hxx index 52fbd3d2850f..393d587e2a39 100644 --- a/connectivity/source/inc/file/FStatement.hxx +++ b/connectivity/source/inc/file/FStatement.hxx @@ -39,158 +39,158 @@ #include <unotools/weakref.hxx> namespace connectivity::file +{ + class OResultSet; + class OFileTable; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, + css::util::XCancellable, + css::sdbc::XCloseable> OStatement_BASE; + + + //************ Class: java.sql.Statement + + class OOO_DLLPUBLIC_FILE OStatement_Base : + public cppu::BaseMutex, + public OStatement_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> + + { + protected: + std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time + std::vector<sal_Int32> m_aParameterIndexes; // maps the parameter index to column index + std::vector<sal_Int32> m_aOrderbyColumnNumber; + std::vector<TAscendingOrder> m_aOrderbyAscending; + + css::sdbc::SQLWarning m_aLastWarning; + unotools::WeakReference< OResultSet> m_xResultSet; // The last ResultSet created + css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xDBMetaData; + css::uno::Reference< css::container::XNameAccess> m_xColNames; // table columns // for this Statement + + + connectivity::OSQLParser m_aParser; + connectivity::OSQLParseTreeIterator m_aSQLIterator; + + rtl::Reference<OConnection> m_pConnection;// The owning Connection object + connectivity::OSQLParseNode* m_pParseTree; + std::unique_ptr<OSQLAnalyzer> m_pSQLAnalyzer; //the sql analyzer used by the resultset + + rtl::Reference<OFileTable> m_pTable; // the current table + OValueRefRow m_aSelectRow; + OValueRefRow m_aRow; + OValueRefRow m_aEvaluateRow; // contains all values of a row + ORefAssignValues m_aAssignValues; // needed for insert,update and parameters + // to compare with the restrictions + + OUString m_aCursorName; + sal_Int32 m_nMaxFieldSize; + sal_Int32 m_nMaxRows; + sal_Int32 m_nQueryTimeOut; + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + bool m_bEscapeProcessing; + + protected: + // initialize the column index map (mapping select columns to table columns) + void createColumnMapping(); + // searches the statement for sort criteria + void analyzeSQL(); + void setOrderbyColumn( connectivity::OSQLParseNode const * pColumnRef, + connectivity::OSQLParseNode const * pAscendingDescending); + + virtual void initializeResultSet(OResultSet* _pResult); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void closeResultSet(); + + void disposeResultSet(); + void GetAssignValues(); + void SetAssignValue(const OUString& aColumnName, + const OUString& aValue, + bool bSetNull = false, + sal_uInt32 nParameter=SQL_NO_PARAMETER); + void ParseAssignValues( const std::vector< OUString>& aColumnNameList, + connectivity::OSQLParseNode* pRow_Value_Constructor_Elem, sal_Int32 nIndex); + + virtual void parseParamterElem(const OUString& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem); + // factory method for resultset's + virtual rtl::Reference<OResultSet> createResultSet() = 0; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual ~OStatement_Base() override; + public: + connectivity::OSQLParseNode* getParseTree() const { return m_pParseTree;} + + OStatement_Base(OConnection* _pConnection ); + + OConnection* getOwnConnection() const { return m_pConnection.get(); } + + using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + virtual void construct(const OUString& sql); + + // OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + // virtual void SAL_CALL release() throw(css::uno::RuntimeException) = 0; + virtual void SAL_CALL acquire() noexcept override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + }; + + class OOO_DLLPUBLIC_FILE OStatement_BASE2 : public OStatement_Base + + { + public: + OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ) {} + // OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual void SAL_CALL release() noexcept override; + }; + + typedef ::cppu::ImplHelper2< css::sdbc::XStatement,css::lang::XServiceInfo > OStatement_XStatement; + class OOO_DLLPUBLIC_FILE OStatement : + public OStatement_BASE2, + public OStatement_XStatement { - class OResultSet; - class OFileTable; - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, - css::util::XCancellable, - css::sdbc::XCloseable> OStatement_BASE; - - - //************ Class: java.sql.Statement - - class OOO_DLLPUBLIC_FILE OStatement_Base : - public cppu::BaseMutex, - public OStatement_BASE, - public ::comphelper::OPropertyContainer, - public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> - - { - protected: - std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time - std::vector<sal_Int32> m_aParameterIndexes; // maps the parameter index to column index - std::vector<sal_Int32> m_aOrderbyColumnNumber; - std::vector<TAscendingOrder> m_aOrderbyAscending; - - css::sdbc::SQLWarning m_aLastWarning; - unotools::WeakReference< OResultSet> m_xResultSet; // The last ResultSet created - css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xDBMetaData; - css::uno::Reference< css::container::XNameAccess> m_xColNames; // table columns // for this Statement - - - connectivity::OSQLParser m_aParser; - connectivity::OSQLParseTreeIterator m_aSQLIterator; - - rtl::Reference<OConnection> m_pConnection;// The owning Connection object - connectivity::OSQLParseNode* m_pParseTree; - std::unique_ptr<OSQLAnalyzer> m_pSQLAnalyzer; //the sql analyzer used by the resultset - - rtl::Reference<OFileTable> m_pTable; // the current table - OValueRefRow m_aSelectRow; - OValueRefRow m_aRow; - OValueRefRow m_aEvaluateRow; // contains all values of a row - ORefAssignValues m_aAssignValues; // needed for insert,update and parameters - // to compare with the restrictions - - OUString m_aCursorName; - sal_Int32 m_nMaxFieldSize; - sal_Int32 m_nMaxRows; - sal_Int32 m_nQueryTimeOut; - sal_Int32 m_nFetchSize; - sal_Int32 m_nResultSetType; - sal_Int32 m_nFetchDirection; - sal_Int32 m_nResultSetConcurrency; - bool m_bEscapeProcessing; - - protected: - // initialize the column index map (mapping select columns to table columns) - void createColumnMapping(); - // searches the statement for sort criteria - void analyzeSQL(); - void setOrderbyColumn( connectivity::OSQLParseNode const * pColumnRef, - connectivity::OSQLParseNode const * pAscendingDescending); - - virtual void initializeResultSet(OResultSet* _pResult); - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void closeResultSet(); - - void disposeResultSet(); - void GetAssignValues(); - void SetAssignValue(const OUString& aColumnName, - const OUString& aValue, - bool bSetNull = false, - sal_uInt32 nParameter=SQL_NO_PARAMETER); - void ParseAssignValues( const std::vector< OUString>& aColumnNameList, - connectivity::OSQLParseNode* pRow_Value_Constructor_Elem, sal_Int32 nIndex); - - virtual void parseParamterElem(const OUString& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem); - // factory method for resultset's - virtual rtl::Reference<OResultSet> createResultSet() = 0; - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual ~OStatement_Base() override; - public: - connectivity::OSQLParseNode* getParseTree() const { return m_pParseTree;} - - OStatement_Base(OConnection* _pConnection ); - - OConnection* getOwnConnection() const { return m_pConnection.get(); } - - using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - virtual void construct(const OUString& sql); - - // OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - // virtual void SAL_CALL release() throw(css::uno::RuntimeException) = 0; - virtual void SAL_CALL acquire() noexcept override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - }; - - class OOO_DLLPUBLIC_FILE OStatement_BASE2 : public OStatement_Base - - { - public: - OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ) {} - // OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual void SAL_CALL release() noexcept override; - }; - - typedef ::cppu::ImplHelper2< css::sdbc::XStatement,css::lang::XServiceInfo > OStatement_XStatement; - class OOO_DLLPUBLIC_FILE OStatement : - public OStatement_BASE2, - public OStatement_XStatement - { - protected: - // factory method for resultset's - virtual rtl::Reference<OResultSet> createResultSet() override; - public: - // a Constructor, that is needed for when Returning the Object is needed: - OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} - DECLARE_SERVICE_INFO(); - - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ; - virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ; - virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ; - }; + protected: + // factory method for resultset's + virtual rtl::Reference<OResultSet> createResultSet() override; + public: + // a Constructor, that is needed for when Returning the Object is needed: + OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} + DECLARE_SERVICE_INFO(); + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ; + virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ; + virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ; + }; } diff --git a/connectivity/source/inc/file/FStringFunctions.hxx b/connectivity/source/inc/file/FStringFunctions.hxx index b3d72294fa68..a4f622293dc0 100644 --- a/connectivity/source/inc/file/FStringFunctions.hxx +++ b/connectivity/source/inc/file/FStringFunctions.hxx @@ -22,247 +22,247 @@ #include <file/fcode.hxx> namespace connectivity::file +{ + /** UCASE(str) + UPPER(str) + Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1): + + > SELECT UCASE('Hej'); + -> 'HEJ' + + */ + class OOp_Upper : public OUnaryOperator { - /** UCASE(str) - UPPER(str) - Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1): - - > SELECT UCASE('Hej'); - -> 'HEJ' - - */ - class OOp_Upper : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** LCASE(str) - LOWER(str) - Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1): - - > SELECT LCASE('QUADRATICALLY'); - -> 'quadratically' - - */ - class OOp_Lower : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** ASCII(str) - Returns the ASCII code value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL: - - > SELECT ASCII('2'); - -> 50 - > SELECT ASCII(2); - -> 50 - > SELECT ASCII('dx'); - -> 100 - - */ - class OOp_Ascii : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** LENGTH(str) - OCTET_LENGTH(str) - CHAR_LENGTH(str) - CHARACTER_LENGTH(str) - Returns the length of the string str: - - > SELECT LENGTH('text'); - -> 4 - > SELECT OCTET_LENGTH('text'); - -> 4 - - */ - class OOp_CharLength : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** CHAR(N,...) - CHAR() interprets the arguments as integers and returns a string consisting of the characters given by the ASCII code values of those integers. NULL values are skipped: - - > SELECT CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t')); - -> 'test' - > SELECT CHAR(77,77.3,'77.3'); - -> 'MMM' - - */ - class OOp_Char : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** CONCAT(str1,str2,...) - Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form: - - > SELECT CONCAT('OO', 'o', 'OO'); - -> 'OOoOO' - > SELECT CONCAT('OO', NULL, 'OO'); - -> NULL - > SELECT CONCAT(14.3); - -> '14.3' - - */ - class OOp_Concat : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** LOCATE(substr,str) - POSITION(substr IN str) - Returns the position of the first occurrence of substring substr in string str. Returns 0 if substr is not in str: - - > SELECT LOCATE('bar', 'foobarbar'); - -> 4 - > SELECT LOCATE('xbar', 'foobar'); - -> 0 - LOCATE(substr,str,pos) - Returns the position of the first occurrence of substring substr in string str, starting at position pos. Returns 0 if substr is not in str: - - > SELECT LOCATE('bar', 'foobarbar',5); - -> 7 - - */ - class OOp_Locate : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** SUBSTRING(str,pos) - SUBSTRING(str FROM pos) - Returns a substring from string str starting at position pos: - - > SELECT SUBSTRING('Quadratically',5); - -> 'ratically' - > SELECT SUBSTRING('foobarbar' FROM 4); - -> 'barbar' - SUBSTRING(str,pos,len) - SUBSTRING(str FROM pos FOR len) - Returns a substring len characters long from string str, starting at position pos. The variant form that uses FROM is SQL-92 syntax: - - > SELECT SUBSTRING('Quadratically',5,6); - -> 'ratica' - - */ - class OOp_SubString : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** LTRIM(str) - Returns the string str with leading space characters removed: - - > SELECT LTRIM(' barbar'); - -> 'barbar' + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** LCASE(str) + LOWER(str) + Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1): + + > SELECT LCASE('QUADRATICALLY'); + -> 'quadratically' + + */ + class OOp_Lower : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** ASCII(str) + Returns the ASCII code value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL: + + > SELECT ASCII('2'); + -> 50 + > SELECT ASCII(2); + -> 50 + > SELECT ASCII('dx'); + -> 100 + + */ + class OOp_Ascii : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** LENGTH(str) + OCTET_LENGTH(str) + CHAR_LENGTH(str) + CHARACTER_LENGTH(str) + Returns the length of the string str: + + > SELECT LENGTH('text'); + -> 4 + > SELECT OCTET_LENGTH('text'); + -> 4 + + */ + class OOp_CharLength : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; - */ - class OOp_LTrim : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; + /** CHAR(N,...) + CHAR() interprets the arguments as integers and returns a string consisting of the characters given by the ASCII code values of those integers. NULL values are skipped: + + > SELECT CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t')); + -> 'test' + > SELECT CHAR(77,77.3,'77.3'); + -> 'MMM' + + */ + class OOp_Char : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** CONCAT(str1,str2,...) + Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form: + + > SELECT CONCAT('OO', 'o', 'OO'); + -> 'OOoOO' + > SELECT CONCAT('OO', NULL, 'OO'); + -> NULL + > SELECT CONCAT(14.3); + -> '14.3' + + */ + class OOp_Concat : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** LOCATE(substr,str) + POSITION(substr IN str) + Returns the position of the first occurrence of substring substr in string str. Returns 0 if substr is not in str: + + > SELECT LOCATE('bar', 'foobarbar'); + -> 4 + > SELECT LOCATE('xbar', 'foobar'); + -> 0 + LOCATE(substr,str,pos) + Returns the position of the first occurrence of substring substr in string str, starting at position pos. Returns 0 if substr is not in str: + + > SELECT LOCATE('bar', 'foobarbar',5); + -> 7 + + */ + class OOp_Locate : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; - /** RTRIM(str) - Returns the string str with trailing space characters removed: + /** SUBSTRING(str,pos) + SUBSTRING(str FROM pos) + Returns a substring from string str starting at position pos: - > SELECT RTRIM('barbar '); + > SELECT SUBSTRING('Quadratically',5); + -> 'ratically' + > SELECT SUBSTRING('foobarbar' FROM 4); -> 'barbar' + SUBSTRING(str,pos,len) + SUBSTRING(str FROM pos FOR len) + Returns a substring len characters long from string str, starting at position pos. The variant form that uses FROM is SQL-92 syntax: + + > SELECT SUBSTRING('Quadratically',5,6); + -> 'ratica' + + */ + class OOp_SubString : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** LTRIM(str) + Returns the string str with leading space characters removed: - */ - class OOp_RTrim : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** SPACE(N) - Returns a string consisting of N space characters: - - > SELECT SPACE(6); - -> ' ' - - */ - class OOp_Space : public OUnaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs) const override; - }; - - /** REPLACE(str,from_str,to_str) - Returns the string str with all occurrences of the string from_str replaced by the string to_str: - - > SELECT REPLACE('www.OOo.com', 'w', 'Ww'); - -> 'WwWwWw.OOo.com' - - */ - class OOp_Replace : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** REPEAT(str,count) - Returns a string consisting of the string str repeated count times. If count <= 0, returns an empty string. Returns NULL if str or count are NULL: - - > SELECT REPEAT('OOo', 3); - -> 'OOoOOoOOo' - - */ - class OOp_Repeat : public OBinaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; - }; - - /** INSERT(str,pos,len,newstr) - Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr: - - > SELECT INSERT('Quadratic', 3, 4, 'What'); - -> 'QuWhattic' - - */ - class OOp_Insert : public ONthOperator - { - protected: - virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; - }; - - /** LEFT(str,len) - Returns the leftmost len characters from the string str: - - > SELECT LEFT('foobarbar', 5); - -> 'fooba' - - */ - class OOp_Left : public OBinaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; - }; - - /** RIGHT(str,len) - Returns the rightmost len characters from the string str: - - > SELECT RIGHT('foobarbar', 4); - -> 'rbar' - */ - class OOp_Right : public OBinaryOperator - { - protected: - virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; - }; + > SELECT LTRIM(' barbar'); + -> 'barbar' + + */ + class OOp_LTrim : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** RTRIM(str) + Returns the string str with trailing space characters removed: + + > SELECT RTRIM('barbar '); + -> 'barbar' + + */ + class OOp_RTrim : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** SPACE(N) + Returns a string consisting of N space characters: + + > SELECT SPACE(6); + -> ' ' + + */ + class OOp_Space : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const override; + }; + + /** REPLACE(str,from_str,to_str) + Returns the string str with all occurrences of the string from_str replaced by the string to_str: + + > SELECT REPLACE('www.OOo.com', 'w', 'Ww'); + -> 'WwWwWw.OOo.com' + + */ + class OOp_Replace : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** REPEAT(str,count) + Returns a string consisting of the string str repeated count times. If count <= 0, returns an empty string. Returns NULL if str or count are NULL: + + > SELECT REPEAT('OOo', 3); + -> 'OOoOOoOOo' + + */ + class OOp_Repeat : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; + }; + + /** INSERT(str,pos,len,newstr) + Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr: + + > SELECT INSERT('Quadratic', 3, 4, 'What'); + -> 'QuWhattic' + + */ + class OOp_Insert : public ONthOperator + { + protected: + virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override; + }; + + /** LEFT(str,len) + Returns the leftmost len characters from the string str: + + > SELECT LEFT('foobarbar', 5); + -> 'fooba' + + */ + class OOp_Left : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; + }; + + /** RIGHT(str,len) + Returns the rightmost len characters from the string str: + + > SELECT RIGHT('foobarbar', 4); + -> 'rbar' + */ + class OOp_Right : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override; + }; } diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx index d8bbd92d6c85..3c2e0887964e 100644 --- a/connectivity/source/inc/file/FTable.hxx +++ b/connectivity/source/inc/file/FTable.hxx @@ -27,72 +27,72 @@ #include <TResultSetHelper.hxx> namespace connectivity::file +{ + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + + class OOO_DLLPUBLIC_FILE OFileTable : public OTable_TYPEDEF { - typedef connectivity::sdbcx::OTable OTable_TYPEDEF; - - class OOO_DLLPUBLIC_FILE OFileTable : public OTable_TYPEDEF - { - protected: - OConnection* m_pConnection; - std::unique_ptr<SvStream> m_pFileStream; - ::rtl::Reference<OSQLColumns> m_aColumns; - sal_Int32 m_nFilePos; // current IResultSetHelper::Movement - std::unique_ptr<sal_uInt8[]> m_pBuffer; - sal_uInt16 m_nBufferSize; // size of the ReadBuffer, if pBuffer != NULL - bool m_bWriteable; // svstream can't say if we are writeable - // so we have to - - virtual void FileClose(); - virtual ~OFileTable( ) override; - public: - virtual void refreshColumns() override; - virtual void refreshKeys() override; - virtual void refreshIndexes() override; - public: - OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection); - OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description, - const OUString& SchemaName, - const OUString& CatalogName - ); - - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - - OConnection* getConnection() const { return m_pConnection;} - virtual sal_Int32 getCurrentLastPos() const {return -1;} - - virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0; - virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) = 0; - - const ::rtl::Reference<OSQLColumns>& getTableColumns() const {return m_aColumns;} - virtual bool InsertRow(OValueRefVector& rRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols); - virtual bool DeleteRow(const OSQLColumns& _rCols); - virtual bool UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const css::uno::Reference< css::container::XIndexAccess>& _xCols); - virtual void addColumn(const css::uno::Reference< css::beans::XPropertySet>& descriptor); - virtual void dropColumn(sal_Int32 _nPos); - // refresh the header of file based tables to see changes done by someone - virtual void refreshHeader(); - - OUString SAL_CALL getName() override { return m_Name; } - - const OUString& getSchema() const { return m_SchemaName; } - bool isReadOnly() const { return !m_bWriteable; } - // m_pFileStream && !m_pFileStream->IsWritable(); } - - sal_Int32 getFilePos() const { return m_nFilePos; } - - public: - // helper - - // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified - // (NULL or non-NULL is returned) - static std::unique_ptr<SvStream> createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode); - }; + protected: + OConnection* m_pConnection; + std::unique_ptr<SvStream> m_pFileStream; + ::rtl::Reference<OSQLColumns> m_aColumns; + sal_Int32 m_nFilePos; // current IResultSetHelper::Movement + std::unique_ptr<sal_uInt8[]> m_pBuffer; + sal_uInt16 m_nBufferSize; // size of the ReadBuffer, if pBuffer != NULL + bool m_bWriteable; // svstream can't say if we are writeable + // so we have to + + virtual void FileClose(); + virtual ~OFileTable( ) override; + public: + virtual void refreshColumns() override; + virtual void refreshKeys() override; + virtual void refreshIndexes() override; + public: + OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection); + OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description, + const OUString& SchemaName, + const OUString& CatalogName + ); + + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + + OConnection* getConnection() const { return m_pConnection;} + virtual sal_Int32 getCurrentLastPos() const {return -1;} + + virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0; + virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) = 0; + + const ::rtl::Reference<OSQLColumns>& getTableColumns() const {return m_aColumns;} + virtual bool InsertRow(OValueRefVector& rRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols); + virtual bool DeleteRow(const OSQLColumns& _rCols); + virtual bool UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const css::uno::Reference< css::container::XIndexAccess>& _xCols); + virtual void addColumn(const css::uno::Reference< css::beans::XPropertySet>& descriptor); + virtual void dropColumn(sal_Int32 _nPos); + // refresh the header of file based tables to see changes done by someone + virtual void refreshHeader(); + + OUString SAL_CALL getName() override { return m_Name; } + + const OUString& getSchema() const { return m_SchemaName; } + bool isReadOnly() const { return !m_bWriteable; } + // m_pFileStream && !m_pFileStream->IsWritable(); } + + sal_Int32 getFilePos() const { return m_nFilePos; } + + public: + // helper + + // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified + // (NULL or non-NULL is returned) + static std::unique_ptr<SvStream> createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode); + }; } diff --git a/connectivity/source/inc/file/FTables.hxx b/connectivity/source/inc/file/FTables.hxx index be2f26719700..01c198b0cdac 100644 --- a/connectivity/source/inc/file/FTables.hxx +++ b/connectivity/source/inc/file/FTables.hxx @@ -24,20 +24,20 @@ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> namespace connectivity::file +{ + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OTables : + public sdbcx::OCollection { - class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OTables : - public sdbcx::OCollection - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - public: - OTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent,_rMetaData->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) - {} + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + public: + OTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent,_rMetaData->supportsMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + {} - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - }; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + }; } diff --git a/connectivity/source/inc/file/fanalyzer.hxx b/connectivity/source/inc/file/fanalyzer.hxx index f913529d268e..9d4e12ccffa3 100644 --- a/connectivity/source/inc/file/fanalyzer.hxx +++ b/connectivity/source/inc/file/fanalyzer.hxx @@ -22,48 +22,48 @@ #include <file/fcomp.hxx> namespace connectivity::file +{ + class OConnection; + class OSQLAnalyzer final { - class OConnection; - class OSQLAnalyzer final - { - typedef std::pair< ::rtl::Reference<OPredicateCompiler>,::rtl::Reference<OPredicateInterpreter> > TPredicates; + typedef std::pair< ::rtl::Reference<OPredicateCompiler>,::rtl::Reference<OPredicateInterpreter> > TPredicates; - std::vector< TPredicates > m_aSelectionEvaluations; - ::rtl::Reference<OPredicateCompiler> m_aCompiler; - ::rtl::Reference<OPredicateInterpreter> m_aInterpreter; - OConnection* m_pConnection; + std::vector< TPredicates > m_aSelectionEvaluations; + ::rtl::Reference<OPredicateCompiler> m_aCompiler; + ::rtl::Reference<OPredicateInterpreter> m_aInterpreter; + OConnection* m_pConnection; - mutable bool m_bHasSelectionCode; - mutable bool m_bSelectionFirstTime; + mutable bool m_bHasSelectionCode; + mutable bool m_bSelectionFirstTime; - static void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow); + static void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow); - public: - OSQLAnalyzer(OConnection* _pConnection); - ~OSQLAnalyzer(); + public: + OSQLAnalyzer(OConnection* _pConnection); + ~OSQLAnalyzer(); - OConnection* getConnection() const { return m_pConnection; } - void bindEvaluationRow(OValueRefRow const & _pRow); // Bind an evaluation row to the restriction - /** bind the select columns if they contain a function which needs a row value - @param _pRow the result row - */ - void bindSelectRow(const OValueRefRow& _pRow); + OConnection* getConnection() const { return m_pConnection; } + void bindEvaluationRow(OValueRefRow const & _pRow); // Bind an evaluation row to the restriction + /** bind the select columns if they contain a function which needs a row value + @param _pRow the result row + */ + void bindSelectRow(const OValueRefRow& _pRow); - /** binds the row to parameter for the restrictions - @param _pRow the parameter row - */ - void bindParameterRow(OValueRefRow const & _pRow); + /** binds the row to parameter for the restrictions + @param _pRow the parameter row + */ + void bindParameterRow(OValueRefRow const & _pRow); - void dispose(); - void start(OSQLParseNode const * pSQLParseNode); - bool hasRestriction() const; - bool hasFunctions() const; - bool evaluateRestriction() { return m_aInterpreter->start(); } - void setSelectionEvaluationResult(OValueRefRow const & _pRow,const std::vector<sal_Int32>& _rColumnMapping); - void setOrigColumns(const css::uno::Reference< css::container::XNameAccess>& rCols); - static OOperandAttr* createOperandAttr(sal_Int32 _nPos, - const css::uno::Reference< css::beans::XPropertySet>& _xCol); - }; + void dispose(); + void start(OSQLParseNode const * pSQLParseNode); + bool hasRestriction() const; + bool hasFunctions() const; + bool evaluateRestriction() { return m_aInterpreter->start(); } + void setSelectionEvaluationResult(OValueRefRow const & _pRow,const std::vector<sal_Int32>& _rColumnMapping); + void setOrigColumns(const css::uno::Reference< css::container::XNameAccess>& rCols); + static OOperandAttr* createOperandAttr(sal_Int32 _nPos, + const css::uno::Reference< css::beans::XPropertySet>& _xCol); + }; } diff --git a/connectivity/source/inc/flat/ECatalog.hxx b/connectivity/source/inc/flat/ECatalog.hxx index d1252e464cfa..8c7ba7b1ee13 100644 --- a/connectivity/source/inc/flat/ECatalog.hxx +++ b/connectivity/source/inc/flat/ECatalog.hxx @@ -22,16 +22,16 @@ #include <file/FCatalog.hxx> namespace connectivity::flat +{ + class OFlatConnection; + class OFlatCatalog : public file::OFileCatalog { - class OFlatConnection; - class OFlatCatalog : public file::OFileCatalog - { - public: - virtual void refreshTables() override; +public: + virtual void refreshTables() override; - public: - OFlatCatalog(OFlatConnection* _pCon); - }; + public: + OFlatCatalog(OFlatConnection* _pCon); + }; } diff --git a/connectivity/source/inc/flat/EColumns.hxx b/connectivity/source/inc/flat/EColumns.hxx index e54fa8efd4b0..9a4b9d3df672 100644 --- a/connectivity/source/inc/flat/EColumns.hxx +++ b/connectivity/source/inc/flat/EColumns.hxx @@ -22,19 +22,19 @@ #include <file/FColumns.hxx> namespace connectivity::flat +{ + class OFlatColumns : public file::OColumns { - class OFlatColumns : public file::OColumns - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - public: - OFlatColumns(file::OFileTable* _pTable, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector - ) : file::OColumns(_pTable,_rMutex,_rVector) - {} + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + public: + OFlatColumns(file::OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector + ) : file::OColumns(_pTable,_rMutex,_rVector) + {} - }; + }; } diff --git a/connectivity/source/inc/flat/EConnection.hxx b/connectivity/source/inc/flat/EConnection.hxx index be7c3596d4d9..cc57b9e0f5eb 100644 --- a/connectivity/source/inc/flat/EConnection.hxx +++ b/connectivity/source/inc/flat/EConnection.hxx @@ -22,40 +22,40 @@ #include <file/FConnection.hxx> namespace connectivity::flat +{ + class ODriver; + class OFlatConnection : public file::OConnection { - class ODriver; - class OFlatConnection : public file::OConnection - { - private: - sal_Int32 m_nMaxRowsToScan; - bool m_bHeaderLine; // column names in first row - sal_Unicode m_cFieldDelimiter; // look at the name - sal_Unicode m_cStringDelimiter; - sal_Unicode m_cDecimalDelimiter; - sal_Unicode m_cThousandDelimiter; - public: - OFlatConnection(ODriver* _pDriver); - virtual ~OFlatConnection() override; - - virtual void construct(const OUString& _rUrl,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ) override; - - // own methods - bool isHeaderLine() const { return m_bHeaderLine; } - sal_Unicode getFieldDelimiter() const { return m_cFieldDelimiter; } - sal_Unicode getStringDelimiter() const { return m_cStringDelimiter; } - sal_Unicode getDecimalDelimiter() const { return m_cDecimalDelimiter; } - sal_Unicode getThousandDelimiter() const { return m_cThousandDelimiter;} - sal_Int32 getMaxRowsToScan() const { return m_nMaxRowsToScan;} - // XServiceInfo - DECLARE_SERVICE_INFO(); - - // XConnection - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - }; + private: + sal_Int32 m_nMaxRowsToScan; + bool m_bHeaderLine; // column names in first row + sal_Unicode m_cFieldDelimiter; // look at the name + sal_Unicode m_cStringDelimiter; + sal_Unicode m_cDecimalDelimiter; + sal_Unicode m_cThousandDelimiter; + public: + OFlatConnection(ODriver* _pDriver); + virtual ~OFlatConnection() override; + + virtual void construct(const OUString& _rUrl,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ) override; + + // own methods + bool isHeaderLine() const { return m_bHeaderLine; } + sal_Unicode getFieldDelimiter() const { return m_cFieldDelimiter; } + sal_Unicode getStringDelimiter() const { return m_cStringDelimiter; } + sal_Unicode getDecimalDelimiter() const { return m_cDecimalDelimiter; } + sal_Unicode getThousandDelimiter() const { return m_cThousandDelimiter;} + sal_Int32 getMaxRowsToScan() const { return m_nMaxRowsToScan;} + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + }; } diff --git a/connectivity/source/inc/flat/EDatabaseMetaData.hxx b/connectivity/source/inc/flat/EDatabaseMetaData.hxx index bd6ce7758162..e187892a7b89 100644 --- a/connectivity/source/inc/flat/EDatabaseMetaData.hxx +++ b/connectivity/source/inc/flat/EDatabaseMetaData.hxx @@ -22,22 +22,22 @@ #include <file/FDatabaseMetaData.hxx> namespace connectivity::flat - { - - //************ Class: java.sql.DatabaseMetaDataDate +{ + //************ Class: java.sql.DatabaseMetaDataDate - class OFlatDatabaseMetaData : public file::ODatabaseMetaData - { - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - protected: - virtual ~OFlatDatabaseMetaData() override; - public: - OFlatDatabaseMetaData(file::OConnection* _pCon); - virtual OUString SAL_CALL getURL( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - }; + class OFlatDatabaseMetaData : public file::ODatabaseMetaData + { + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + protected: + virtual ~OFlatDatabaseMetaData() override; + public: + OFlatDatabaseMetaData(file::OConnection* _pCon); + + virtual OUString SAL_CALL getURL( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + }; } diff --git a/connectivity/source/inc/flat/EDriver.hxx b/connectivity/source/inc/flat/EDriver.hxx index 7ed2718f2014..d46046716683 100644 --- a/connectivity/source/inc/flat/EDriver.hxx +++ b/connectivity/source/inc/flat/EDriver.hxx @@ -24,21 +24,21 @@ #include <file/FDriver.hxx> namespace connectivity::flat - { - /// @throws css::uno::Exception - css::uno::Reference< css::uno::XInterface > ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); +{ + /// @throws css::uno::Exception + css::uno::Reference< css::uno::XInterface > ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); - class ODriver : public file::OFileDriver - { - public: - ODriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) : file::OFileDriver(_rxContext){} + class ODriver : public file::OFileDriver + { + public: + ODriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) : file::OFileDriver(_rxContext){} - OUString SAL_CALL getImplementationName( ) override; - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - }; + OUString SAL_CALL getImplementationName( ) override; + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + }; } diff --git a/connectivity/source/inc/flat/EPreparedStatement.hxx b/connectivity/source/inc/flat/EPreparedStatement.hxx index ca164be8d5ba..5b51ecdf547d 100644 --- a/connectivity/source/inc/flat/EPreparedStatement.hxx +++ b/connectivity/source/inc/flat/EPreparedStatement.hxx @@ -22,16 +22,16 @@ #include <file/FPreparedStatement.hxx> namespace connectivity::flat +{ + class OConnection; + class OFlatPreparedStatement : public file::OPreparedStatement { - class OConnection; - class OFlatPreparedStatement : public file::OPreparedStatement - { - protected: - virtual rtl::Reference<file::OResultSet> createResultSet() override; - public: - OFlatPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; + protected: + virtual rtl::Reference<file::OResultSet> createResultSet() override; + public: + OFlatPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/source/inc/flat/EResultSet.hxx b/connectivity/source/inc/flat/EResultSet.hxx index 8d99ed55da04..ca2a5ab61349 100644 --- a/connectivity/source/inc/flat/EResultSet.hxx +++ b/connectivity/source/inc/flat/EResultSet.hxx @@ -24,46 +24,46 @@ #include <cppuhelper/implbase1.hxx> namespace connectivity::flat - { - class OFlatResultSet; - // these typedef's are only necessary for the compiler - typedef ::cppu::ImplHelper1< css::sdbcx::XRowLocate> OFlatResultSet_BASE; - typedef file::OResultSet OFlatResultSet_BASE2; - typedef ::comphelper::OPropertyArrayUsageHelper<OFlatResultSet> OFlatResultSet_BASE3; +{ + class OFlatResultSet; + // these typedef's are only necessary for the compiler + typedef ::cppu::ImplHelper1< css::sdbcx::XRowLocate> OFlatResultSet_BASE; + typedef file::OResultSet OFlatResultSet_BASE2; + typedef ::comphelper::OPropertyArrayUsageHelper<OFlatResultSet> OFlatResultSet_BASE3; - class OFlatResultSet : public OFlatResultSet_BASE2, - public OFlatResultSet_BASE, - public OFlatResultSet_BASE3 - { - bool m_bBookmarkable; - protected: - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - DECLARE_SERVICE_INFO(); + class OFlatResultSet : public OFlatResultSet_BASE2, + public OFlatResultSet_BASE, + public OFlatResultSet_BASE3 + { + bool m_bBookmarkable; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + DECLARE_SERVICE_INFO(); - OFlatResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + OFlatResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XRowLocate - virtual css::uno::Any SAL_CALL getBookmark( ) override; - virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; - virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; - virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; - }; + // XRowLocate + virtual css::uno::Any SAL_CALL getBookmark( ) override; + virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; + virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; + virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; + }; } diff --git a/connectivity/source/inc/flat/EStatement.hxx b/connectivity/source/inc/flat/EStatement.hxx index d30bfc70977f..49e513cfb5ea 100644 --- a/connectivity/source/inc/flat/EStatement.hxx +++ b/connectivity/source/inc/flat/EStatement.hxx @@ -22,16 +22,16 @@ #include <file/FStatement.hxx> namespace connectivity::flat +{ + class OConnection; + class OFlatStatement : public file::OStatement { - class OConnection; - class OFlatStatement : public file::OStatement - { - protected: - virtual rtl::Reference<file::OResultSet> createResultSet() override; - public: - OFlatStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; + protected: + virtual rtl::Reference<file::OResultSet> createResultSet() override; + public: + OFlatStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; } diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx index 99359edfddaa..0178d32c53ee 100644 --- a/connectivity/source/inc/flat/ETable.hxx +++ b/connectivity/source/inc/flat/ETable.hxx @@ -27,73 +27,73 @@ #include <com/sun/star/util/XNumberFormatter.hpp> namespace connectivity::flat - { - typedef file::OFileTable OFlatTable_BASE; - class OFlatConnection; +{ + typedef file::OFileTable OFlatTable_BASE; + class OFlatConnection; - typedef std::pair<sal_Int32, sal_Int32> TRowPositionInFile; + typedef std::pair<sal_Int32, sal_Int32> TRowPositionInFile; - class OFlatTable : public OFlatTable_BASE + class OFlatTable : public OFlatTable_BASE + { + // maps a row position to a file position + // row n is positions [m_aRowPosToFilePos[n]->first, m_aRowPosToFilePos[n]->second) in file + // "real" row indexes start at 1; for the purposes of m_aRowPosToFilePos, row 0 is headers + std::vector<TRowPositionInFile> + m_aRowPosToFilePos; + std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset + std::vector<sal_Int32> m_aPrecisions; // same as aboth + std::vector<sal_Int32> m_aScales; + QuotedTokenizedString m_aCurrentLine; + css::uno::Reference< css::util::XNumberFormatter > m_xNumberFormatter; + css::util::Date m_aNullDate; + sal_Int32 m_nRowPos; + sal_Int32 m_nMaxRowCount; // will be set if stream is once eof + sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter + sal_Unicode m_cFieldDelimiter; // look at the name + bool m_bNeedToReadLine; + private: + void fillColumns(const css::lang::Locale& _aLocale); + bool readLine(sal_Int32 *pEndPos, sal_Int32 *pStartPos, bool nonEmpty = false); + void setRowPos(std::vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos); + void impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2, + sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, OUString& o_sTypeName, + const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass); + OFlatConnection* getFlatConnection() { - // maps a row position to a file position - // row n is positions [m_aRowPosToFilePos[n]->first, m_aRowPosToFilePos[n]->second) in file - // "real" row indexes start at 1; for the purposes of m_aRowPosToFilePos, row 0 is headers - std::vector<TRowPositionInFile> - m_aRowPosToFilePos; - std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset - std::vector<sal_Int32> m_aPrecisions; // same as aboth - std::vector<sal_Int32> m_aScales; - QuotedTokenizedString m_aCurrentLine; - css::uno::Reference< css::util::XNumberFormatter > m_xNumberFormatter; - css::util::Date m_aNullDate; - sal_Int32 m_nRowPos; - sal_Int32 m_nMaxRowCount; // will be set if stream is once eof - sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter - sal_Unicode m_cFieldDelimiter; // look at the name - bool m_bNeedToReadLine; - private: - void fillColumns(const css::lang::Locale& _aLocale); - bool readLine(sal_Int32 *pEndPos, sal_Int32 *pStartPos, bool nonEmpty = false); - void setRowPos(std::vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos); - void impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2, - sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, OUString& o_sTypeName, - const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass); - OFlatConnection* getFlatConnection() - { #if OSL_DEBUG_LEVEL > 0 - OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection); - assert(pConnection); + OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection); + assert(pConnection); #else - OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection); + OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection); #endif - return pConnection; - } - public: - virtual void refreshColumns() override; + return pConnection; + } + public: + virtual void refreshColumns() override; - public: - // DECLARE_CTY_DEFAULTS( OFlatTable_BASE); - OFlatTable( sdbcx::OCollection* _pTables,OFlatConnection* _pConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description = OUString(), - const OUString& SchemaName = OUString(), - const OUString& CatalogName = OUString() - ); + public: + // DECLARE_CTY_DEFAULTS( OFlatTable_BASE); + OFlatTable( sdbcx::OCollection* _pTables,OFlatConnection* _pConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description = OUString(), + const OUString& SchemaName = OUString(), + const OUString& CatalogName = OUString() + ); - void construct() override; // can throw any exception + void construct() override; // can throw any exception - virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override; - virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override; - virtual void refreshHeader() override; + virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override; + virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override; + virtual void refreshHeader() override; - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - virtual void SAL_CALL disposing() override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual void SAL_CALL disposing() override; - OUString getEntry() const; - }; + OUString getEntry() const; + }; } diff --git a/connectivity/source/inc/hsqldb/HCatalog.hxx b/connectivity/source/inc/hsqldb/HCatalog.hxx index 8d1da42de111..efd397e3da43 100644 --- a/connectivity/source/inc/hsqldb/HCatalog.hxx +++ b/connectivity/source/inc/hsqldb/HCatalog.hxx @@ -21,39 +21,39 @@ #include <sdbcx/VCatalog.hxx> namespace connectivity::hsqldb +{ + // please don't name the class the same name as in another namespaces + // some compilers have problems with this task as I noticed on windows + class OHCatalog : public connectivity::sdbcx::OCatalog { - // please don't name the class the same name as in another namespaces - // some compilers have problems with this task as I noticed on windows - class OHCatalog : public connectivity::sdbcx::OCatalog - { - css::uno::Reference< css::sdbc::XConnection > m_xConnection; - - /** calls XDatabaseMetaData::getTables. - @param _sKindOfObject - The type of tables to be fetched. - @param _rNames - The container for the names to be filled. - */ - void refreshObjects(const css::uno::Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames); - - public: - // implementation of the pure virtual methods - virtual void refreshTables() override; - virtual void refreshViews() override ; - virtual void refreshGroups() override; - virtual void refreshUsers() override ; - - public: - OHCatalog(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); - - sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } - sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); } - const css::uno::Reference< css::sdbc::XConnection >& getConnection() const { return m_xConnection; } - - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - // ::cppu::OComponentHelper - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - }; + css::uno::Reference< css::sdbc::XConnection > m_xConnection; + + /** calls XDatabaseMetaData::getTables. + @param _sKindOfObject + The type of tables to be fetched. + @param _rNames + The container for the names to be filled. + */ + void refreshObjects(const css::uno::Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames); + + public: + // implementation of the pure virtual methods + virtual void refreshTables() override; + virtual void refreshViews() override ; + virtual void refreshGroups() override; + virtual void refreshUsers() override ; + + public: + OHCatalog(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); + + sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } + sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); } + const css::uno::Reference< css::sdbc::XConnection >& getConnection() const { return m_xConnection; } + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + // ::cppu::OComponentHelper + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + }; } diff --git a/connectivity/source/inc/hsqldb/HColumns.hxx b/connectivity/source/inc/hsqldb/HColumns.hxx index c27645f45891..2dd8881d04d1 100644 --- a/connectivity/source/inc/hsqldb/HColumns.hxx +++ b/connectivity/source/inc/hsqldb/HColumns.hxx @@ -21,35 +21,35 @@ #include <connectivity/sdbcx/VColumn.hxx> namespace connectivity::hsqldb +{ + class OHSQLColumns : public OColumnsHelper { - class OHSQLColumns : public OColumnsHelper - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - public: - OHSQLColumns( ::cppu::OWeakObject& _rParent - ,::osl::Mutex& _rMutex - ,const ::std::vector< OUString> &_rVector - ); - }; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + public: + OHSQLColumns( ::cppu::OWeakObject& _rParent + ,::osl::Mutex& _rMutex + ,const ::std::vector< OUString> &_rVector + ); + }; - class OHSQLColumn; - typedef ::comphelper::OIdPropertyArrayUsageHelper<OHSQLColumn> OHSQLColumn_PROP; + class OHSQLColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OHSQLColumn> OHSQLColumn_PROP; - class OHSQLColumn : public sdbcx::OColumn, - public OHSQLColumn_PROP - { - OUString m_sAutoIncrement; - protected: - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + class OHSQLColumn : public sdbcx::OColumn, + public OHSQLColumn_PROP + { + OUString m_sAutoIncrement; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OHSQLColumn(); - virtual void construct() override; + public: + OHSQLColumn(); + virtual void construct() override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - }; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + }; } diff --git a/connectivity/source/inc/hsqldb/HConnection.hxx b/connectivity/source/inc/hsqldb/HConnection.hxx index f319287774ef..29763b433ccf 100644 --- a/connectivity/source/inc/hsqldb/HConnection.hxx +++ b/connectivity/source/inc/hsqldb/HConnection.hxx @@ -29,110 +29,110 @@ #include <comphelper/interfacecontainer2.hxx> namespace connectivity::hsqldb +{ + class SAL_NO_VTABLE IMethodGuardAccess { - class SAL_NO_VTABLE IMethodGuardAccess - { - public: - virtual ::osl::Mutex& getMutex() const = 0; - virtual void checkDisposed() const = 0; + public: + virtual ::osl::Mutex& getMutex() const = 0; + virtual void checkDisposed() const = 0; - protected: - ~IMethodGuardAccess() {} - }; + protected: + ~IMethodGuardAccess() {} + }; - // OHsqlConnection - wraps all methods to the real connection from the driver - // but when disposed it doesn't dispose the real connection + // OHsqlConnection - wraps all methods to the real connection from the driver + // but when disposed it doesn't dispose the real connection - typedef ::cppu::ImplInheritanceHelper< OConnectionWrapper - , css::util::XFlushable - , css::sdb::application::XTableUIProvider - > OHsqlConnection_BASE; + typedef ::cppu::ImplInheritanceHelper< OConnectionWrapper + , css::util::XFlushable + , css::sdb::application::XTableUIProvider + > OHsqlConnection_BASE; - class OHsqlConnection :public OHsqlConnection_BASE - ,public IMethodGuardAccess - { - private: - ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners; - css::uno::Reference< css::sdbc::XDriver > m_xDriver; - css::uno::Reference< css::uno::XComponentContext > m_xContext; - bool m_bIni; - bool m_bReadOnly; - - protected: - virtual void SAL_CALL disposing() override; - virtual ~OHsqlConnection() override; - - public: - OHsqlConnection( - const css::uno::Reference< css::sdbc::XDriver >& _rxDriver, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection, - const css::uno::Reference< css::uno::XComponentContext>& _rxContext - ); - - // XServiceInfo - DECLARE_SERVICE_INFO(); - - // IMethodGuardAccess - virtual ::osl::Mutex& getMutex() const override; - virtual void checkDisposed() const override; - - // XFlushable - virtual void SAL_CALL flush( ) override; - virtual void SAL_CALL addFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override; - virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override; - - // XTableUIProvider - virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getTableIcon( const OUString& TableName, ::sal_Int32 ColorMode ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getTableEditor( const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& DocumentUI, const OUString& TableName ) override; - - private: - - /** retrieves our table container - @return - our table container. Guaranteed to not be <NULL/>. - @throws css::lang::WrappedTargetException - if a non-RuntimeException is caught during obtaining the container. - @throws css::uno::RuntimeException - if a serious error occurs - @precond - We're not disposed. - */ - css::uno::Reference< css::container::XNameAccess > - impl_getTableContainer_throw(); - - /** checks whether the given table name denotes an existing table - @param _rTableName - the fully name of the table to check for existence - @throws css::lang::IllegalArgumentException - if the name does not denote an existing table - @precond - We're not disposed. - */ - void impl_checkExistingTable_throw( const OUString& _rTableName ); - - /** checks whether the given table name refers to a HSQL TEXT TABLE - */ - bool impl_isTextTable_nothrow( const OUString& _rTableName ); - - /** retrieves the icon for HSQL TEXT TABLEs - */ - css::uno::Reference< css::graphic::XGraphic > - impl_getTextTableIcon_nothrow(); - }; - - - // OHsqlConnection - - class MethodGuard : public ::osl::MutexGuard + class OHsqlConnection :public OHsqlConnection_BASE + ,public IMethodGuardAccess + { + private: + ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners; + css::uno::Reference< css::sdbc::XDriver > m_xDriver; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + bool m_bIni; + bool m_bReadOnly; + + protected: + virtual void SAL_CALL disposing() override; + virtual ~OHsqlConnection() override; + + public: + OHsqlConnection( + const css::uno::Reference< css::sdbc::XDriver >& _rxDriver, + const css::uno::Reference< css::sdbc::XConnection >& _xConnection, + const css::uno::Reference< css::uno::XComponentContext>& _rxContext + ); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // IMethodGuardAccess + virtual ::osl::Mutex& getMutex() const override; + virtual void checkDisposed() const override; + + // XFlushable + virtual void SAL_CALL flush( ) override; + virtual void SAL_CALL addFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override; + virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override; + + // XTableUIProvider + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getTableIcon( const OUString& TableName, ::sal_Int32 ColorMode ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getTableEditor( const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& DocumentUI, const OUString& TableName ) override; + + private: + + /** retrieves our table container + @return + our table container. Guaranteed to not be <NULL/>. + @throws css::lang::WrappedTargetException + if a non-RuntimeException is caught during obtaining the container. + @throws css::uno::RuntimeException + if a serious error occurs + @precond + We're not disposed. + */ + css::uno::Reference< css::container::XNameAccess > + impl_getTableContainer_throw(); + + /** checks whether the given table name denotes an existing table + @param _rTableName + the fully name of the table to check for existence + @throws css::lang::IllegalArgumentException + if the name does not denote an existing table + @precond + We're not disposed. + */ + void impl_checkExistingTable_throw( const OUString& _rTableName ); + + /** checks whether the given table name refers to a HSQL TEXT TABLE + */ + bool impl_isTextTable_nothrow( const OUString& _rTableName ); + + /** retrieves the icon for HSQL TEXT TABLEs + */ + css::uno::Reference< css::graphic::XGraphic > + impl_getTextTableIcon_nothrow(); + }; + + + // OHsqlConnection + + class MethodGuard : public ::osl::MutexGuard + { + public: + MethodGuard( const IMethodGuardAccess& _rComponent ) + : ::osl::MutexGuard( _rComponent.getMutex() ) { - public: - MethodGuard( const IMethodGuardAccess& _rComponent ) - : ::osl::MutexGuard( _rComponent.getMutex() ) - { - _rComponent.checkDisposed(); - } - }; + _rComponent.checkDisposed(); + } + }; } diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx index 8ea41aaa12d6..7b4735517fd5 100644 --- a/connectivity/source/inc/hsqldb/HDriver.hxx +++ b/connectivity/source/inc/hsqldb/HDriver.hxx @@ -31,96 +31,96 @@ namespace connectivity::hsqldb +{ + class OHCatalog; + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver + , css::sdbcx::XDataDefinitionSupplier + , css::lang::XServiceInfo + , css::sdbcx::XCreateCatalog + , css::embed::XTransactionListener + > ODriverDelegator_BASE; + + struct TConnectionInfo { - class OHCatalog; + css::uno::WeakReference<css::sdbc::XConnection> xOrigConn; + OUString sKey; + css::uno::WeakReference<css::sdbc::XConnection> xConn; + unotools::WeakReference<OHCatalog> xCatalog; + }; - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver - , css::sdbcx::XDataDefinitionSupplier - , css::lang::XServiceInfo - , css::sdbcx::XCreateCatalog - , css::embed::XTransactionListener - > ODriverDelegator_BASE; - struct TConnectionInfo - { - css::uno::WeakReference<css::sdbc::XConnection> xOrigConn; - OUString sKey; - css::uno::WeakReference<css::sdbc::XConnection> xConn; - unotools::WeakReference<OHCatalog> xCatalog; - }; + /** delegates all calls to the original driver and extend the existing one with the SDBCX layer. + */ + class ODriverDelegator final : public ::cppu::BaseMutex + ,public ODriverDelegator_BASE + { + std::vector<TConnectionInfo> m_aConnections; // vector containing a list + // of all the Connection objects + // for this Driver + css::uno::Reference< css::sdbc::XDriver > m_xDriver; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + bool m_bInShutDownConnections; + + /** load the driver we want to delegate. + The <member>m_xDriver</member> may be <NULL/> if the driver could not be loaded. + @return + The driver which was currently selected. + */ + css::uno::Reference< css::sdbc::XDriver > const & loadDriver( ); - /** delegates all calls to the original driver and extend the existing one with the SDBCX layer. + /** shut down the connection and revoke the storage from the map + @param _aIter + The connection to shut down and storage to revoke. + */ + void shutdownConnection(const std::vector<TConnectionInfo>::iterator& _aIter); + public: + /** creates a new delegator for a HSQLDB driver + */ + ODriverDelegator(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Int32 SAL_CALL getMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getMinorVersion( ) override; + + // XDataDefinitionSupplier + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override; + virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + + // XCreateCatalog + virtual void SAL_CALL createCatalog( const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XTransactionListener + virtual void SAL_CALL preCommit( const css::lang::EventObject& aEvent ) override; + virtual void SAL_CALL commited( const css::lang::EventObject& aEvent ) override; + virtual void SAL_CALL preRevert( const css::lang::EventObject& aEvent ) override; + virtual void SAL_CALL reverted( const css::lang::EventObject& aEvent ) override; + + void shutdownConnections(); + void flushConnections(); + private: + /// dtor + virtual ~ODriverDelegator() override; + // OComponentHelper + virtual void SAL_CALL disposing() override; + + /** called when we connected to a newly created embedded database */ - class ODriverDelegator final : public ::cppu::BaseMutex - ,public ODriverDelegator_BASE - { - std::vector<TConnectionInfo> m_aConnections; // vector containing a list - // of all the Connection objects - // for this Driver - css::uno::Reference< css::sdbc::XDriver > m_xDriver; - css::uno::Reference< css::uno::XComponentContext > m_xContext; - bool m_bInShutDownConnections; - - /** load the driver we want to delegate. - The <member>m_xDriver</member> may be <NULL/> if the driver could not be loaded. - @return - The driver which was currently selected. - */ - css::uno::Reference< css::sdbc::XDriver > const & loadDriver( ); - - /** shut down the connection and revoke the storage from the map - @param _aIter - The connection to shut down and storage to revoke. - */ - void shutdownConnection(const std::vector<TConnectionInfo>::iterator& _aIter); - - public: - /** creates a new delegator for a HSQLDB driver - */ - ODriverDelegator(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); - - // XServiceInfo - DECLARE_SERVICE_INFO(); - - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Int32 SAL_CALL getMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getMinorVersion( ) override; - - // XDataDefinitionSupplier - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - - // XCreateCatalog - virtual void SAL_CALL createCatalog( const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - // XTransactionListener - virtual void SAL_CALL preCommit( const css::lang::EventObject& aEvent ) override; - virtual void SAL_CALL commited( const css::lang::EventObject& aEvent ) override; - virtual void SAL_CALL preRevert( const css::lang::EventObject& aEvent ) override; - virtual void SAL_CALL reverted( const css::lang::EventObject& aEvent ) override; - - void shutdownConnections(); - void flushConnections(); - private: - /// dtor - virtual ~ODriverDelegator() override; - // OComponentHelper - virtual void SAL_CALL disposing() override; - - /** called when we connected to a newly created embedded database - */ - void onConnectedNewDatabase( - const css::uno::Reference< css::sdbc::XConnection >& _rxConnection - ); - }; + void onConnectedNewDatabase( + const css::uno::Reference< css::sdbc::XConnection >& _rxConnection + ); + }; } // namespace connectivity::hsqldb diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx index 1186c680ac07..f0ec7d87e264 100644 --- a/connectivity/source/inc/hsqldb/HStorageMap.hxx +++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx @@ -42,54 +42,54 @@ #include <uno/environment.hxx> namespace connectivity::hsqldb +{ + class StreamHelper { - class StreamHelper - { - css::uno::Reference< css::io::XStream> m_xStream; - css::uno::Reference< css::io::XSeekable> m_xSeek; - css::uno::Reference< css::io::XOutputStream> m_xOutputStream; - css::uno::Reference< css::io::XInputStream> m_xInputStream; - public: - StreamHelper(const css::uno::Reference< css::io::XStream>& _xStream); - ~StreamHelper(); - - css::uno::Reference< css::io::XInputStream> const & getInputStream(); - css::uno::Reference< css::io::XOutputStream> const & getOutputStream(); - css::uno::Reference< css::io::XSeekable> const & getSeek(); - }; - - - typedef std::map< OUString, std::shared_ptr<StreamHelper> > TStreamMap; - - struct StorageData { - css::uno::Reference<css::embed::XStorage> storage; - css::uno::Environment storageEnvironment; - OUString url; - TStreamMap streams; - - css::uno::Reference<css::embed::XStorage> mapStorage() const; - }; - - typedef std::map<OUString, StorageData> TStorages; - /** contains all storages so far accessed. - */ - class StorageContainer - { - public: - static OUString registerStorage(const css::uno::Reference< css::embed::XStorage>& _xStorage,const OUString& _sURL); - static TStorages::mapped_type getRegisteredStorage(const OUString& _sKey); - static OUString getRegisteredKey(const css::uno::Reference< css::embed::XStorage>& _xStorage); - static void revokeStorage(const OUString& _sKey,const css::uno::Reference< css::embed::XTransactionListener>& _xListener); - - static TStreamMap::mapped_type registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode); - static void revokeStream(JNIEnv * env,jstring name, jstring key); - static TStreamMap::mapped_type getRegisteredStream( JNIEnv * env, jstring name, jstring key); - - static OUString jstring2ustring(JNIEnv * env, jstring jstr); - static OUString removeURLPrefix(std::u16string_view _sURL, std::u16string_view _sFileURL); - static OUString removeOldURLPrefix(const OUString& _sURL); - static void throwJavaException(const css::uno::Exception& _aException,JNIEnv * env); - }; + css::uno::Reference< css::io::XStream> m_xStream; + css::uno::Reference< css::io::XSeekable> m_xSeek; + css::uno::Reference< css::io::XOutputStream> m_xOutputStream; + css::uno::Reference< css::io::XInputStream> m_xInputStream; + public: + StreamHelper(const css::uno::Reference< css::io::XStream>& _xStream); + ~StreamHelper(); + + css::uno::Reference< css::io::XInputStream> const & getInputStream(); + css::uno::Reference< css::io::XOutputStream> const & getOutputStream(); + css::uno::Reference< css::io::XSeekable> const & getSeek(); + }; + + + typedef std::map< OUString, std::shared_ptr<StreamHelper> > TStreamMap; + + struct StorageData { + css::uno::Reference<css::embed::XStorage> storage; + css::uno::Environment storageEnvironment; + OUString url; + TStreamMap streams; + + css::uno::Reference<css::embed::XStorage> mapStorage() const; + }; + + typedef std::map<OUString, StorageData> TStorages; + /** contains all storages so far accessed. + */ + class StorageContainer + { + public: + static OUString registerStorage(const css::uno::Reference< css::embed::XStorage>& _xStorage,const OUString& _sURL); + static TStorages::mapped_type getRegisteredStorage(const OUString& _sKey); + static OUString getRegisteredKey(const css::uno::Reference< css::embed::XStorage>& _xStorage); + static void revokeStorage(const OUString& _sKey,const css::uno::Reference< css::embed::XTransactionListener>& _xListener); + + static TStreamMap::mapped_type registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode); + static void revokeStream(JNIEnv * env,jstring name, jstring key); + static TStreamMap::mapped_type getRegisteredStream( JNIEnv * env, jstring name, jstring key); + + static OUString jstring2ustring(JNIEnv * env, jstring jstr); + static OUString removeURLPrefix(std::u16string_view _sURL, std::u16string_view _sFileURL); + static OUString removeOldURLPrefix(const OUString& _sURL); + static void throwJavaException(const css::uno::Exception& _aException,JNIEnv * env); + }; } // namespace connectivity::hsqldb diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx index d6ac5ced7646..4b29ea0b5a7f 100644 --- a/connectivity/source/inc/hsqldb/HTable.hxx +++ b/connectivity/source/inc/hsqldb/HTable.hxx @@ -27,85 +27,85 @@ #include <comphelper/IdPropArrayHelper.hxx> namespace connectivity::hsqldb - { - - class OHSQLTable; - typedef ::comphelper::OIdPropertyArrayUsageHelper< OHSQLTable > OHSQLTable_PROP; - class OHSQLTable : public OTableHelper - ,public OHSQLTable_PROP - { - sal_Int32 m_nPrivileges; // we have to set our privileges by our own - - /** executes the statement. - @param _rStatement - The statement to execute. - */ - void executeStatement(const OUString& _rStatement ); - protected: - - /** creates the column collection for the table - @param _rNames - The column names. - */ - virtual sdbcx::OCollection* createColumns(const ::std::vector< OUString>& _rNames) override; - - /** creates the key collection for the table - @param _rNames - The key names. - */ - virtual sdbcx::OCollection* createKeys(const ::std::vector< OUString>& _rNames) override; +{ - /** creates the index collection for the table - @param _rNames - The index names. - */ - virtual sdbcx::OCollection* createIndexes(const ::std::vector< OUString>& _rNames) override; + class OHSQLTable; + typedef ::comphelper::OIdPropertyArrayUsageHelper< OHSQLTable > OHSQLTable_PROP; + class OHSQLTable : public OTableHelper + ,public OHSQLTable_PROP + { + sal_Int32 m_nPrivileges; // we have to set our privileges by our own - /** used to implement the creation of the array helper which is shared amongst all instances of the class. - This method needs to be implemented in derived classes. - <BR> - The method gets called with s_aMutex acquired. - @return a pointer to the newly created array helper. Must not be NULL. - */ - virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - public: - OHSQLTable( sdbcx::OCollection* _pTables, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection); - OHSQLTable( sdbcx::OCollection* _pTables, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description, - const OUString& SchemaName, - const OUString& CatalogName, - sal_Int32 _nPrivileges - ); - - // ODescriptor - virtual void construct() override; - - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XAlterTable - virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - - // XRename - virtual void SAL_CALL rename( const OUString& newName ) override; - - /** - returns the ALTER TABLE XXX COLUMN statement + /** executes the statement. + @param _rStatement + The statement to execute. */ - OUString getAlterTableColumnPart() const; - - // some methods to alter table structures - void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor); - void alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName); - void dropDefaultValue(const OUString& _sNewDefault); - - }; + void executeStatement(const OUString& _rStatement ); + protected: + + /** creates the column collection for the table + @param _rNames + The column names. + */ + virtual sdbcx::OCollection* createColumns(const ::std::vector< OUString>& _rNames) override; + + /** creates the key collection for the table + @param _rNames + The key names. + */ + virtual sdbcx::OCollection* createKeys(const ::std::vector< OUString>& _rNames) override; + + /** creates the index collection for the table + @param _rNames + The index names. + */ + virtual sdbcx::OCollection* createIndexes(const ::std::vector< OUString>& _rNames) override; + + /** used to implement the creation of the array helper which is shared amongst all instances of the class. + This method needs to be implemented in derived classes. + <BR> + The method gets called with s_aMutex acquired. + @return a pointer to the newly created array helper. Must not be NULL. + */ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + public: + OHSQLTable( sdbcx::OCollection* _pTables, + const css::uno::Reference< css::sdbc::XConnection >& _xConnection); + OHSQLTable( sdbcx::OCollection* _pTables, + const css::uno::Reference< css::sdbc::XConnection >& _xConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description, + const OUString& SchemaName, + const OUString& CatalogName, + sal_Int32 _nPrivileges + ); + + // ODescriptor + virtual void construct() override; + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XAlterTable + virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + + // XRename + virtual void SAL_CALL rename( const OUString& newName ) override; + + /** + returns the ALTER TABLE XXX COLUMN statement + */ + OUString getAlterTableColumnPart() const; + + // some methods to alter table structures + void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor); + void alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName); + void dropDefaultValue(const OUString& _sNewDefault); + + }; } diff --git a/connectivity/source/inc/hsqldb/HTables.hxx b/connectivity/source/inc/hsqldb/HTables.hxx index d889ff686cae..cd255f08ed71 100644 --- a/connectivity/source/inc/hsqldb/HTables.hxx +++ b/connectivity/source/inc/hsqldb/HTables.hxx @@ -22,31 +22,31 @@ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #include <utility> namespace connectivity::hsqldb +{ + class OTables final : public sdbcx::OCollection { - class OTables final : public sdbcx::OCollection - { - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; - void createTable( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); - virtual OUString getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject) override; - public: - OTables(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) - ,m_xMetaData(std::move(_xMetaData)) - {} + void createTable( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); + virtual OUString getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject) override; + public: + OTables(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) + ,m_xMetaData(std::move(_xMetaData)) + {} - // only the name is identical to ::cppu::OComponentHelper - virtual void disposing() override; + // only the name is identical to ::cppu::OComponentHelper + virtual void disposing() override; - // XDrop - void appendNew(const OUString& _rsNewTable); - }; + // XDrop + void appendNew(const OUString& _rsNewTable); + }; } diff --git a/connectivity/source/inc/hsqldb/HUser.hxx b/connectivity/source/inc/hsqldb/HUser.hxx index 67c44e185bd2..feb3daf284c6 100644 --- a/connectivity/source/inc/hsqldb/HUser.hxx +++ b/connectivity/source/inc/hsqldb/HUser.hxx @@ -23,50 +23,50 @@ #include <com/sun/star/sdbc/XConnection.hpp> namespace connectivity::hsqldb - { - typedef connectivity::sdbcx::OUser OUser_TYPEDEF; +{ + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; - class OHSQLUser : public OUser_TYPEDEF - { - css::uno::Reference< css::sdbc::XConnection > m_xConnection; + class OHSQLUser : public OUser_TYPEDEF + { + css::uno::Reference< css::sdbc::XConnection > m_xConnection; - static OUString getPrivilegeString(sal_Int32 nRights); - // return the privileges and additional the grant rights - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant); - public: - virtual void refreshGroups() override; - public: - OHSQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection); - OHSQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection, const OUString& Name); + static OUString getPrivilegeString(sal_Int32 nRights); + // return the privileges and additional the grant rights + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant); + public: + virtual void refreshGroups() override; + public: + OHSQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection); + OHSQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection, const OUString& Name); - // XUser - virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; - // XAuthorizable - virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - }; + // XUser + virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + }; - class OUserExtend; - typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; - class OUserExtend : public OHSQLUser, - public OUserExtend_PROP - { - OUString m_Password; - protected: - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OUserExtend(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); + class OUserExtend : public OHSQLUser, + public OUserExtend_PROP + { + OUString m_Password; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OUserExtend(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); - virtual void construct() override; - }; + virtual void construct() override; + }; } diff --git a/connectivity/source/inc/hsqldb/HViews.hxx b/connectivity/source/inc/hsqldb/HViews.hxx index b71b1c87a66e..e1f035dbcf8b 100644 --- a/connectivity/source/inc/hsqldb/HViews.hxx +++ b/connectivity/source/inc/hsqldb/HViews.hxx @@ -21,30 +21,30 @@ #include <connectivity/sdbcx/VCollection.hxx> #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> namespace connectivity::hsqldb +{ + class HViews final : public sdbcx::OCollection { - class HViews final : public sdbcx::OCollection - { - css::uno::Reference< css::sdbc::XConnection > m_xConnection; - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - bool m_bInDrop; + css::uno::Reference< css::sdbc::XConnection > m_xConnection; + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + bool m_bInDrop; - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; - void createView( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); - public: - HViews( - const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, - ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::std::vector< OUString> &_rVector ); + void createView( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); + public: + HViews( + const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, + ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::std::vector< OUString> &_rVector ); - // only the name is identical to ::cppu::OComponentHelper - virtual void disposing() override; + // only the name is identical to ::cppu::OComponentHelper + virtual void disposing() override; - void dropByNameImpl(const OUString& elementName); - }; + void dropByNameImpl(const OUString& elementName); + }; } diff --git a/connectivity/source/inc/mysql/YCatalog.hxx b/connectivity/source/inc/mysql/YCatalog.hxx index 5eb348af997d..f8d6156f480a 100644 --- a/connectivity/source/inc/mysql/YCatalog.hxx +++ b/connectivity/source/inc/mysql/YCatalog.hxx @@ -21,39 +21,39 @@ #include <sdbcx/VCatalog.hxx> namespace connectivity::mysql +{ + // please don't name the class the same name as in another namespaces + // some compilers have problems with this task as I noticed on windows + class OMySQLCatalog : public connectivity::sdbcx::OCatalog { - // please don't name the class the same name as in another namespaces - // some compilers have problems with this task as I noticed on windows - class OMySQLCatalog : public connectivity::sdbcx::OCatalog - { - css::uno::Reference< css::sdbc::XConnection > m_xConnection; - - /** calls XDatabaseMetaData::getTables. - @param _sKindOfObject - The type of tables to be fetched. - @param _rNames - The container for the names to be filled. <OUT/> - */ - void refreshObjects(const css::uno::Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames); - - public: - // implementation of the pure virtual methods - virtual void refreshTables() override; - virtual void refreshViews() override ; - virtual void refreshGroups() override; - virtual void refreshUsers() override ; - - public: - OMySQLCatalog(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); - - sdbcx::OCollection* getPrivateTables() const { return m_pTables.get();} - sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); } - const css::uno::Reference< css::sdbc::XConnection >& getConnection() const { return m_xConnection; } - - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - // ::cppu::OComponentHelper - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - }; + css::uno::Reference< css::sdbc::XConnection > m_xConnection; + + /** calls XDatabaseMetaData::getTables. + @param _sKindOfObject + The type of tables to be fetched. + @param _rNames + The container for the names to be filled. <OUT/> + */ + void refreshObjects(const css::uno::Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames); + + public: + // implementation of the pure virtual methods + virtual void refreshTables() override; + virtual void refreshViews() override ; + virtual void refreshGroups() override; + virtual void refreshUsers() override ; + + public: + OMySQLCatalog(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); + + sdbcx::OCollection* getPrivateTables() const { return m_pTables.get();} + sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); } + const css::uno::Reference< css::sdbc::XConnection >& getConnection() const { return m_xConnection; } + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + // ::cppu::OComponentHelper + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + }; } diff --git a/connectivity/source/inc/mysql/YColumns.hxx b/connectivity/source/inc/mysql/YColumns.hxx index 1ffcfc95338b..88102c2fb864 100644 --- a/connectivity/source/inc/mysql/YColumns.hxx +++ b/connectivity/source/inc/mysql/YColumns.hxx @@ -21,35 +21,35 @@ #include <connectivity/sdbcx/VColumn.hxx> namespace connectivity::mysql +{ + class OMySQLColumns : public OColumnsHelper { - class OMySQLColumns : public OColumnsHelper - { - protected: - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - public: - OMySQLColumns( ::cppu::OWeakObject& _rParent - ,::osl::Mutex& _rMutex - ,const ::std::vector< OUString> &_rVector - ); - }; + protected: + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + public: + OMySQLColumns( ::cppu::OWeakObject& _rParent + ,::osl::Mutex& _rMutex + ,const ::std::vector< OUString> &_rVector + ); + }; - class OMySQLColumn; - typedef ::comphelper::OIdPropertyArrayUsageHelper<OMySQLColumn> OMySQLColumn_PROP; + class OMySQLColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OMySQLColumn> OMySQLColumn_PROP; - class OMySQLColumn : public sdbcx::OColumn, - public OMySQLColumn_PROP - { - OUString m_sAutoIncrement; - protected: - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + class OMySQLColumn : public sdbcx::OColumn, + public OMySQLColumn_PROP + { + OUString m_sAutoIncrement; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OMySQLColumn(); - virtual void construct() override; + public: + OMySQLColumn(); + virtual void construct() override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - }; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + }; } diff --git a/connectivity/source/inc/mysql/YTable.hxx b/connectivity/source/inc/mysql/YTable.hxx index c891b7d7d95e..7e01a085423f 100644 --- a/connectivity/source/inc/mysql/YTable.hxx +++ b/connectivity/source/inc/mysql/YTable.hxx @@ -27,85 +27,85 @@ #include <comphelper/IdPropArrayHelper.hxx> namespace connectivity::mysql - { - - class OMySQLTable; - typedef ::comphelper::OIdPropertyArrayUsageHelper< OMySQLTable > OMySQLTable_PROP; - class OMySQLTable : public OTableHelper - ,public OMySQLTable_PROP - { - sal_Int32 m_nPrivileges; // we have to set our privileges by our own - - /** executes the statement. - @param _rStatement - The statement to execute. - */ - void executeStatement(const OUString& _rStatement ); - protected: - - /** creates the column collection for the table - @param _rNames - The column names. - */ - virtual sdbcx::OCollection* createColumns(const ::std::vector< OUString>& _rNames) override; - - /** creates the key collection for the table - @param _rNames - The key names. - */ - virtual sdbcx::OCollection* createKeys(const ::std::vector< OUString>& _rNames) override; - - /** creates the index collection for the table - @param _rNames - The index names. - */ - virtual sdbcx::OCollection* createIndexes(const ::std::vector< OUString>& _rNames) override; +{ - /** Returns always "RENAME TABLE " even for views. - * - * \return The start of the rename statement. - * @see http://dev.mysql.com/doc/refman/5.1/de/rename-table.html - */ - virtual OUString getRenameStart() const override; + class OMySQLTable; + typedef ::comphelper::OIdPropertyArrayUsageHelper< OMySQLTable > OMySQLTable_PROP; + class OMySQLTable : public OTableHelper + ,public OMySQLTable_PROP + { + sal_Int32 m_nPrivileges; // we have to set our privileges by our own - /** used to implement the creation of the array helper which is shared amongst all instances of the class. - This method needs to be implemented in derived classes. - <BR> - The method gets called with s_aMutex acquired. - @return a pointer to the newly created array helper. Must not be NULL. + /** executes the statement. + @param _rStatement + The statement to execute. */ - virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - public: - OMySQLTable( sdbcx::OCollection* _pTables, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection); - OMySQLTable( sdbcx::OCollection* _pTables, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection, - const OUString& Name, - const OUString& Type, - const OUString& Description, - const OUString& SchemaName, - const OUString& CatalogName, - sal_Int32 _nPrivileges - ); - - // ODescriptor - virtual void construct() override; - - // XAlterTable - virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - /** returns the ALTER TABLE XXX statement - */ - OUString getAlterTableColumnPart() const; - - // some methods to alter table structures - void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor); - void alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName); - void dropDefaultValue(const OUString& _sNewDefault); - - virtual OUString getTypeCreatePattern() const override; - }; + void executeStatement(const OUString& _rStatement ); + protected: + + /** creates the column collection for the table + @param _rNames + The column names. + */ + virtual sdbcx::OCollection* createColumns(const ::std::vector< OUString>& _rNames) override; + + /** creates the key collection for the table + @param _rNames + The key names. + */ + virtual sdbcx::OCollection* createKeys(const ::std::vector< OUString>& _rNames) override; + + /** creates the index collection for the table + @param _rNames + The index names. + */ + virtual sdbcx::OCollection* createIndexes(const ::std::vector< OUString>& _rNames) override; + + /** Returns always "RENAME TABLE " even for views. + * + * \return The start of the rename statement. + * @see http://dev.mysql.com/doc/refman/5.1/de/rename-table.html + */ + virtual OUString getRenameStart() const override; + + /** used to implement the creation of the array helper which is shared amongst all instances of the class. + This method needs to be implemented in derived classes. + <BR> + The method gets called with s_aMutex acquired. + @return a pointer to the newly created array helper. Must not be NULL. + */ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + public: + OMySQLTable( sdbcx::OCollection* _pTables, + const css::uno::Reference< css::sdbc::XConnection >& _xConnection); + OMySQLTable( sdbcx::OCollection* _pTables, + const css::uno::Reference< css::sdbc::XConnection >& _xConnection, + const OUString& Name, + const OUString& Type, + const OUString& Description, + const OUString& SchemaName, + const OUString& CatalogName, + sal_Int32 _nPrivileges + ); + + // ODescriptor + virtual void construct() override; + + // XAlterTable + virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + /** returns the ALTER TABLE XXX statement + */ + OUString getAlterTableColumnPart() const; + + // some methods to alter table structures + void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor); + void alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName); + void dropDefaultValue(const OUString& _sNewDefault); + + virtual OUString getTypeCreatePattern() const override; + }; } diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx index af1d145e9595..8aaa5c8d80bb 100644 --- a/connectivity/source/inc/mysql/YTables.hxx +++ b/connectivity/source/inc/mysql/YTables.hxx @@ -23,40 +23,40 @@ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #include <utility> namespace connectivity::mysql +{ + class OTables final : public sdbcx::OCollection, + public ::dbtools::ISQLStatementHelper { - class OTables final : public sdbcx::OCollection, - public ::dbtools::ISQLStatementHelper - { - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; - - void createTable( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); - virtual OUString getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject) override; - public: - OTables(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) - ,m_xMetaData(std::move(_xMetaData)) - {} - - // only the name is identical to ::cppu::OComponentHelper - virtual void disposing() override; - - // XDrop - void appendNew(const OUString& _rsNewTable); - - /** convert the sql statement to fit MySQL notation - @param _sSql in/out - */ - static OUString adjustSQL(const OUString& _sSql); - - // ISQLStatementHelper - virtual void addComment(const css::uno::Reference< css::beans::XPropertySet >& descriptor,OUStringBuffer& _rOut) override; - }; + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; + + void createTable( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); + virtual OUString getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject) override; + public: + OTables(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) + ,m_xMetaData(std::move(_xMetaData)) + {} + + // only the name is identical to ::cppu::OComponentHelper + virtual void disposing() override; + + // XDrop + void appendNew(const OUString& _rsNewTable); + + /** convert the sql statement to fit MySQL notation + @param _sSql in/out + */ + static OUString adjustSQL(const OUString& _sSql); + + // ISQLStatementHelper + virtual void addComment(const css::uno::Reference< css::beans::XPropertySet >& descriptor,OUStringBuffer& _rOut) override; + }; } diff --git a/connectivity/source/inc/mysql/YUser.hxx b/connectivity/source/inc/mysql/YUser.hxx index 1713f63bfb64..739cf6f75e0a 100644 --- a/connectivity/source/inc/mysql/YUser.hxx +++ b/connectivity/source/inc/mysql/YUser.hxx @@ -23,50 +23,50 @@ #include <com/sun/star/sdbc/XConnection.hpp> namespace connectivity::mysql - { - typedef connectivity::sdbcx::OUser OUser_TYPEDEF; +{ + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; - class OMySQLUser : public OUser_TYPEDEF - { - css::uno::Reference< css::sdbc::XConnection > m_xConnection; + class OMySQLUser : public OUser_TYPEDEF + { + css::uno::Reference< css::sdbc::XConnection > m_xConnection; - static OUString getPrivilegeString(sal_Int32 nRights); - // return the privileges and additional the grant rights - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant); - public: - virtual void refreshGroups() override; - public: - OMySQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection); - OMySQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection, const OUString& Name); + static OUString getPrivilegeString(sal_Int32 nRights); + // return the privileges and additional the grant rights + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant); + public: + virtual void refreshGroups() override; + public: + OMySQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection); + OMySQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection, const OUString& Name); - // XUser - virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; - // XAuthorizable - virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; - virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; - }; + // XUser + virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + }; - class OUserExtend; - typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; - class OUserExtend : public OMySQLUser, - public OUserExtend_PROP - { - OUString m_Password; - protected: - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - OUserExtend(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); + class OUserExtend : public OMySQLUser, + public OUserExtend_PROP + { + OUString m_Password; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OUserExtend(const css::uno::Reference< css::sdbc::XConnection >& _xConnection); - virtual void construct() override; - }; + virtual void construct() override; + }; } diff --git a/connectivity/source/inc/mysql/YViews.hxx b/connectivity/source/inc/mysql/YViews.hxx index e1ea94d2d6c2..551b1358dd2d 100644 --- a/connectivity/source/inc/mysql/YViews.hxx +++ b/connectivity/source/inc/mysql/YViews.hxx @@ -22,30 +22,30 @@ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #include <utility> namespace connectivity::mysql +{ + class OViews final : public sdbcx::OCollection { - class OViews final : public sdbcx::OCollection - { - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - bool m_bInDrop; - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + bool m_bInDrop; + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override; + virtual void impl_refresh() override; + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override; + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override; - void createView( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); - public: - OViews(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) - ,m_xMetaData(std::move(_xMetaData)) - ,m_bInDrop(false) - {} + void createView( const css::uno::Reference< css::beans::XPropertySet >& descriptor ); + public: + OViews(css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) + ,m_xMetaData(std::move(_xMetaData)) + ,m_bInDrop(false) + {} - // only the name is identical to ::cppu::OComponentHelper - virtual void disposing() override; + // only the name is identical to ::cppu::OComponentHelper + virtual void disposing() override; - void dropByNameImpl(const OUString& elementName); - }; + void dropByNameImpl(const OUString& elementName); + }; } diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx index 77d09ba29789..29a0a7ba83d5 100644 --- a/connectivity/source/inc/odbc/OBoundParam.hxx +++ b/connectivity/source/inc/odbc/OBoundParam.hxx @@ -24,104 +24,104 @@ #include <connectivity/odbc.hxx> namespace connectivity::odbc +{ + class OOO_DLLPUBLIC_ODBCBASE OBoundParam { - class OOO_DLLPUBLIC_ODBCBASE OBoundParam - { - public: - OBoundParam() - : binaryData(nullptr) - , paramLength(0) - , paramInputStreamLen(0) - { - } - ~OBoundParam() - { - free(binaryData); - } + public: + OBoundParam() + : binaryData(nullptr) + , paramLength(0) + , paramInputStreamLen(0) + { + } + ~OBoundParam() + { + free(binaryData); + } - // allocBindDataBuffer - // Allocates and returns a new bind data buffer of the specified - // length + // allocBindDataBuffer + // Allocates and returns a new bind data buffer of the specified + // length - void* allocBindDataBuffer (sal_Int32 bufLen) - { - // Reset the input stream and sequence, we are doing a new bind - setInputStream (nullptr, 0); - aSequence.realloc(0); + void* allocBindDataBuffer (sal_Int32 bufLen) + { + // Reset the input stream and sequence, we are doing a new bind + setInputStream (nullptr, 0); + aSequence.realloc(0); - free(binaryData); - binaryData = (bufLen > 0) ? malloc(bufLen) : nullptr; + free(binaryData); + binaryData = (bufLen > 0) ? malloc(bufLen) : nullptr; - return binaryData; - } + return binaryData; + } - // getBindLengthBuffer - // Returns the length buffer to be used when binding to a parameter + // getBindLengthBuffer + // Returns the length buffer to be used when binding to a parameter - SQLLEN& getBindLengthBuffer () - { - return paramLength; - } + SQLLEN& getBindLengthBuffer () + { + return paramLength; + } - // setInputStream - // Sets the input stream for the bound parameter + // setInputStream + // Sets the input stream for the bound parameter - void setInputStream(const css::uno::Reference< css::io::XInputStream>& inputStream, - sal_Int32 len) - { - paramInputStream = inputStream; - paramInputStreamLen = len; - } + void setInputStream(const css::uno::Reference< css::io::XInputStream>& inputStream, + sal_Int32 len) + { + paramInputStream = inputStream; + paramInputStreamLen = len; + } - void setSequence(const css::uno::Sequence< sal_Int8 >& _aSequence) - { - aSequence = _aSequence; - } + void setSequence(const css::uno::Sequence< sal_Int8 >& _aSequence) + { + aSequence = _aSequence; + } - // getInputStream - // Gets the input stream for the bound parameter + // getInputStream + // Gets the input stream for the bound parameter - const css::uno::Reference< css::io::XInputStream>& getInputStream () const - { - return paramInputStream; - } + const css::uno::Reference< css::io::XInputStream>& getInputStream () const + { + return paramInputStream; + } - // getInputStreamLen - // Gets the input stream length for the bound parameter + // getInputStreamLen + // Gets the input stream length for the bound parameter - sal_Int32 getInputStreamLen () const - { - return paramInputStreamLen; - } + sal_Int32 getInputStreamLen () const + { + return paramInputStreamLen; + } - private: + private: - // Data attributes + // Data attributes - void *binaryData; // Storage area to be used - // when binding the parameter + void *binaryData; // Storage area to be used + // when binding the parameter - SQLLEN paramLength; // Storage area to be used - // for the bound length of the - // parameter. Note that this - // data is in native format. + SQLLEN paramLength; // Storage area to be used + // for the bound length of the + // parameter. Note that this + // data is in native format. - css::uno::Reference< css::io::XInputStream> paramInputStream; - css::uno::Sequence< sal_Int8 > aSequence; - // When an input stream is - // bound to a parameter, a - // reference to the input stream is saved - // until not needed anymore. + css::uno::Reference< css::io::XInputStream> paramInputStream; + css::uno::Sequence< sal_Int8 > aSequence; + // When an input stream is + // bound to a parameter, a + // reference to the input stream is saved + // until not needed anymore. - sal_Int32 paramInputStreamLen; // Length of input stream - }; + sal_Int32 paramInputStreamLen; // Length of input stream + }; } diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx index cc0ec63e7510..6651c06d4123 100644 --- a/connectivity/source/inc/odbc/OConnection.hxx +++ b/connectivity/source/inc/odbc/OConnection.hxx @@ -35,92 +35,92 @@ #include <map> namespace connectivity::odbc +{ + class ODBCDriver; + class Functions; + + typedef connectivity::OMetaConnection OConnection_BASE; + typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; + + class OConnection final : + public OConnection_BASE, + public OAutoRetrievingBase { - class ODBCDriver; - class Functions; - - typedef connectivity::OMetaConnection OConnection_BASE; - typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; - - class OConnection final : - public OConnection_BASE, - public OAutoRetrievingBase - { - // Data attributes - - std::map< SQLHANDLE, rtl::Reference<OConnection>> m_aConnections; // holds all connections which are need for several statements - - - OUString m_sUser; // the user name - rtl::Reference<ODBCDriver> - m_xDriver; // Pointer to the owning - // driver object - - SQLHANDLE m_aConnectionHandle; - SQLHANDLE m_pDriverHandleCopy; // performance reason - sal_Int32 m_nStatementCount; - bool m_bClosed; - bool m_bUseCatalog; // should we use the catalog on filebased databases - bool m_bUseOldDateFormat; - bool m_bIgnoreDriverPrivileges; - bool m_bPreventGetVersionColumns; // #i60273# - bool m_bReadOnly; - - - SQLRETURN OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent); - - public: - const Functions& functions() const; - /// @throws css::sdbc::SQLException - SQLRETURN Construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info); - - OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver); - // OConnection(const SQLHANDLE _pConnectionHandle); - virtual ~OConnection() override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XServiceInfo - DECLARE_SERVICE_INFO(); - // XConnection - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; - virtual sal_Bool SAL_CALL getAutoCommit( ) override; - virtual void SAL_CALL commit( ) override; - virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual void SAL_CALL setCatalog( const OUString& catalog ) override; - virtual OUString SAL_CALL getCatalog( ) override; - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; - virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - - SQLHANDLE getConnection() { return m_aConnectionHandle; } - - // should we use the catalog on filebased databases - bool isCatalogUsed() const { return m_bUseCatalog; } - bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges; } - bool preventGetVersionColumns() const { return m_bPreventGetVersionColumns; } - bool useOldDateFormat() const { return m_bUseOldDateFormat; } - ODBCDriver* getDriver() const { return m_xDriver.get();} - - SQLHANDLE createStatementHandle(); - // close and free the handle and set it to SQL_NULLHANDLE - void freeStatementHandle(SQLHANDLE& _pHandle); - }; + // Data attributes + + std::map< SQLHANDLE, rtl::Reference<OConnection>> m_aConnections; // holds all connections which are need for several statements + + + OUString m_sUser; // the user name + rtl::Reference<ODBCDriver> + m_xDriver; // Pointer to the owning + // driver object + + SQLHANDLE m_aConnectionHandle; + SQLHANDLE m_pDriverHandleCopy; // performance reason + sal_Int32 m_nStatementCount; + bool m_bClosed; + bool m_bUseCatalog; // should we use the catalog on filebased databases + bool m_bUseOldDateFormat; + bool m_bIgnoreDriverPrivileges; + bool m_bPreventGetVersionColumns; // #i60273# + bool m_bReadOnly; + + + SQLRETURN OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent); + + public: + const Functions& functions() const; + /// @throws css::sdbc::SQLException + SQLRETURN Construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info); + + OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver); + // OConnection(const SQLHANDLE _pConnectionHandle); + virtual ~OConnection() override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XServiceInfo + DECLARE_SERVICE_INFO(); + // XConnection + virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; + virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; + virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; + virtual sal_Bool SAL_CALL getAutoCommit( ) override; + virtual void SAL_CALL commit( ) override; + virtual void SAL_CALL rollback( ) override; + virtual sal_Bool SAL_CALL isClosed( ) override; + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual void SAL_CALL setCatalog( const OUString& catalog ) override; + virtual OUString SAL_CALL getCatalog( ) override; + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; + virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + + SQLHANDLE getConnection() { return m_aConnectionHandle; } + + // should we use the catalog on filebased databases + bool isCatalogUsed() const { return m_bUseCatalog; } + bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges; } + bool preventGetVersionColumns() const { return m_bPreventGetVersionColumns; } + bool useOldDateFormat() const { return m_bUseOldDateFormat; } + ODBCDriver* getDriver() const { return m_xDriver.get();} + + SQLHANDLE createStatementHandle(); + // close and free the handle and set it to SQL_NULLHANDLE + void freeStatementHandle(SQLHANDLE& _pHandle); + }; } diff --git a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx index 457d1e684206..21a4ef0d39be 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx @@ -24,179 +24,179 @@ #include <TDatabaseMetaDataBase.hxx> namespace connectivity::odbc - { +{ - //************ Class: ODatabaseMetaData + //************ Class: ODatabaseMetaData - class ODatabaseMetaData final : - public ODatabaseMetaDataBase - { - SQLHANDLE m_aConnectionHandle; - OConnection* m_pConnection; - bool m_bUseCatalog; + class ODatabaseMetaData final : + public ODatabaseMetaDataBase + { + SQLHANDLE m_aConnectionHandle; + OConnection* m_pConnection; + bool m_bUseCatalog; - // cached database information - virtual OUString impl_getIdentifierQuoteString_throw( ) override; - virtual bool impl_isCatalogAtStart_throw( ) override; - virtual OUString impl_getCatalogSeparator_throw( ) override; - virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; - virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ; - virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; - virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ; - virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override ; - virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; - virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; - virtual sal_Int32 impl_getMaxStatements_throw( ) override; - virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; - virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; - OUString getURLImpl(); - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - virtual ~ODatabaseMetaData() override; + // cached database information + virtual OUString impl_getIdentifierQuoteString_throw( ) override; + virtual bool impl_isCatalogAtStart_throw( ) override; + virtual OUString impl_getCatalogSeparator_throw( ) override; + virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; + virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ; + virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; + virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ; + virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override ; + virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; + virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; + virtual sal_Int32 impl_getMaxStatements_throw( ) override; + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; + virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; + OUString getURLImpl(); + virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; + virtual ~ODatabaseMetaData() override; - public: - ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon); + public: + ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon); - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual OUString SAL_CALL getUserName( ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; - virtual OUString SAL_CALL getDatabaseProductName( ) override; - virtual OUString SAL_CALL getDatabaseProductVersion( ) override; - virtual OUString SAL_CALL getDriverName( ) override; - virtual OUString SAL_CALL getDriverVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; - virtual sal_Bool SAL_CALL usesLocalFiles( ) override; - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual OUString SAL_CALL getUserName( ) override; + virtual sal_Bool SAL_CALL isReadOnly( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; + virtual OUString SAL_CALL getDatabaseProductName( ) override; + virtual OUString SAL_CALL getDatabaseProductVersion( ) override; + virtual OUString SAL_CALL getDriverName( ) override; + virtual OUString SAL_CALL getDriverVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; + virtual sal_Bool SAL_CALL usesLocalFiles( ) override; + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; - virtual OUString SAL_CALL getSQLKeywords( ) override; - virtual OUString SAL_CALL getNumericFunctions( ) override; - virtual OUString SAL_CALL getStringFunctions( ) override; - virtual OUString SAL_CALL getSystemFunctions( ) override; - virtual OUString SAL_CALL getTimeDateFunctions( ) override; - virtual OUString SAL_CALL getSearchStringEscape( ) override; - virtual OUString SAL_CALL getExtraNameCharacters( ) override; - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; - virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupBy( ) override; - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; - virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; - virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; - virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; - virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; - virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; - virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; - virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; - virtual OUString SAL_CALL getSchemaTerm( ) override; - virtual OUString SAL_CALL getProcedureTerm( ) override; - virtual OUString SAL_CALL getCatalogTerm( ) override; + virtual OUString SAL_CALL getSQLKeywords( ) override; + virtual OUString SAL_CALL getNumericFunctions( ) override; + virtual OUString SAL_CALL getStringFunctions( ) override; + virtual OUString SAL_CALL getSystemFunctions( ) override; + virtual OUString SAL_CALL getTimeDateFunctions( ) override; + virtual OUString SAL_CALL getSearchStringEscape( ) override; + virtual OUString SAL_CALL getExtraNameCharacters( ) override; + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; + virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupBy( ) override; + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; + virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; + virtual OUString SAL_CALL getSchemaTerm( ) override; + virtual OUString SAL_CALL getProcedureTerm( ) override; + virtual OUString SAL_CALL getCatalogTerm( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; - virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; - virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; - virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; - virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; - virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; - virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; - virtual sal_Bool SAL_CALL supportsUnion( ) override; - virtual sal_Bool SAL_CALL supportsUnionAll( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; - virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; - virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; - virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; - virtual sal_Int32 SAL_CALL getMaxConnections( ) override; - virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; - virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; - virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; - virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; - virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; - virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; - virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; - virtual sal_Bool SAL_CALL supportsTransactions( ) override; - virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; - virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; - virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; - virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; - virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; - virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; - virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; - virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; - 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 sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; + virtual sal_Bool SAL_CALL supportsUnion( ) override; + virtual sal_Bool SAL_CALL supportsUnionAll( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; + virtual sal_Int32 SAL_CALL getMaxConnections( ) override; + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; + virtual sal_Bool SAL_CALL supportsTransactions( ) override; + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; + 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; + }; } diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx index f88005394199..c8c2faa72bbd 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -41,214 +41,214 @@ #include <string_view> namespace connectivity::odbc +{ + class OResultSetMetaData; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XWarningsSupplier, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + class ODatabaseMetaDataResultSet : + public cppu::BaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> { - class OResultSetMetaData; - /* - ** java_sql_ResultSet - */ - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XWarningsSupplier, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; - - class ODatabaseMetaDataResultSet : - public cppu::BaseMutex, - public ODatabaseMetaDataResultSet_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + std::vector< sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time + + std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> > + m_aValueRange; + + std::map<sal_Int32,SWORD> m_aODBCColumnTypes; + + SQLHANDLE m_aStatementHandle; // ... until freed + rtl::Reference<OResultSetMetaData> m_xMetaData; + std::unique_ptr<SQLUSMALLINT[]> m_pRowStatusArray; + rtl::Reference<OConnection> m_pConnection; + rtl_TextEncoding m_nTextEncoding; + sal_Int32 m_nRowPos; + sal_Int32 m_nDriverColumnCount; // column count of the driver which can sometimes be less than the metadata count + SQLRETURN m_nCurrentFetchState; + bool m_bWasNull; + bool m_bEOF; // after last record + + // set the columncount of the driver + void checkColumnCount(); + static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; } + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static sal_Int32 getFetchSize(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static const OUString & getCursorName(); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); + + sal_Int32 mapColumn (sal_Int32 column); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override; + virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override; + virtual ~ODatabaseMetaDataResultSet() override; + template < typename T, SQLSMALLINT sqlTypeId > T getInteger ( sal_Int32 columnIndex ); + + public: + // A ctor needed for returning the object + ODatabaseMetaDataResultSet(OConnection* _pConnection); + + + const Functions& functions() const { return m_pConnection->functions(); } + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + css::uno::Reference< css::uno::XInterface > operator *() { - std::vector< sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time - - std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> > - m_aValueRange; - - std::map<sal_Int32,SWORD> m_aODBCColumnTypes; - - SQLHANDLE m_aStatementHandle; // ... until freed - rtl::Reference<OResultSetMetaData> m_xMetaData; - std::unique_ptr<SQLUSMALLINT[]> m_pRowStatusArray; - rtl::Reference<OConnection> m_pConnection; - rtl_TextEncoding m_nTextEncoding; - sal_Int32 m_nRowPos; - sal_Int32 m_nDriverColumnCount; // column count of the driver which can sometimes be less than the metadata count - SQLRETURN m_nCurrentFetchState; - bool m_bWasNull; - bool m_bEOF; // after last record - - // set the columncount of the driver - void checkColumnCount(); - static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; } - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static sal_Int32 getFetchSize(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static const OUString & getCursorName(); - SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); - - sal_Int32 mapColumn (sal_Int32 column); - - protected: - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, - sal_Int32 nHandle, - const css::uno::Any& rValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override; - virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override; - virtual ~ODatabaseMetaDataResultSet() override; - template < typename T, SQLSMALLINT sqlTypeId > T getInteger ( sal_Int32 columnIndex ); - - public: - // A ctor needed for returning the object - ODatabaseMetaDataResultSet(OConnection* _pConnection); - - - const Functions& functions() const { return m_pConnection->functions(); } - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - css::uno::Reference< css::uno::XInterface > operator *() - { - return css::uno::Reference< css::uno::XInterface >(*static_cast<ODatabaseMetaDataResultSet_BASE*>(this)); - } - // XResultSet - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openTablesTypes( ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openTypeInfo(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openCatalogs(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openSchemas(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openTables(const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, - const OUString& table, const OUString& columnNamePattern ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openColumns( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const OUString& columnNamePattern ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern,const OUString& columnNamePattern ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openVersionColumns(const css::uno::Any& catalog, const OUString& schema, - const OUString& table); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openForeignKeys( const css::uno::Any& catalog, const OUString* schema,const OUString* table, - const css::uno::Any& catalog2, const OUString* schema2,const OUString* table2); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openExportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openImportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openPrimaryKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openTablePrivileges(const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openSpecialColumns(bool _bRowVer,const css::uno::Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void openIndexInfo( const css::uno::Any& catalog, const OUString& schema, - const OUString& table,bool unique,bool approximate ); - - protected: - using OPropertySetHelper::getFastPropertyValue; - }; + return css::uno::Reference< css::uno::XInterface >(*static_cast<ODatabaseMetaDataResultSet_BASE*>(this)); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openTablesTypes( ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openTypeInfo(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openCatalogs(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openSchemas(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openTables(const css::uno::Any& catalog, const OUString& schemaPattern, + const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, + const OUString& table, const OUString& columnNamePattern ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openColumns( const css::uno::Any& catalog, const OUString& schemaPattern, + const OUString& tableNamePattern, const OUString& columnNamePattern ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, + const OUString& procedureNamePattern,const OUString& columnNamePattern ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, + const OUString& procedureNamePattern); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openVersionColumns(const css::uno::Any& catalog, const OUString& schema, + const OUString& table); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, + const OUString& table,sal_Int32 scope, bool nullable ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openForeignKeys( const css::uno::Any& catalog, const OUString* schema,const OUString* table, + const css::uno::Any& catalog2, const OUString* schema2,const OUString* table2); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openExportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openImportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openPrimaryKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openTablePrivileges(const css::uno::Any& catalog, const OUString& schemaPattern, + const OUString& tableNamePattern); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openSpecialColumns(bool _bRowVer,const css::uno::Any& catalog, const OUString& schema, + const OUString& table,sal_Int32 scope, bool nullable ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void openIndexInfo( const css::uno::Any& catalog, const OUString& schema, + const OUString& table,bool unique,bool approximate ); + + protected: + using OPropertySetHelper::getFastPropertyValue; + }; } diff --git a/connectivity/source/inc/odbc/ODriver.hxx b/connectivity/source/inc/odbc/ODriver.hxx index 721f46338022..bb6a4052ddae 100644 --- a/connectivity/source/inc/odbc/ODriver.hxx +++ b/connectivity/source/inc/odbc/ODriver.hxx @@ -32,48 +32,48 @@ #include <unotools/weakref.hxx> namespace connectivity::odbc - { - class OConnection; +{ + class OConnection; - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo > ODriver_BASE; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo > ODriver_BASE; - class OOO_DLLPUBLIC_ODBCBASE SAL_NO_VTABLE ODBCDriver : public ODriver_BASE - { - protected: - ::osl::Mutex m_aMutex; + class OOO_DLLPUBLIC_ODBCBASE SAL_NO_VTABLE ODBCDriver : public ODriver_BASE + { + protected: + ::osl::Mutex m_aMutex; - std::vector<unotools::WeakReference<OConnection>> - m_xConnections; // vector containing a list - // of all the Connection objects - // for this Driver + std::vector<unotools::WeakReference<OConnection>> + m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver - css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::uno::XComponentContext > m_xContext; - virtual SQLHANDLE EnvironmentHandle() = 0; + virtual SQLHANDLE EnvironmentHandle() = 0; - public: + public: - ODBCDriver(css::uno::Reference< css::uno::XComponentContext > xContext); + ODBCDriver(css::uno::Reference< css::uno::XComponentContext > xContext); - // only possibility to get the odbc functions - virtual const Functions& functions() const = 0; - // OComponentHelper - virtual void SAL_CALL disposing() override; + // only possibility to get the odbc functions + virtual const Functions& functions() const = 0; + // OComponentHelper + virtual void SAL_CALL disposing() override; - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; - virtual sal_Int32 SAL_CALL getMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getMinorVersion( ) override; + // XDriver + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override; + virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; + virtual sal_Int32 SAL_CALL getMajorVersion( ) override; + virtual sal_Int32 SAL_CALL getMinorVersion( ) override; - const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return m_xContext; } - }; + const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return m_xContext; } + }; } diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx index 348c355453e6..a0dc078b6a07 100644 --- a/connectivity/source/inc/odbc/OPreparedStatement.hxx +++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx @@ -29,121 +29,121 @@ #include <cppuhelper/implbase5.hxx> namespace connectivity::odbc +{ + class OResultSetMetaData; + class OBoundParam; + typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement, + css::sdbc::XParameters, + css::sdbc::XPreparedBatchExecution, + css::sdbc::XResultSetMetaDataSupplier, + css::lang::XServiceInfo> OPreparedStatement_BASE; + + class OPreparedStatement final : + public OStatement_BASE2, + public OPreparedStatement_BASE { - class OResultSetMetaData; - class OBoundParam; - typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement, - css::sdbc::XParameters, - css::sdbc::XPreparedBatchExecution, - css::sdbc::XResultSetMetaDataSupplier, - css::lang::XServiceInfo> OPreparedStatement_BASE; - - class OPreparedStatement final : - public OStatement_BASE2, - public OPreparedStatement_BASE - { - static const short invalid_scale = -1; - - // Data attributes - - SQLSMALLINT numParams; // Number of parameter markers for the prepared statement - - std::unique_ptr<OBoundParam[]> boundParams; - // Array of bound parameter objects. Each parameter marker will have a - // corresponding object to hold bind information, and resulting data. - rtl::Reference<OResultSetMetaData> m_xMetaData; - bool m_bPrepared; - - void FreeParams(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void putParamData (sal_Int32 index); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setStream (sal_Int32 ParameterIndex,const css::uno::Reference< css::io::XInputStream>& x, - SQLLEN length,sal_Int32 SQLtype); - SQLLEN* getLengthBuf (sal_Int32 index); - void* allocBindBuf ( sal_Int32 index, sal_Int32 bufLen); - /// @throws css::sdbc::SQLException - void initBoundParam (); - void setParameterPre(sal_Int32 parameterIndex); - template <typename T> void setScalarParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, const T i_Value); - template <typename T> void setScalarParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, sal_Int32 _nScale, const T i_Value); - void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, sal_Int32 _nScale, const void* _pData, SQLULEN _nDataLen, SQLLEN _nDataAllocLen); - // Wrappers for special cases - void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, sal_Int16 _nScale, const OUString &_sData); - void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, const css::uno::Sequence< sal_Int8 > &Data); - - bool isPrepared() const { return m_bPrepared;} - void prepareStatement(); - void checkParameterIndex(sal_Int32 _parameterIndex); - - /** - creates the driver specific resultset (factory) - */ - virtual rtl::Reference<OResultSet> createResultSet() override; - - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, - const css::uno::Any& rValue) override; - public: - DECLARE_SERVICE_INFO(); - // A ctor, needed to return the object - OPreparedStatement( OConnection* _pConnection,const OUString& sql); - virtual ~OPreparedStatement() override; - OPreparedStatement& operator=( OPreparedStatement const & ) = delete; // MSVC2015 workaround - OPreparedStatement( OPreparedStatement const & ) = delete; // MSVC2015 workaround - - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPreparedStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; - virtual sal_Int32 SAL_CALL executeUpdate( ) override; - virtual sal_Bool SAL_CALL execute( ) override; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; - // XParameters - virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; - virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; - virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; - virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; - virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; - virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; - virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; - virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; - virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; - virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; - virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; - virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; - virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; - virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; - virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; - virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; - virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; - virtual void SAL_CALL clearParameters( ) override; - // XPreparedBatchExecution - virtual void SAL_CALL addBatch( ) override; - virtual void SAL_CALL clearBatch( ) override; - virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - const rtl::Reference< OResultSetMetaData > & getMetaDataImpl(); - - public: - using OStatement_Base::executeQuery; - using OStatement_Base::executeUpdate; - using OStatement_Base::execute; - }; + static const short invalid_scale = -1; + + // Data attributes + + SQLSMALLINT numParams; // Number of parameter markers for the prepared statement + + std::unique_ptr<OBoundParam[]> boundParams; + // Array of bound parameter objects. Each parameter marker will have a + // corresponding object to hold bind information, and resulting data. + rtl::Reference<OResultSetMetaData> m_xMetaData; + bool m_bPrepared; + + void FreeParams(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void putParamData (sal_Int32 index); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setStream (sal_Int32 ParameterIndex,const css::uno::Reference< css::io::XInputStream>& x, + SQLLEN length,sal_Int32 SQLtype); + SQLLEN* getLengthBuf (sal_Int32 index); + void* allocBindBuf ( sal_Int32 index, sal_Int32 bufLen); + /// @throws css::sdbc::SQLException + void initBoundParam (); + void setParameterPre(sal_Int32 parameterIndex); + template <typename T> void setScalarParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, const T i_Value); + template <typename T> void setScalarParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, sal_Int32 _nScale, const T i_Value); + void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, SQLULEN _nColumnSize, sal_Int32 _nScale, const void* _pData, SQLULEN _nDataLen, SQLLEN _nDataAllocLen); + // Wrappers for special cases + void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, sal_Int16 _nScale, const OUString &_sData); + void setParameter(sal_Int32 parameterIndex, sal_Int32 _nType, const css::uno::Sequence< sal_Int8 > &Data); + + bool isPrepared() const { return m_bPrepared;} + void prepareStatement(); + void checkParameterIndex(sal_Int32 _parameterIndex); + + /** + creates the driver specific resultset (factory) + */ + virtual rtl::Reference<OResultSet> createResultSet() override; + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, + const css::uno::Any& rValue) override; + public: + DECLARE_SERVICE_INFO(); + // A ctor, needed to return the object + OPreparedStatement( OConnection* _pConnection,const OUString& sql); + virtual ~OPreparedStatement() override; + OPreparedStatement& operator=( OPreparedStatement const & ) = delete; // MSVC2015 workaround + OPreparedStatement( OPreparedStatement const & ) = delete; // MSVC2015 workaround + + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPreparedStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override; + virtual sal_Int32 SAL_CALL executeUpdate( ) override; + virtual sal_Bool SAL_CALL execute( ) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override; + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) override; + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) override; + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) override; + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) override; + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) override; + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) override; + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) override; + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) override; + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) override; + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) override; + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) override; + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) override; + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) override; + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) override; + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) override; + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) override; + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) override; + virtual void SAL_CALL clearParameters( ) override; + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) override; + virtual void SAL_CALL clearBatch( ) override; + virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + const rtl::Reference< OResultSetMetaData > & getMetaDataImpl(); + + public: + using OStatement_Base::executeQuery; + using OStatement_Base::executeUpdate; + using OStatement_Base::execute; + }; } diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx index c7638a18d8b9..46bb696fe601 100644 --- a/connectivity/source/inc/odbc/OResultSet.hxx +++ b/connectivity/source/inc/odbc/OResultSet.hxx @@ -43,306 +43,306 @@ #include "OResultSetMetaData.hxx" namespace connectivity::odbc - { - class OResultSetMetaData; +{ + class OResultSetMetaData; - /* - ** java_sql_ResultSet - */ - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XWarningsSupplier, - css::sdbc::XResultSetUpdate, - css::sdbc::XRowUpdate, - css::sdbcx::XRowLocate, - css::sdbcx::XDeleteRows, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate, - css::lang::XServiceInfo> OResultSet_BASE; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XWarningsSupplier, + css::sdbc::XResultSetUpdate, + css::sdbc::XRowUpdate, + css::sdbcx::XRowLocate, + css::sdbcx::XDeleteRows, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate, + css::lang::XServiceInfo> OResultSet_BASE; - class BindData; + class BindData; - /// Functor object for class ZZ returntype is void - struct OOO_DLLPUBLIC_ODBCBASE TBookmarkPosMapCompare + /// Functor object for class ZZ returntype is void + struct OOO_DLLPUBLIC_ODBCBASE TBookmarkPosMapCompare + { + bool operator()( const css::uno::Sequence<sal_Int8>& _rLH, + const css::uno::Sequence<sal_Int8>& _rRH) const { - bool operator()( const css::uno::Sequence<sal_Int8>& _rLH, - const css::uno::Sequence<sal_Int8>& _rRH) const + if(_rLH.getLength() == _rRH.getLength()) { - if(_rLH.getLength() == _rRH.getLength()) + sal_Int32 nCount = _rLH.getLength(); + if(nCount != 4) { - sal_Int32 nCount = _rLH.getLength(); - if(nCount != 4) - { - const sal_Int8* pLHBack = _rLH.getConstArray() + nCount - 1; - const sal_Int8* pRHBack = _rRH.getConstArray() + nCount - 1; + const sal_Int8* pLHBack = _rLH.getConstArray() + nCount - 1; + const sal_Int8* pRHBack = _rRH.getConstArray() + nCount - 1; - sal_Int32 i; - for(i=0;i < nCount;++i,--pLHBack,--pRHBack) - { - if(!(*pLHBack) && *pRHBack) - return true; - else if(*pLHBack && !(*pRHBack)) - return false; - } - for(i=0,++pLHBack,++pRHBack;i < nCount;++pLHBack,++pRHBack,++i) - if(*pLHBack < *pRHBack) - return true; - return false; + sal_Int32 i; + for(i=0;i < nCount;++i,--pLHBack,--pRHBack) + { + if(!(*pLHBack) && *pRHBack) + return true; + else if(*pLHBack && !(*pRHBack)) + return false; } - else - return *reinterpret_cast<const sal_Int32*>(_rLH.getConstArray()) < *reinterpret_cast<const sal_Int32*>(_rRH.getConstArray()); - + for(i=0,++pLHBack,++pRHBack;i < nCount;++pLHBack,++pRHBack,++i) + if(*pLHBack < *pRHBack) + return true; + return false; } else - return _rLH.getLength() < _rRH.getLength(); + return *reinterpret_cast<const sal_Int32*>(_rLH.getConstArray()) < *reinterpret_cast<const sal_Int32*>(_rRH.getConstArray()); + } - }; + else + return _rLH.getLength() < _rRH.getLength(); + } + }; - typedef std::map< css::uno::Sequence<sal_Int8>, sal_Int32,TBookmarkPosMapCompare > TBookmarkPosMap; + typedef std::map< css::uno::Sequence<sal_Int8>, sal_Int32,TBookmarkPosMapCompare > TBookmarkPosMap; - class OResultSet : - public cppu::BaseMutex, - public ::connectivity::IResultSetHelper, - public OResultSet_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<OResultSet> - { - protected: - TBookmarkPosMap m_aPosToBookmarks; - // used top hold the information about the value and the datatype to save calls to metadata - typedef std::vector<ORowSetValue> TDataRow; + class OResultSet : + public cppu::BaseMutex, + public ::connectivity::IResultSetHelper, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + { + protected: + TBookmarkPosMap m_aPosToBookmarks; + // used top hold the information about the value and the datatype to save calls to metadata + typedef std::vector<ORowSetValue> TDataRow; - std::vector<std::unique_ptr<BindData>> m_aBindVector; - std::vector<SQLLEN> m_aLengthVector; - std::map<sal_Int32,SWORD> m_aODBCColumnTypes; + std::vector<std::unique_ptr<BindData>> m_aBindVector; + std::vector<SQLLEN> m_aLengthVector; + std::map<sal_Int32,SWORD> m_aODBCColumnTypes; - // In baseline ODBC, SQLGetData can only be called on monotonically increasing column numbers. - // additionally, any variable-length data can be fetched only once (possibly in parts); - // after that, SQLGetData returns SQL_NO_DATA. - // In order to insulate our callers from these restrictions, - // we cache the current row in m_aRow. - // If the driver claims to support the GD_ANY_ORDER extension, - // we read and cache only the columns requested by a caller. - // Else, we read and cache all columns whose number is <= a requested column. - // m_aRow[colNumber].getBound() says if it contains an up-to-date value or not. - TDataRow m_aRow; - bool m_bFetchDataInOrder; - SQLHANDLE m_aStatementHandle; - SQLHANDLE m_aConnectionHandle; - OStatement_Base* m_pStatement; - std::unique_ptr<OSkipDeletedSet> m_pSkipDeletedSet; - css::uno::Reference< css::uno::XInterface> m_xStatement; - rtl::Reference< OResultSetMetaData> m_xMetaData; - std::unique_ptr<SQLUSMALLINT[]> m_pRowStatusArray; - rtl_TextEncoding m_nTextEncoding; - sal_Int32 m_nRowPos; - mutable sal_uInt32 m_nUseBookmarks; - SQLRETURN m_nCurrentFetchState; - bool m_bWasNull; - bool m_bEOF; // after last record - bool m_bRowInserted; - bool m_bRowDeleted; - bool m_bUseFetchScroll; + // In baseline ODBC, SQLGetData can only be called on monotonically increasing column numbers. + // additionally, any variable-length data can be fetched only once (possibly in parts); + // after that, SQLGetData returns SQL_NO_DATA. + // In order to insulate our callers from these restrictions, + // we cache the current row in m_aRow. + // If the driver claims to support the GD_ANY_ORDER extension, + // we read and cache only the columns requested by a caller. + // Else, we read and cache all columns whose number is <= a requested column. + // m_aRow[colNumber].getBound() says if it contains an up-to-date value or not. + TDataRow m_aRow; + bool m_bFetchDataInOrder; + SQLHANDLE m_aStatementHandle; + SQLHANDLE m_aConnectionHandle; + OStatement_Base* m_pStatement; + std::unique_ptr<OSkipDeletedSet> m_pSkipDeletedSet; + css::uno::Reference< css::uno::XInterface> m_xStatement; + rtl::Reference< OResultSetMetaData> m_xMetaData; + std::unique_ptr<SQLUSMALLINT[]> m_pRowStatusArray; + rtl_TextEncoding m_nTextEncoding; + sal_Int32 m_nRowPos; + mutable sal_uInt32 m_nUseBookmarks; + SQLRETURN m_nCurrentFetchState; + bool m_bWasNull; + bool m_bEOF; // after last record + bool m_bRowInserted; + bool m_bRowDeleted; + bool m_bUseFetchScroll; - bool isBookmarkable() const; - sal_Int32 getResultSetConcurrency() const; - sal_Int32 getResultSetType() const; - static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; } - sal_Int32 getFetchSize() const; - OUString getCursorName() const; - template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption) const; + bool isBookmarkable() const; + sal_Int32 getResultSetConcurrency() const; + sal_Int32 getResultSetType() const; + static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; } + sal_Int32 getFetchSize() const; + OUString getCursorName() const; + template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption) const; - void setFetchDirection(sal_Int32 _par0); - void setFetchSize(sal_Int32 _par0); - template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const; + void setFetchDirection(sal_Int32 _par0); + void setFetchSize(sal_Int32 _par0); + template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const; - void ensureCacheForColumn(sal_Int32 columnIndex); - void invalidateCache(); - void fillColumn(sal_Int32 _nToColumn); - void allocBuffer(); - void releaseBuffer(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void updateValue(sal_Int32 columnIndex, SQLSMALLINT _nType, void const * _pValue); - void fillNeededData(SQLRETURN _nRet); - bool moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset); - SQLRETURN unbind(bool _bUnbindHandle = true); - SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); + void ensureCacheForColumn(sal_Int32 columnIndex); + void invalidateCache(); + void fillColumn(sal_Int32 _nToColumn); + void allocBuffer(); + void releaseBuffer(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void updateValue(sal_Int32 columnIndex, SQLSMALLINT _nType, void const * _pValue); + void fillNeededData(SQLRETURN _nRet); + bool moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset); + SQLRETURN unbind(bool _bUnbindHandle = true); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); - // helper to implement XRow::getXXX in simple cases - template < typename T > T getValue( sal_Int32 columnIndex ); - // impl_getXXX are the functions that do the actual fetching from ODBC, ignoring the cache - // for simple cases - template < typename T > T impl_getValue( const sal_Int32 _nColumnIndex, SQLSMALLINT nType ); - // these cases need some special treatment - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - bool impl_getBoolean( sal_Int32 columnIndex ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - css::uno::Sequence< sal_Int8 > impl_getBytes( sal_Int32 columnIndex ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - css::util::Date impl_getDate( sal_Int32 columnIndex ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - css::util::Time impl_getTime( sal_Int32 columnIndex ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - css::util::DateTime impl_getTimestamp( sal_Int32 columnIndex ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int64 impl_getLong( sal_Int32 columnIndex ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - OUString impl_getString( sal_Int32 columnIndex ); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - css::uno::Sequence<sal_Int8> impl_getBookmark( ); + // helper to implement XRow::getXXX in simple cases + template < typename T > T getValue( sal_Int32 columnIndex ); + // impl_getXXX are the functions that do the actual fetching from ODBC, ignoring the cache + // for simple cases + template < typename T > T impl_getValue( const sal_Int32 _nColumnIndex, SQLSMALLINT nType ); + // these cases need some special treatment + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + bool impl_getBoolean( sal_Int32 columnIndex ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + css::uno::Sequence< sal_Int8 > impl_getBytes( sal_Int32 columnIndex ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + css::util::Date impl_getDate( sal_Int32 columnIndex ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + css::util::Time impl_getTime( sal_Int32 columnIndex ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + css::util::DateTime impl_getTimestamp( sal_Int32 columnIndex ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int64 impl_getLong( sal_Int32 columnIndex ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OUString impl_getString( sal_Int32 columnIndex ); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + css::uno::Sequence<sal_Int8> impl_getBookmark( ); - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const css::uno::Any& rValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const override; - public: - DECLARE_SERVICE_INFO(); - // A ctor that is needed for returning the object - OResultSet( SQLHANDLE _pStatementHandle,OStatement_Base* pStmt); - virtual ~OResultSet() override; + const css::uno::Any& rValue + ) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + public: + DECLARE_SERVICE_INFO(); + // A ctor that is needed for returning the object + OResultSet( SQLHANDLE _pStatementHandle,OStatement_Base* pStmt); + virtual ~OResultSet() override; - void construct(); + void construct(); - const Functions& functions() const { return m_pStatement->functions(); } + const Functions& functions() const { return m_pStatement->functions(); } - css::uno::Reference< css::uno::XInterface > operator *() - { - return css::uno::Reference< css::uno::XInterface >(*static_cast<OResultSet_BASE*>(this)); - } + css::uno::Reference< css::uno::XInterface > operator *() + { + return css::uno::Reference< css::uno::XInterface >(*static_cast<OResultSet_BASE*>(this)); + } - void setMetaData(const rtl::Reference<OResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} + void setMetaData(const rtl::Reference<OResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XResultSet - virtual sal_Bool SAL_CALL next( ) override; - virtual sal_Bool SAL_CALL isBeforeFirst( ) override; - virtual sal_Bool SAL_CALL isAfterLast( ) override; - virtual sal_Bool SAL_CALL isFirst( ) override; - virtual sal_Bool SAL_CALL isLast( ) override; - virtual void SAL_CALL beforeFirst( ) override; - virtual void SAL_CALL afterLast( ) override; - virtual sal_Bool SAL_CALL first( ) override; - virtual sal_Bool SAL_CALL last( ) override; - virtual sal_Int32 SAL_CALL getRow( ) override; - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; - virtual sal_Bool SAL_CALL previous( ) override; - virtual void SAL_CALL refreshRow( ) override; - virtual sal_Bool SAL_CALL rowUpdated( ) override; - virtual sal_Bool SAL_CALL rowInserted( ) override; - virtual sal_Bool SAL_CALL rowDeleted( ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; - // XRow - virtual sal_Bool SAL_CALL wasNull( ) override; - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XResultSetUpdate - virtual void SAL_CALL insertRow( ) override; - virtual void SAL_CALL updateRow( ) override; - virtual void SAL_CALL deleteRow( ) override; - virtual void SAL_CALL cancelRowUpdates( ) override; - virtual void SAL_CALL moveToInsertRow( ) override; - virtual void SAL_CALL moveToCurrentRow( ) override; - // XRowUpdate - virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; - virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; - virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; - virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - // XRowLocate - virtual css::uno::Any SAL_CALL getBookmark( ) override; - virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; - virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; - virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; - // XDeleteRows - virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XResultSet + virtual sal_Bool SAL_CALL next( ) override; + virtual sal_Bool SAL_CALL isBeforeFirst( ) override; + virtual sal_Bool SAL_CALL isAfterLast( ) override; + virtual sal_Bool SAL_CALL isFirst( ) override; + virtual sal_Bool SAL_CALL isLast( ) override; + virtual void SAL_CALL beforeFirst( ) override; + virtual void SAL_CALL afterLast( ) override; + virtual sal_Bool SAL_CALL first( ) override; + virtual sal_Bool SAL_CALL last( ) override; + virtual sal_Int32 SAL_CALL getRow( ) override; + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override; + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override; + virtual sal_Bool SAL_CALL previous( ) override; + virtual void SAL_CALL refreshRow( ) override; + virtual sal_Bool SAL_CALL rowUpdated( ) override; + virtual sal_Bool SAL_CALL rowInserted( ) override; + virtual sal_Bool SAL_CALL rowDeleted( ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override; + // XRow + virtual sal_Bool SAL_CALL wasNull( ) override; + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override; + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override; + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override; + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override; + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override; + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override; + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override; + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override; + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override; + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override; + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override; + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override; + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override; + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) override; + virtual void SAL_CALL updateRow( ) override; + virtual void SAL_CALL deleteRow( ) override; + virtual void SAL_CALL cancelRowUpdates( ) override; + virtual void SAL_CALL moveToInsertRow( ) override; + virtual void SAL_CALL moveToCurrentRow( ) override; + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) override; + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) override; + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) override; + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) override; + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) override; + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) override; + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) override; + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) override; + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) override; + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) override; + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) override; + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) override; + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) override; + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) override; + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) override; + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + // XRowLocate + virtual css::uno::Any SAL_CALL getBookmark( ) override; + virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override; + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override; + virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override; + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override; + virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override; + // XDeleteRows + virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) override; - // IResultSetHelper - virtual bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData) override; - virtual sal_Int32 getDriverPos() const override; - virtual bool isRowDeleted() const override; + // IResultSetHelper + virtual bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData) override; + virtual sal_Int32 getDriverPos() const override; + virtual bool isRowDeleted() const override; - protected: - using OPropertySetHelper::getFastPropertyValue; - }; + protected: + using OPropertySetHelper::getFastPropertyValue; + }; } diff --git a/connectivity/source/inc/odbc/OResultSetMetaData.hxx b/connectivity/source/inc/odbc/OResultSetMetaData.hxx index 7f73f6c03f4b..4fec8fde8477 100644 --- a/connectivity/source/inc/odbc/OResultSetMetaData.hxx +++ b/connectivity/source/inc/odbc/OResultSetMetaData.hxx @@ -27,86 +27,86 @@ #include <odbc/OConnection.hxx> namespace connectivity::odbc - { +{ - //************ Class: ResultSetMetaData + //************ Class: ResultSetMetaData - typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; - class OResultSetMetaData final : - public OResultSetMetaData_BASE - { - std::vector<sal_Int32> m_vMapping; // when not every column is needed - std::map<sal_Int32,sal_Int32> m_aColumnTypes; + class OResultSetMetaData final : + public OResultSetMetaData_BASE + { + std::vector<sal_Int32> m_vMapping; // when not every column is needed + std::map<sal_Int32,sal_Int32> m_aColumnTypes; - SQLHANDLE m_aStatementHandle; - OConnection* m_pConnection; - sal_Int32 m_nColCount; - bool m_bUseODBC2Types; + SQLHANDLE m_aStatementHandle; + OConnection* m_pConnection; + sal_Int32 m_nColCount; + bool m_bUseODBC2Types; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident); - public: - // A ctor that is needed for returning the object - OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt ) - :m_aStatementHandle( _pStmt ) + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident); + public: + // A ctor that is needed for returning the object + OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt ) + :m_aStatementHandle( _pStmt ) + ,m_pConnection(_pConnection) + ,m_nColCount(-1) + ,m_bUseODBC2Types(false) + {} + OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt, std::vector<sal_Int32>&& _vMapping) + :m_vMapping(std::move(_vMapping)) + ,m_aStatementHandle( _pStmt ) ,m_pConnection(_pConnection) - ,m_nColCount(-1) + ,m_nColCount(m_vMapping.size()-1) ,m_bUseODBC2Types(false) - {} - OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt, std::vector<sal_Int32>&& _vMapping) - :m_vMapping(std::move(_vMapping)) - ,m_aStatementHandle( _pStmt ) - ,m_pConnection(_pConnection) - ,m_nColCount(m_vMapping.size()-1) - ,m_bUseODBC2Types(false) - {} - virtual ~OResultSetMetaData() override; + {} + virtual ~OResultSetMetaData() override; - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static SQLLEN getNumColAttrib(OConnection const * _pConnection - ,SQLHANDLE _aStatementHandle - ,const css::uno::Reference< css::uno::XInterface >& _xInterface - ,sal_Int32 _column - ,sal_Int32 ident); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static SQLLEN getNumColAttrib(OConnection const * _pConnection + ,SQLHANDLE _aStatementHandle + ,const css::uno::Reference< css::uno::XInterface >& _xInterface + ,sal_Int32 _column + ,sal_Int32 ident); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - static SQLSMALLINT getColumnODBCType(OConnection const * _pConnection - ,SQLHANDLE _aStatementHandle - ,const css::uno::Reference< css::uno::XInterface >& _xInterface - ,sal_Int32 column); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + static SQLSMALLINT getColumnODBCType(OConnection const * _pConnection + ,SQLHANDLE _aStatementHandle + ,const css::uno::Reference< css::uno::XInterface >& _xInterface + ,sal_Int32 column); - const Functions& functions() const { return m_pConnection->functions(); } + const Functions& functions() const { return m_pConnection->functions(); } - virtual sal_Int32 SAL_CALL getColumnCount( ) override; - virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; - virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; - virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; - virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; - virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; - virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; - virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; - }; + virtual sal_Int32 SAL_CALL getColumnCount( ) override; + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override; + virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override; + virtual OUString SAL_CALL getTableName( sal_Int32 column ) override; + virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override; + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override; + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override; + virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override; + }; } diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx index 2de1e905364d..d66065085743 100644 --- a/connectivity/source/inc/odbc/OStatement.hxx +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -40,202 +40,202 @@ #include <unotools/weakref.hxx> namespace connectivity::odbc - { +{ + + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement, + css::sdbc::XWarningsSupplier, + css::util::XCancellable, + css::sdbc::XCloseable, + css::sdbc::XGeneratedResultSet, + css::sdbc::XMultipleResults> OStatement_BASE; + + class OResultSet; + + //************ Class: java.sql.Statement - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement, - css::sdbc::XWarningsSupplier, - css::util::XCancellable, - css::sdbc::XCloseable, - css::sdbc::XGeneratedResultSet, - css::sdbc::XMultipleResults> OStatement_BASE; - - class OResultSet; - - //************ Class: java.sql.Statement - - class OStatement_Base : - public cppu::BaseMutex, - public OStatement_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> - - { - css::sdbc::SQLWarning m_aLastWarning; - protected: - unotools::WeakReference< OResultSet > m_xResultSet; // The last ResultSet created - css::uno::Reference< css::sdbc::XStatement> m_xGeneratedStatement; - // for this Statement - - std::vector< OUString> m_aBatchVector; - OUString m_sSqlStatement; - - rtl::Reference<OConnection> m_pConnection;// The owning Connection object - SQLHANDLE m_aStatementHandle; - SQLUSMALLINT* m_pRowStatusArray; - - protected: - - sal_Int64 getQueryTimeOut() const; - sal_Int64 getMaxFieldSize() const; - sal_Int64 getMaxRows() const; - sal_Int32 getResultSetConcurrency() const; - sal_Int32 getResultSetType() const; - sal_Int32 getFetchDirection() const; - sal_Int32 getFetchSize() const; - OUString getCursorName() const; - bool isUsingBookmarks() const; - bool getEscapeProcessing() const; - template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption) const; - - void setQueryTimeOut(sal_Int64 _par0) ; - void setMaxFieldSize(sal_Int64 _par0) ; - void setMaxRows(sal_Int64 _par0) ; - void setFetchDirection(sal_Int32 _par0) ; - void setFetchSize(sal_Int32 _par0) ; - void setCursorName(const OUString& _par0); - void setEscapeProcessing( const bool _bEscapeProc ); - template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const; - - void setResultSetConcurrency(sal_Int32 _par0) ; - void setResultSetType(sal_Int32 _par0) ; - void setUsingBookmarks(bool _bUseBookmark) ; - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void reset(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void clearMyResultSet(); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - void setWarning (const css::sdbc::SQLWarning &ex); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - bool lockIfNecessary (const OUString& sql); - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - sal_Int32 getColumnCount(); - - - // getResultSet - // getResultSet returns the current result as a ResultSet. It - // returns NULL if the current result is not a ResultSet. - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - rtl::Reference<OResultSet> getResultSet(bool checkCount); - /** - creates the driver specific resultset (factory) - */ - virtual rtl::Reference<OResultSet> createResultSet(); - - /// @throws css::sdbc::SQLException - /// @throws css::uno::RuntimeException - SQLLEN getRowCount(); - - - void disposeResultSet(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, + class OStatement_Base : + public cppu::BaseMutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> + + { + css::sdbc::SQLWarning m_aLastWarning; + protected: + unotools::WeakReference< OResultSet > m_xResultSet; // The last ResultSet created + css::uno::Reference< css::sdbc::XStatement> m_xGeneratedStatement; + // for this Statement + + std::vector< OUString> m_aBatchVector; + OUString m_sSqlStatement; + + rtl::Reference<OConnection> m_pConnection;// The owning Connection object + SQLHANDLE m_aStatementHandle; + SQLUSMALLINT* m_pRowStatusArray; + + protected: + + sal_Int64 getQueryTimeOut() const; + sal_Int64 getMaxFieldSize() const; + sal_Int64 getMaxRows() const; + sal_Int32 getResultSetConcurrency() const; + sal_Int32 getResultSetType() const; + sal_Int32 getFetchDirection() const; + sal_Int32 getFetchSize() const; + OUString getCursorName() const; + bool isUsingBookmarks() const; + bool getEscapeProcessing() const; + template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption) const; + + void setQueryTimeOut(sal_Int64 _par0) ; + void setMaxFieldSize(sal_Int64 _par0) ; + void setMaxRows(sal_Int64 _par0) ; + void setFetchDirection(sal_Int32 _par0) ; + void setFetchSize(sal_Int32 _par0) ; + void setCursorName(const OUString& _par0); + void setEscapeProcessing( const bool _bEscapeProc ); + template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const; + + void setResultSetConcurrency(sal_Int32 _par0) ; + void setResultSetType(sal_Int32 _par0) ; + void setUsingBookmarks(bool _bUseBookmark) ; + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void reset(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void clearMyResultSet(); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + void setWarning (const css::sdbc::SQLWarning &ex); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + bool lockIfNecessary (const OUString& sql); + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + sal_Int32 getColumnCount(); + + + // getResultSet + // getResultSet returns the current result as a ResultSet. It + // returns NULL if the current result is not a ResultSet. + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + rtl::Reference<OResultSet> getResultSet(bool checkCount); + /** + creates the driver specific resultset (factory) + */ + virtual rtl::Reference<OResultSet> createResultSet(); + + /// @throws css::sdbc::SQLException + /// @throws css::uno::RuntimeException + SQLLEN getRowCount(); + + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const css::uno::Any& rValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) override; - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const override; - virtual ~OStatement_Base() override; - - public: - OStatement_Base(OConnection* _pConnection ); - using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; - - const Functions& functions() const { return m_pConnection->functions(); } - // OComponentHelper - virtual void SAL_CALL disposing() override; - // XInterface - virtual void SAL_CALL release() noexcept override; - virtual void SAL_CALL acquire() noexcept override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XStatement - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ; - virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ; - virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ; - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings( ) override; - // XCancellable - virtual void SAL_CALL cancel( ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XMultipleResults - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; - virtual sal_Int32 SAL_CALL getUpdateCount( ) override; - virtual sal_Bool SAL_CALL getMoreResults( ) override; - //XGeneratedResultSet - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) override; - - // other methods - SQLHANDLE getConnectionHandle() { return m_pConnection->getConnection(); } - OConnection* getOwnConnection() const { return m_pConnection.get();} - /** getCursorProperties return the properties for a specific cursor type - @param _nCursorType the CursorType - @param bFirst when true the first property set is returned - - @return the cursor properties - */ - SQLUINTEGER getCursorProperties(SQLINTEGER _nCursorType, bool bFirst); - - protected: - using OPropertySetHelper::getFastPropertyValue; - }; - - class OOO_DLLPUBLIC_ODBCBASE OStatement_BASE2 : public OStatement_Base - { - public: - OStatement_BASE2(OConnection* _pConnection ) : - OStatement_Base(_pConnection ) - {} - // OComponentHelper - virtual void SAL_CALL disposing() override; - }; - - class OStatement : - public OStatement_BASE2, - public css::sdbc::XBatchExecution, - public css::lang::XServiceInfo - { - protected: - virtual ~OStatement() override {} - public: - // A ctor that is needed for returning the object - OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} - DECLARE_SERVICE_INFO(); - - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - // XBatchExecution - virtual void SAL_CALL addBatch( const OUString& sql ) override; - virtual void SAL_CALL clearBatch( ) override; - virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; - }; + const css::uno::Any& rValue + ) override; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const override; + virtual ~OStatement_Base() override; + + public: + OStatement_Base(OConnection* _pConnection ); + using OStatement_BASE::operator css::uno::Reference< css::uno::XInterface >; + + const Functions& functions() const { return m_pConnection->functions(); } + // OComponentHelper + virtual void SAL_CALL disposing() override; + // XInterface + virtual void SAL_CALL release() noexcept override; + virtual void SAL_CALL acquire() noexcept override; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XStatement + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) override ; + virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) override ; + virtual sal_Bool SAL_CALL execute( const OUString& sql ) override ; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override ; + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) override; + virtual void SAL_CALL clearWarnings( ) override; + // XCancellable + virtual void SAL_CALL cancel( ) override; + // XCloseable + virtual void SAL_CALL close( ) override; + // XMultipleResults + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getResultSet( ) override; + virtual sal_Int32 SAL_CALL getUpdateCount( ) override; + virtual sal_Bool SAL_CALL getMoreResults( ) override; + //XGeneratedResultSet + virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) override; + + // other methods + SQLHANDLE getConnectionHandle() { return m_pConnection->getConnection(); } + OConnection* getOwnConnection() const { return m_pConnection.get();} + /** getCursorProperties return the properties for a specific cursor type + @param _nCursorType the CursorType + @param bFirst when true the first property set is returned + + @return the cursor properties + */ + SQLUINTEGER getCursorProperties(SQLINTEGER _nCursorType, bool bFirst); + + protected: + using OPropertySetHelper::getFastPropertyValue; + }; + + class OOO_DLLPUBLIC_ODBCBASE OStatement_BASE2 : public OStatement_Base + { + public: + OStatement_BASE2(OConnection* _pConnection ) : + OStatement_Base(_pConnection ) + {} + // OComponentHelper + virtual void SAL_CALL disposing() override; + }; + + class OStatement : + public OStatement_BASE2, + public css::sdbc::XBatchExecution, + public css::lang::XServiceInfo + { + protected: + virtual ~OStatement() override {} + public: + // A ctor that is needed for returning the object + OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} + DECLARE_SERVICE_INFO(); + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + // XBatchExecution + virtual void SAL_CALL addBatch( const OUString& sql ) override; + virtual void SAL_CALL clearBatch( ) override; + virtual css::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) override; + }; } diff --git a/connectivity/workben/skeleton/SResultSet.hxx b/connectivity/workben/skeleton/SResultSet.hxx index 514aec2df638..e7e5367b8c69 100644 --- a/connectivity/workben/skeleton/SResultSet.hxx +++ b/connectivity/workben/skeleton/SResultSet.hxx @@ -36,200 +36,200 @@ #include <connectivity/FValue.hxx> namespace connectivity::skeleton +{ + + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, + css::sdbc::XRow, + css::sdbc::XResultSetMetaDataSupplier, + css::util::XCancellable, + css::sdbc::XWarningsSupplier, + css::sdbc::XResultSetUpdate, + css::sdbc::XRowUpdate, + css::sdbcx::XRowLocate, + css::sdbcx::XDeleteRows, + css::sdbc::XCloseable, + css::sdbc::XColumnLocate, + css::lang::XServiceInfo> OResultSet_BASE; + + + typedef sal_Int64 TVoidPtr; + typedef std::allocator< TVoidPtr > TVoidAlloc; + typedef std::vector<TVoidPtr> TVoidVector; + + class OResultSet : public cppu::BaseMutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> { + protected: + TVoidVector m_aBindVector; + std::vector<sal_Int32> m_aLengthVector; + std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time + std::vector< ORowSetValue> m_aRow; // only used when SQLGetData can't be called in any order + OStatement_Base* m_pStatement; + css::uno::WeakReferenceHelper m_aStatement; + css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; + rtl_TextEncoding m_nTextEncoding; + sal_Int32 m_nRowPos; + sal_Int32 m_nLastColumnPos; // used for m_aRow just to know where we are + sal_Bool m_bWasNull; + sal_Bool m_bBOF; // before first record + sal_Bool m_bEOF; // after last record + sal_Bool m_bLastRecord; + sal_Bool m_bFreeHandle; + sal_Bool m_bInserting; + sal_Bool m_bFetchData; // true when SQLGetaData can be called in any order or when fetching data for m_aRow + + sal_Bool isBookmarkable() const throw(css::sdbc::SQLException, css::uno::RuntimeException); + sal_Int32 getResultSetConcurrency() const throw(css::sdbc::SQLException, css::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(css::sdbc::SQLException, css::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(css::sdbc::SQLException, css::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(css::sdbc::SQLException, css::uno::RuntimeException); + OUString getCursorName() const throw(css::sdbc::SQLException, css::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(css::sdbc::SQLException, css::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(css::sdbc::SQLException, css::uno::RuntimeException); + + + void fillRow(sal_Int32 _nToColumn); + void allocBuffer(sal_Bool _bAllocRow); + void releaseBuffer(); + + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) + throw (css::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue + ) + throw (css::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle + ) const; + + // you can't delete objects of this type + virtual ~OResultSet(); + public: + DECLARE_SERVICE_INFO(); + + OResultSet( OStatement_Base* pStmt); - /* - ** java_sql_ResultSet - */ - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, - css::sdbc::XRow, - css::sdbc::XResultSetMetaDataSupplier, - css::util::XCancellable, - css::sdbc::XWarningsSupplier, - css::sdbc::XResultSetUpdate, - css::sdbc::XRowUpdate, - css::sdbcx::XRowLocate, - css::sdbcx::XDeleteRows, - css::sdbc::XCloseable, - css::sdbc::XColumnLocate, - css::lang::XServiceInfo> OResultSet_BASE; - - - typedef sal_Int64 TVoidPtr; - typedef std::allocator< TVoidPtr > TVoidAlloc; - typedef std::vector<TVoidPtr> TVoidVector; - - class OResultSet : public cppu::BaseMutex, - public OResultSet_BASE, - public ::cppu::OPropertySetHelper, - public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + + css::uno::Reference< css::uno::XInterface > operator *() { - protected: - TVoidVector m_aBindVector; - std::vector<sal_Int32> m_aLengthVector; - std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time - std::vector< ORowSetValue> m_aRow; // only used when SQLGetData can't be called in any order - OStatement_Base* m_pStatement; - css::uno::WeakReferenceHelper m_aStatement; - css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData; - rtl_TextEncoding m_nTextEncoding; - sal_Int32 m_nRowPos; - sal_Int32 m_nLastColumnPos; // used for m_aRow just to know where we are - sal_Bool m_bWasNull; - sal_Bool m_bBOF; // before first record - sal_Bool m_bEOF; // after last record - sal_Bool m_bLastRecord; - sal_Bool m_bFreeHandle; - sal_Bool m_bInserting; - sal_Bool m_bFetchData; // true when SQLGetaData can be called in any order or when fetching data for m_aRow - - sal_Bool isBookmarkable() const throw(css::sdbc::SQLException, css::uno::RuntimeException); - sal_Int32 getResultSetConcurrency() const throw(css::sdbc::SQLException, css::uno::RuntimeException); - sal_Int32 getResultSetType() const throw(css::sdbc::SQLException, css::uno::RuntimeException); - sal_Int32 getFetchDirection() const throw(css::sdbc::SQLException, css::uno::RuntimeException); - sal_Int32 getFetchSize() const throw(css::sdbc::SQLException, css::uno::RuntimeException); - OUString getCursorName() const throw(css::sdbc::SQLException, css::uno::RuntimeException); - - void setFetchDirection(sal_Int32 _par0) throw(css::sdbc::SQLException, css::uno::RuntimeException); - void setFetchSize(sal_Int32 _par0) throw(css::sdbc::SQLException, css::uno::RuntimeException); - - - void fillRow(sal_Int32 _nToColumn); - void allocBuffer(sal_Bool _bAllocRow); - void releaseBuffer(); - - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); - - virtual sal_Bool SAL_CALL convertFastPropertyValue( - css::uno::Any & rConvertedValue, - css::uno::Any & rOldValue, - sal_Int32 nHandle, - const css::uno::Any& rValue ) - throw (css::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle, - const css::uno::Any& rValue - ) - throw (css::uno::Exception); - virtual void SAL_CALL getFastPropertyValue( - css::uno::Any& rValue, - sal_Int32 nHandle - ) const; - - // you can't delete objects of this type - virtual ~OResultSet(); - public: - DECLARE_SERVICE_INFO(); - - OResultSet( OStatement_Base* pStmt); - - - css::uno::Reference< css::uno::XInterface > operator *() - { - return css::uno::Reference< css::uno::XInterface >(*(OResultSet_BASE*)this); - } - - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing(); - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException); - virtual void SAL_CALL acquire() throw(css::uno::RuntimeException); - virtual void SAL_CALL release() throw(css::uno::RuntimeException); - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException); - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException); - // XResultSet - virtual sal_Bool SAL_CALL next( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAfterLast( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL isFirst( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL isLast( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL beforeFirst( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL afterLast( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL first( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL last( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL previous( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL refreshRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowUpdated( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowInserted( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowDeleted( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XRow - virtual sal_Bool SAL_CALL wasNull( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XResultSetMetaDataSupplier - virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XCancellable - virtual void SAL_CALL cancel( ) throw(css::uno::RuntimeException); - // XCloseable - virtual void SAL_CALL close( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL clearWarnings( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XResultSetUpdate - virtual void SAL_CALL insertRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL deleteRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL cancelRowUpdates( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL moveToInsertRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL moveToCurrentRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XRowUpdate - virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XRowLocate - virtual css::uno::Any SAL_CALL getBookmark( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - // XDeleteRows - virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) throw(css::sdbc::SQLException, css::uno::RuntimeException); - }; - } + return css::uno::Reference< css::uno::XInterface >(*(OResultSet_BASE*)this); + } + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(); + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(css::uno::RuntimeException); + virtual void SAL_CALL release() throw(css::uno::RuntimeException); + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException); + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(css::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XWarningsSupplier + virtual css::uno::Any SAL_CALL getWarnings( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const css::util::Date& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const css::util::Time& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const css::util::DateTime& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const css::uno::Any& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XRowLocate + virtual css::uno::Any SAL_CALL getBookmark( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + // XDeleteRows + virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const css::uno::Sequence< css::uno::Any >& rows ) throw(css::sdbc::SQLException, css::uno::RuntimeException); + }; +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/PColumn.hxx b/include/connectivity/PColumn.hxx index e4a5826b861e..b0ececda3450 100644 --- a/include/connectivity/PColumn.hxx +++ b/include/connectivity/PColumn.hxx @@ -34,112 +34,112 @@ namespace com::sun::star::sdbc { class XDatabaseMetaData; } namespace com::sun::star::sdbc { class XResultSetMetaData; } namespace connectivity::parse +{ + class OParseColumn; + + typedef sdbcx::OColumn OParseColumn_BASE; + typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP; + + class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OParseColumn final : + public OParseColumn_BASE, public OParseColumn_PROP { - class OParseColumn; - - typedef sdbcx::OColumn OParseColumn_BASE; - typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP; - - class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OParseColumn final : - public OParseColumn_BASE, public OParseColumn_PROP - { - OUString m_aRealName; - OUString m_sLabel; - bool m_bFunction; - bool m_bDbasePrecisionChanged; - bool m_bAggregateFunction; - bool m_bIsSearchable; - - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - virtual ~OParseColumn() override; - public: - OParseColumn(const css::uno::Reference< css::beans::XPropertySet>& _xColumn, bool _bCase); - OParseColumn(const OUString& Name, - const OUString& TypeName, - const OUString& DefaultValue, - const OUString& Description, - sal_Int32 IsNullable, - sal_Int32 Precision, - sal_Int32 Scale, - sal_Int32 Type, - bool IsAutoIncrement, - bool IsCurrency, - bool _bCase, - const OUString& CatalogName, - const OUString& SchemaName, - const OUString& TableName); - - virtual void construct() override; - - void setRealName(const OUString& _rName) { m_aRealName = _rName; } - void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; } - void setTableName(const OUString& _rName) { m_TableName = _rName; } - void setFunction(bool _bFunction) { m_bFunction = _bFunction; } - void setAggregateFunction(bool _bFunction) { m_bAggregateFunction = _bFunction; } - void setIsSearchable( bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; } - const OUString& getRealName() const { return m_aRealName; } - - /** creates a collection of OParseColumn, as described by a result set meta data instance. - */ - static ::rtl::Reference< OSQLColumns > - createColumnsForResultSet( - const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData, - const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData, - const css::uno::Reference< css::container::XNameAccess>& i_xQueryColumns - ); - - typedef std::map<OUString, int> StringMap; - /** creates a single OParseColumn, as described by a result set meta data instance. - The column names are unique. - */ - static rtl::Reference<OParseColumn> - createColumnForResultSet( - const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData, - const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData, - sal_Int32 _nColumnPos, - StringMap& _rColumns - ); - - private: - using OParseColumn_BASE::createArrayHelper; - }; - - class OOrderColumn; - - typedef sdbcx::OColumn OOrderColumn_BASE; - typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP; - - class OOrderColumn final : - public OOrderColumn_BASE, public OOrderColumn_PROP - { - const bool m_bAscending; - - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - - virtual ~OOrderColumn() override; - public: - OOrderColumn( - const css::uno::Reference< css::beans::XPropertySet>& _xColumn, - const OUString& i_rOriginatingTableName, - bool _bCase, - bool _bAscending + OUString m_aRealName; + OUString m_sLabel; + bool m_bFunction; + bool m_bDbasePrecisionChanged; + bool m_bAggregateFunction; + bool m_bIsSearchable; + + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual ~OParseColumn() override; + public: + OParseColumn(const css::uno::Reference< css::beans::XPropertySet>& _xColumn, bool _bCase); + OParseColumn(const OUString& Name, + const OUString& TypeName, + const OUString& DefaultValue, + const OUString& Description, + sal_Int32 IsNullable, + sal_Int32 Precision, + sal_Int32 Scale, + sal_Int32 Type, + bool IsAutoIncrement, + bool IsCurrency, + bool _bCase, + const OUString& CatalogName, + const OUString& SchemaName, + const OUString& TableName); + + virtual void construct() override; + + void setRealName(const OUString& _rName) { m_aRealName = _rName; } + void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; } + void setTableName(const OUString& _rName) { m_TableName = _rName; } + void setFunction(bool _bFunction) { m_bFunction = _bFunction; } + void setAggregateFunction(bool _bFunction) { m_bAggregateFunction = _bFunction; } + void setIsSearchable( bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; } + const OUString& getRealName() const { return m_aRealName; } + + /** creates a collection of OParseColumn, as described by a result set meta data instance. + */ + static ::rtl::Reference< OSQLColumns > + createColumnsForResultSet( + const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData, + const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData, + const css::uno::Reference< css::container::XNameAccess>& i_xQueryColumns ); - OOrderColumn( - const css::uno::Reference< css::beans::XPropertySet>& _xColumn, - bool _bCase, - bool _bAscending + typedef std::map<OUString, int> StringMap; + /** creates a single OParseColumn, as described by a result set meta data instance. + The column names are unique. + */ + static rtl::Reference<OParseColumn> + createColumnForResultSet( + const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData, + const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData, + sal_Int32 _nColumnPos, + StringMap& _rColumns ); - virtual void construct() override; + private: + using OParseColumn_BASE::createArrayHelper; + }; + + class OOrderColumn; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - private: - using OOrderColumn_BASE::createArrayHelper; - }; + typedef sdbcx::OColumn OOrderColumn_BASE; + typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP; + + class OOrderColumn final : + public OOrderColumn_BASE, public OOrderColumn_PROP + { + const bool m_bAscending; + + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual ~OOrderColumn() override; + public: + OOrderColumn( + const css::uno::Reference< css::beans::XPropertySet>& _xColumn, + const OUString& i_rOriginatingTableName, + bool _bCase, + bool _bAscending + ); + + OOrderColumn( + const css::uno::Reference< css::beans::XPropertySet>& _xColumn, + bool _bCase, + bool _bAscending + ); + + virtual void construct() override; + + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + private: + using OOrderColumn_BASE::createArrayHelper; + }; } diff --git a/include/connectivity/sdbcx/IRefreshable.hxx b/include/connectivity/sdbcx/IRefreshable.hxx index 412ef8079356..4edd913e32e8 100644 --- a/include/connectivity/sdbcx/IRefreshable.hxx +++ b/include/connectivity/sdbcx/IRefreshable.hxx @@ -22,33 +22,33 @@ #include <connectivity/dbtoolsdllapi.hxx> namespace connectivity::sdbcx +{ + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableGroups { - class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableGroups - { - public: - virtual void refreshGroups() = 0; - - protected: - ~IRefreshableGroups() {} - }; - - class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers - { - public: - virtual void refreshUsers() = 0; - - protected: - ~IRefreshableUsers() {} - }; - - class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns - { - public: - virtual void refreshColumns() = 0; - - protected: - ~IRefreshableColumns() {} - }; + public: + virtual void refreshGroups() = 0; + + protected: + ~IRefreshableGroups() {} + }; + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers + { + public: + virtual void refreshUsers() = 0; + + protected: + ~IRefreshableUsers() {} + }; + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns + { + public: + virtual void refreshColumns() = 0; + + protected: + ~IRefreshableColumns() {} + }; } #endif // INCLUDED_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX diff --git a/include/connectivity/sdbcx/VCollection.hxx b/include/connectivity/sdbcx/VCollection.hxx index 89bdbfecab4c..04ed11a8885b 100644 --- a/include/connectivity/sdbcx/VCollection.hxx +++ b/include/connectivity/sdbcx/VCollection.hxx @@ -39,179 +39,179 @@ namespace connectivity::sdbcx +{ + + // the class OCollection is base class for collections :-) + typedef ::cppu::ImplHelper10< css::container::XNameAccess, + css::container::XIndexAccess, + css::container::XEnumerationAccess, + css::container::XContainer, + css::sdbc::XColumnLocate, + css::util::XRefreshable, + css::sdbcx::XDataDescriptorFactory, + css::sdbcx::XAppend, + css::sdbcx::XDrop, + css::lang::XServiceInfo> OCollectionBase; + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IObjectCollection { - - // the class OCollection is base class for collections :-) - typedef ::cppu::ImplHelper10< css::container::XNameAccess, - css::container::XIndexAccess, - css::container::XEnumerationAccess, - css::container::XContainer, - css::sdbc::XColumnLocate, - css::util::XRefreshable, - css::sdbcx::XDataDescriptorFactory, - css::sdbcx::XAppend, - css::sdbcx::XDrop, - css::lang::XServiceInfo> OCollectionBase; - - class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IObjectCollection - { - public: - virtual ~IObjectCollection(); - virtual bool exists(const OUString& _sName ) = 0; - virtual bool empty() = 0; - virtual void swapAll() = 0; - virtual void swap() = 0; - virtual void clear() = 0; - virtual void reFill(const ::std::vector< OUString> &_rVector) = 0; - virtual void insert(const OUString& _sName, const css::uno::Reference< css::beans::XPropertySet >& _xObject) = 0; - virtual bool rename(const OUString& _sOldName, const OUString& _sNewName) = 0; - virtual sal_Int32 size() = 0; - virtual css::uno::Sequence< OUString > getElementNames() = 0; - virtual OUString getName(sal_Int32 _nIndex) = 0; - virtual void disposeAndErase(sal_Int32 _nIndex) = 0; - virtual void disposeElements() = 0; - virtual sal_Int32 findColumn( const OUString& columnName ) = 0; - virtual css::uno::Reference< css::beans::XPropertySet > getObject(sal_Int32 _nIndex) = 0; - virtual css::uno::Reference< css::beans::XPropertySet > getObject(const OUString& columnName) = 0; - virtual void setObject(sal_Int32 _nIndex,const css::uno::Reference< css::beans::XPropertySet >& _xObject) = 0; - virtual bool isCaseSensitive() const = 0; - }; - - // OCollection - - class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection : - public OCollectionBase - { - protected: - ::std::unique_ptr<IObjectCollection> m_pElements; - - ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners; - ::comphelper::OInterfaceContainerHelper3<css::util::XRefreshListener> m_aRefreshListeners; - - protected: - ::cppu::OWeakObject& m_rParent; // parent of the collection - ::osl::Mutex& m_rMutex; // mutex of the parent - bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed - - // the implementing class should refresh their elements - /// @throws css::uno::RuntimeException - virtual void impl_refresh() = 0; - - // will be called when an object was requested by one of the accessing methods like getByIndex - virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) = 0; - - // will be called when a new object should be generated by a call of createDataDescriptor - // the returned object is empty will be filled outside and added to the collection - virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor(); - - /** appends an object described by a descriptor, under a given name - @param _rForName - is the name under which the object should be appended. Guaranteed to not be empty. - This is passed for convenience only, since it's the result of a call of - getNameForObject for the given descriptor - @param descriptor - describes the object to append - @return - the new object which is to be inserted into the collection. This might be the result - of a call of <code>createObject( _rForName )</code>, or a clone of the descriptor. - */ - virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ); - - // called when XDrop was called - virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName); - - /** returns the name for the object. The default implementation ask for the property NAME. If this doesn't satisfy, it has to be overridden. - @param _xObject The object where the name should be extracted. - @return The name of the object. - */ - virtual OUString getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject); - - /** clones the given descriptor - - The method calls createDescriptor to create a new, empty descriptor, and then copies all properties from - _descriptor to the new object, which is returned. - - This method might come handy in derived classes for implementing appendObject, when the object - is not actually appended to any backend (e.g. for the columns collection of a descriptor object itself, - where there is not yet a database backend to append the column to). - */ - css::uno::Reference< css::beans::XPropertySet > cloneDescriptor( const css::uno::Reference< css::beans::XPropertySet >& _descriptor ); - - OCollection(::cppu::OWeakObject& _rParent, - bool _bCase, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - bool _bUseIndexOnly = false, - bool _bUseHardRef = true); - - /** clear the name map - <p>Does <em>not</em> dispose the objects hold by the collection.</p> - */ - void clear_NoDispose(); - - /** insert a new element into the collection - */ - void insertElement(const OUString& _sElementName,const css::uno::Reference< css::beans::XPropertySet >& _xElement); - - /** return the object, if not existent it creates it. - @param _nIndex - The index of the object to create. - @return ObjectType - */ - css::uno::Reference< css::beans::XPropertySet > getObject(sal_Int32 _nIndex); - - public: - virtual ~OCollection(); - DECLARE_SERVICE_INFO(); - - void reFill(const ::std::vector< OUString> &_rVector); - bool isCaseSensitive() const { return m_pElements->isCaseSensitive(); } - void renameObject(const OUString& _sOldName, const OUString& _sNewName); - - // only the name is identical to ::cppu::OComponentHelper - virtual void disposing(); - // dispatch the refcounting to the parent - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; - - // css::container::XElementAccess - virtual css::uno::Type SAL_CALL getElementType( ) override; - virtual sal_Bool SAL_CALL hasElements( ) override; - // css::container::XIndexAccess - virtual sal_Int32 SAL_CALL getCount( ) override; - virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; - - // css::container::XNameAccess - virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override; - virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; - // XEnumerationAccess - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; - // css::util::XRefreshable - virtual void SAL_CALL refresh( ) override; - virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override; - virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override; - // XDataDescriptorFactory - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; - // XAppend - virtual void SAL_CALL appendByDescriptor( const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; - // XDrop - virtual void SAL_CALL dropByName( const OUString& elementName ) override; - virtual void SAL_CALL dropByIndex( sal_Int32 index ) override; - // XColumnLocate - virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; - // css::container::XContainer - virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; - virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; - private: - void notifyElementRemoved(const OUString& _sName); - void disposeElements(); - void dropImpl(sal_Int32 _nIndex, bool _bReallyDrop = true); - }; + public: + virtual ~IObjectCollection(); + virtual bool exists(const OUString& _sName ) = 0; + virtual bool empty() = 0; + virtual void swapAll() = 0; + virtual void swap() = 0; + virtual void clear() = 0; + virtual void reFill(const ::std::vector< OUString> &_rVector) = 0; + virtual void insert(const OUString& _sName, const css::uno::Reference< css::beans::XPropertySet >& _xObject) = 0; + virtual bool rename(const OUString& _sOldName, const OUString& _sNewName) = 0; + virtual sal_Int32 size() = 0; + virtual css::uno::Sequence< OUString > getElementNames() = 0; + virtual OUString getName(sal_Int32 _nIndex) = 0; + virtual void disposeAndErase(sal_Int32 _nIndex) = 0; + virtual void disposeElements() = 0; + virtual sal_Int32 findColumn( const OUString& columnName ) = 0; + virtual css::uno::Reference< css::beans::XPropertySet > getObject(sal_Int32 _nIndex) = 0; + virtual css::uno::Reference< css::beans::XPropertySet > getObject(const OUString& columnName) = 0; + virtual void setObject(sal_Int32 _nIndex,const css::uno::Reference< css::beans::XPropertySet >& _xObject) = 0; + virtual bool isCaseSensitive() const = 0; + }; + + // OCollection + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection : + public OCollectionBase + { + protected: + ::std::unique_ptr<IObjectCollection> m_pElements; + + ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper3<css::util::XRefreshListener> m_aRefreshListeners; + + protected: + ::cppu::OWeakObject& m_rParent; // parent of the collection + ::osl::Mutex& m_rMutex; // mutex of the parent + bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed + + // the implementing class should refresh their elements + /// @throws css::uno::RuntimeException + virtual void impl_refresh() = 0; + + // will be called when an object was requested by one of the accessing methods like getByIndex + virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) = 0; + + // will be called when a new object should be generated by a call of createDataDescriptor + // the returned object is empty will be filled outside and added to the collection + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor(); + + /** appends an object described by a descriptor, under a given name + @param _rForName + is the name under which the object should be appended. Guaranteed to not be empty. + This is passed for convenience only, since it's the result of a call of + getNameForObject for the given descriptor + @param descriptor + describes the object to append + @return + the new object which is to be inserted into the collection. This might be the result + of a call of <code>createObject( _rForName )</code>, or a clone of the descriptor. + */ + virtual css::uno::Reference< css::beans::XPropertySet > appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ); + + // called when XDrop was called + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName); + + /** returns the name for the object. The default implementation ask for the property NAME. If this doesn't satisfy, it has to be overridden. + @param _xObject The object where the name should be extracted. + @return The name of the object. + */ + virtual OUString getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject); + + /** clones the given descriptor + + The method calls createDescriptor to create a new, empty descriptor, and then copies all properties from + _descriptor to the new object, which is returned. + + This method might come handy in derived classes for implementing appendObject, when the object + is not actually appended to any backend (e.g. for the columns collection of a descriptor object itself, + where there is not yet a database backend to append the column to). + */ + css::uno::Reference< css::beans::XPropertySet > cloneDescriptor( const css::uno::Reference< css::beans::XPropertySet >& _descriptor ); + + OCollection(::cppu::OWeakObject& _rParent, + bool _bCase, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + bool _bUseIndexOnly = false, + bool _bUseHardRef = true); + + /** clear the name map + <p>Does <em>not</em> dispose the objects hold by the collection.</p> + */ + void clear_NoDispose(); + + /** insert a new element into the collection + */ + void insertElement(const OUString& _sElementName,const css::uno::Reference< css::beans::XPropertySet >& _xElement); + + /** return the object, if not existent it creates it. + @param _nIndex + The index of the object to create. + @return ObjectType + */ + css::uno::Reference< css::beans::XPropertySet > getObject(sal_Int32 _nIndex); + + public: + virtual ~OCollection(); + DECLARE_SERVICE_INFO(); + + void reFill(const ::std::vector< OUString> &_rVector); + bool isCaseSensitive() const { return m_pElements->isCaseSensitive(); } + void renameObject(const OUString& _sOldName, const OUString& _sNewName); + + // only the name is identical to ::cppu::OComponentHelper + virtual void disposing(); + // dispatch the refcounting to the parent + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + + // css::container::XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + // css::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // css::container::XNameAccess + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; + // css::util::XRefreshable + virtual void SAL_CALL refresh( ) override; + virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override; + virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override; + // XDataDescriptorFactory + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; + // XAppend + virtual void SAL_CALL appendByDescriptor( const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + // XDrop + virtual void SAL_CALL dropByName( const OUString& elementName ) override; + virtual void SAL_CALL dropByIndex( sal_Int32 index ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + // css::container::XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + private: + void notifyElementRemoved(const OUString& _sName); + void disposeElements(); + void dropImpl(sal_Int32 _nIndex, bool _bReallyDrop = true); + }; } #endif // INCLUDED_CONNECTIVITY_SDBCX_VCOLLECTION_HXX diff --git a/include/connectivity/sdbcx/VColumn.hxx b/include/connectivity/sdbcx/VColumn.hxx index 5862eb06f40c..d161f9ec1b57 100644 --- a/include/connectivity/sdbcx/VColumn.hxx +++ b/include/connectivity/sdbcx/VColumn.hxx @@ -31,83 +31,83 @@ #include <com/sun/star/lang/XServiceInfo.hpp> namespace connectivity::sdbcx - { - class OColumn; - typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP; +{ + class OColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP; - typedef ::cppu::WeakComponentImplHelper< css::container::XNamed, - css::lang::XServiceInfo> OColumnDescriptor_BASE; - typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OColumn_BASE; + typedef ::cppu::WeakComponentImplHelper< css::container::XNamed, + css::lang::XServiceInfo> OColumnDescriptor_BASE; + typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OColumn_BASE; - class OOO_DLLPUBLIC_DBTOOLS OColumn : - public cppu::BaseMutex, - public OColumn_BASE, - public OColumnDescriptor_BASE, - public OColumn_PROP, - public ODescriptor - { - protected: - OUString m_TypeName; - OUString m_Description; - OUString m_DefaultValue; + class OOO_DLLPUBLIC_DBTOOLS OColumn : + public cppu::BaseMutex, + public OColumn_BASE, + public OColumnDescriptor_BASE, + public OColumn_PROP, + public ODescriptor + { + protected: + OUString m_TypeName; + OUString m_Description; + OUString m_DefaultValue; - sal_Int32 m_IsNullable; - sal_Int32 m_Precision; - sal_Int32 m_Scale; - sal_Int32 m_Type; + sal_Int32 m_IsNullable; + sal_Int32 m_Precision; + sal_Int32 m_Scale; + sal_Int32 m_Type; - bool m_IsAutoIncrement; - bool m_IsRowVersion; - bool m_IsCurrency; + bool m_IsAutoIncrement; + bool m_IsRowVersion; + bool m_IsCurrency; - OUString m_CatalogName; - OUString m_SchemaName; - OUString m_TableName; + OUString m_CatalogName; + OUString m_SchemaName; + OUString m_TableName; - using OColumnDescriptor_BASE::rBHelper; - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + using OColumnDescriptor_BASE::rBHelper; + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; - virtual ~OColumn() override; - public: - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; + virtual ~OColumn() override; + public: + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; - OColumn( bool _bCase); - OColumn( const OUString& Name, - OUString TypeName, - OUString DefaultValue, - OUString Description, - sal_Int32 IsNullable, - sal_Int32 Precision, - sal_Int32 Scale, - sal_Int32 Type, - bool IsAutoIncrement, - bool IsRowVersion, - bool IsCurrency, - bool _bCase, - OUString CatalogName, - OUString SchemaName, - OUString TableName); + OColumn( bool _bCase); + OColumn( const OUString& Name, + OUString TypeName, + OUString DefaultValue, + OUString Description, + sal_Int32 IsNullable, + sal_Int32 Precision, + sal_Int32 Scale, + sal_Int32 Type, + bool IsAutoIncrement, + bool IsRowVersion, + bool IsCurrency, + bool _bCase, + OUString CatalogName, + OUString SchemaName, + OUString TableName); - DECLARE_SERVICE_INFO(); - //XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // ODescriptor - virtual void construct() override; - // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XNamed - virtual OUString SAL_CALL getName( ) override; - virtual void SAL_CALL setName( const OUString& aName ) override; - // XDataDescriptorFactory - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; - }; + DECLARE_SERVICE_INFO(); + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // ODescriptor + virtual void construct() override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + // XDataDescriptorFactory + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; + }; } diff --git a/include/connectivity/sdbcx/VDescriptor.hxx b/include/connectivity/sdbcx/VDescriptor.hxx index 0f8337fd6f73..26a9fcb07451 100644 --- a/include/connectivity/sdbcx/VDescriptor.hxx +++ b/include/connectivity/sdbcx/VDescriptor.hxx @@ -25,48 +25,48 @@ #include <connectivity/dbtoolsdllapi.hxx> namespace connectivity::sdbcx - { +{ - // = ODescriptor + // = ODescriptor - typedef ::comphelper::OPropertyContainer ODescriptor_PBASE; - class OOO_DLLPUBLIC_DBTOOLS ODescriptor - :public ODescriptor_PBASE - { - protected: - OUString m_Name; + typedef ::comphelper::OPropertyContainer ODescriptor_PBASE; + class OOO_DLLPUBLIC_DBTOOLS ODescriptor + :public ODescriptor_PBASE + { + protected: + OUString m_Name; - /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper + /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper - This method just calls describeProperties, and flags all properties as READONLY if and - only if we do *not* act as descriptor, but as final object. + This method just calls describeProperties, and flags all properties as READONLY if and + only if we do *not* act as descriptor, but as final object. - @seealso isNew - */ - ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const; + @seealso isNew + */ + ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const; - private: - comphelper::UStringMixEqual m_aCase; - bool m_bNew; + private: + comphelper::UStringMixEqual m_aCase; + bool m_bNew; - public: - ODescriptor(::cppu::OBroadcastHelper& _rBHelper, bool _bCase, bool _bNew = false); + public: + ODescriptor(::cppu::OBroadcastHelper& _rBHelper, bool _bCase, bool _bNew = false); - virtual ~ODescriptor() override; + virtual ~ODescriptor() override; - bool isNew() const { return m_bNew; } - void setNew(bool _bNew); + bool isNew() const { return m_bNew; } + void setNew(bool _bNew); - bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); } + bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); } - virtual void construct(); + virtual void construct(); - /// @throws css::uno::RuntimeException - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ); + /// @throws css::uno::RuntimeException + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ); - // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag - static bool isNew( const css::uno::Reference< css::uno::XInterface >& _rxDescriptor ); - }; + // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag + static bool isNew( const css::uno::Reference< css::uno::XInterface >& _rxDescriptor ); + }; } diff --git a/include/connectivity/sdbcx/VView.hxx b/include/connectivity/sdbcx/VView.hxx index e441812a9999..77a3e93df25e 100644 --- a/include/connectivity/sdbcx/VView.hxx +++ b/include/connectivity/sdbcx/VView.hxx @@ -32,58 +32,58 @@ namespace com::sun::star::sdbc { class XDatabaseMetaData; } namespace connectivity::sdbcx - { +{ - typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo, - css::container::XNamed> OView_BASE; + typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo, + css::container::XNamed> OView_BASE; - class OOO_DLLPUBLIC_DBTOOLS OView : - public ::comphelper::OMutexAndBroadcastHelper, - public OView_BASE, - public ::comphelper::OIdPropertyArrayUsageHelper<OView>, - public ODescriptor - { - protected: - OUString m_CatalogName; - OUString m_SchemaName; - OUString m_Command; - sal_Int32 m_CheckOption; - // need for the getName method - css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + class OOO_DLLPUBLIC_DBTOOLS OView : + public ::comphelper::OMutexAndBroadcastHelper, + public OView_BASE, + public ::comphelper::OIdPropertyArrayUsageHelper<OView>, + public ODescriptor + { + protected: + OUString m_CatalogName; + OUString m_SchemaName; + OUString m_Command; + sal_Int32 m_CheckOption; + // need for the getName method + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; - public: - DECLARE_SERVICE_INFO(); + public: + DECLARE_SERVICE_INFO(); - OView(bool _bCase, css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData); - OView( bool _bCase, - const OUString& _rName, - css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, - OUString _sCommand = OUString(), - OUString _sSchemaName = OUString(), - OUString _sCatalogName = OUString()); - virtual ~OView() override; + OView(bool _bCase, css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData); + OView( bool _bCase, + const OUString& _rName, + css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, + OUString _sCommand = OUString(), + OUString _sSchemaName = OUString(), + OUString _sCatalogName = OUString()); + virtual ~OView() override; - // ODescriptor - virtual void construct() override; + // ODescriptor + virtual void construct() override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - // XNamed - virtual OUString SAL_CALL getName( ) override; - virtual void SAL_CALL setName( const OUString& ) override; - }; + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& ) override; + }; } |