summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/CppunitTest_connectivity_ado.mk1
-rw-r--r--connectivity/CppunitTest_connectivity_sharedresources.mk1
-rw-r--r--connectivity/IwyuFilter_connectivity.yaml9
-rw-r--r--connectivity/Library_ado.mk9
-rw-r--r--connectivity/Library_calc.mk2
-rw-r--r--connectivity/Library_dbase.mk4
-rw-r--r--connectivity/Library_dbpool2.mk2
-rw-r--r--connectivity/Library_dbtools.mk4
-rw-r--r--connectivity/Library_evoab.mk3
-rw-r--r--connectivity/Library_firebird_sdbc.mk4
-rw-r--r--connectivity/Library_flat.mk2
-rw-r--r--connectivity/Library_hsqldb.mk3
-rw-r--r--connectivity/Library_jdbc.mk2
-rw-r--r--connectivity/Library_macab1.mk2
-rw-r--r--connectivity/Library_mozbootstrap.mk35
-rw-r--r--connectivity/Library_mysql_jdbc.mk3
-rw-r--r--connectivity/Library_mysqlc.mk38
-rw-r--r--connectivity/Library_odbc.mk5
-rw-r--r--connectivity/Library_postgresql-sdbc-impl.mk15
-rw-r--r--connectivity/Library_postgresql-sdbc.mk2
-rw-r--r--connectivity/Library_sdbc2.mk6
-rw-r--r--connectivity/Library_writer.mk2
-rw-r--r--connectivity/Module_connectivity.mk24
-rw-r--r--connectivity/README44
-rw-r--r--connectivity/README.md66
-rw-r--r--connectivity/Rdb_postgresql-sdbc.mk5
-rw-r--r--connectivity/inc/TIndexColumns.hxx2
-rw-r--r--connectivity/inc/TKeyColumns.hxx2
-rw-r--r--connectivity/inc/bitmaps.hlst5
-rw-r--r--connectivity/inc/pch/precompiled_ado.hxx6
-rw-r--r--connectivity/inc/pch/precompiled_calc.hxx4
-rw-r--r--connectivity/inc/pch/precompiled_dbase.hxx7
-rw-r--r--connectivity/inc/pch/precompiled_dbpool2.hxx4
-rw-r--r--connectivity/inc/pch/precompiled_dbtools.hxx6
-rw-r--r--connectivity/inc/pch/precompiled_file.hxx9
-rw-r--r--connectivity/inc/pch/precompiled_firebird_sdbc.hxx4
-rw-r--r--connectivity/inc/pch/precompiled_flat.hxx4
-rw-r--r--connectivity/inc/pch/precompiled_mysql_jdbc.hxx3
-rw-r--r--connectivity/inc/pch/precompiled_odbc.hxx4
-rw-r--r--connectivity/inc/pch/precompiled_postgresql-sdbc-impl.hxx5
-rw-r--r--connectivity/inc/sdbcx/VCatalog.hxx146
-rw-r--r--connectivity/inc/sdbcx/VGroup.hxx96
-rw-r--r--connectivity/inc/sdbcx/VIndex.hxx111
-rw-r--r--connectivity/inc/sdbcx/VIndexColumn.hxx55
-rw-r--r--connectivity/inc/sdbcx/VKey.hxx127
-rw-r--r--connectivity/inc/sdbcx/VKeyColumn.hxx58
-rw-r--r--connectivity/inc/sdbcx/VTypeDef.hxx6
-rw-r--r--connectivity/inc/sdbcx/VUser.hxx96
-rw-r--r--connectivity/inc/strings.hrc105
-rw-r--r--connectivity/inc/strings.hxx119
-rw-r--r--connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java14
-rw-r--r--connectivity/qa/connectivity/ado/DriverTest.cxx6
-rw-r--r--connectivity/qa/connectivity/commontools/FValue_test.cxx12
-rw-r--r--connectivity/qa/connectivity/mysql/mysql.cxx11
-rw-r--r--connectivity/qa/connectivity/resource/sharedresources_test.cxx29
-rw-r--r--connectivity/qa/connectivity/tools/CRMDatabase.java42
-rw-r--r--connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu19
-rw-r--r--connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu9
-rw-r--r--connectivity/registry/flat/org/openoffice/Office/DataAccess/Drivers.xcu2
-rw-r--r--connectivity/registry/macab/org/openoffice/Office/DataAccess/Drivers.xcu2
-rw-r--r--connectivity/registry/mysql_jdbc/org/openoffice/Office/DataAccess/Drivers.xcu84
-rw-r--r--connectivity/registry/mysqlc/org/openoffice/Office/DataAccess/Drivers.xcu12
-rw-r--r--connectivity/source/commontools/AutoRetrievingBase.cxx3
-rw-r--r--connectivity/source/commontools/BlobHelper.cxx16
-rw-r--r--connectivity/source/commontools/CommonTools.cxx27
-rw-r--r--connectivity/source/commontools/ConnectionWrapper.cxx61
-rw-r--r--connectivity/source/commontools/DateConversion.cxx51
-rw-r--r--connectivity/source/commontools/DriversConfig.cxx54
-rw-r--r--connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx283
-rw-r--r--connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx216
-rw-r--r--connectivity/source/commontools/FValue.cxx79
-rw-r--r--connectivity/source/commontools/ParameterSubstitution.cxx9
-rw-r--r--connectivity/source/commontools/RowFunctionParser.cxx53
-rw-r--r--connectivity/source/commontools/TColumnsHelper.cxx16
-rw-r--r--connectivity/source/commontools/TConnection.cxx15
-rw-r--r--connectivity/source/commontools/TDatabaseMetaDataBase.cxx25
-rw-r--r--connectivity/source/commontools/TIndex.cxx3
-rw-r--r--connectivity/source/commontools/TIndexColumns.cxx53
-rw-r--r--connectivity/source/commontools/TIndexes.cxx24
-rw-r--r--connectivity/source/commontools/TKey.cxx3
-rw-r--r--connectivity/source/commontools/TKeyColumns.cxx77
-rw-r--r--connectivity/source/commontools/TKeys.cxx49
-rw-r--r--connectivity/source/commontools/TPrivilegesResultSet.cxx23
-rw-r--r--connectivity/source/commontools/TSortIndex.cxx8
-rw-r--r--connectivity/source/commontools/TTableHelper.cxx56
-rw-r--r--connectivity/source/commontools/conncleanup.cxx8
-rw-r--r--connectivity/source/commontools/dbcharset.cxx15
-rw-r--r--connectivity/source/commontools/dbconversion.cxx158
-rw-r--r--connectivity/source/commontools/dbexception.cxx99
-rw-r--r--connectivity/source/commontools/dbmetadata.cxx35
-rw-r--r--connectivity/source/commontools/dbtools.cxx206
-rw-r--r--connectivity/source/commontools/dbtools2.cxx298
-rw-r--r--connectivity/source/commontools/filtermanager.cxx19
-rw-r--r--connectivity/source/commontools/formattedcolumnvalue.cxx17
-rw-r--r--connectivity/source/commontools/parameters.cxx210
-rw-r--r--connectivity/source/commontools/paramwrapper.cxx49
-rw-r--r--connectivity/source/commontools/predicateinput.cxx27
-rw-r--r--connectivity/source/commontools/propertyids.cxx1
-rw-r--r--connectivity/source/commontools/sqlerror.cxx29
-rw-r--r--connectivity/source/commontools/statementcomposer.cxx23
-rw-r--r--connectivity/source/commontools/warningscontainer.cxx6
-rw-r--r--connectivity/source/cpool/ZConnectionPool.cxx23
-rw-r--r--connectivity/source/cpool/ZConnectionPool.hxx5
-rw-r--r--connectivity/source/cpool/ZConnectionWrapper.cxx27
-rw-r--r--connectivity/source/cpool/ZConnectionWrapper.hxx9
-rw-r--r--connectivity/source/cpool/ZDriverWrapper.cxx2
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx90
-rw-r--r--connectivity/source/cpool/ZPoolCollection.hxx4
-rw-r--r--connectivity/source/cpool/ZPooledConnection.cxx4
-rw-r--r--connectivity/source/cpool/ZPooledConnection.hxx5
-rw-r--r--connectivity/source/drivers/ado/ACallableStatement.cxx89
-rw-r--r--connectivity/source/drivers/ado/AColumn.cxx34
-rw-r--r--connectivity/source/drivers/ado/AColumns.cxx22
-rw-r--r--connectivity/source/drivers/ado/AConnection.cxx153
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaData.cxx189
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx80
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx454
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx5
-rw-r--r--connectivity/source/drivers/ado/ADriver.cxx96
-rw-r--r--connectivity/source/drivers/ado/AGroup.cxx34
-rw-r--r--connectivity/source/drivers/ado/AGroups.cxx6
-rw-r--r--connectivity/source/drivers/ado/AIndex.cxx19
-rw-r--r--connectivity/source/drivers/ado/AIndexes.cxx8
-rw-r--r--connectivity/source/drivers/ado/AKey.cxx29
-rw-r--r--connectivity/source/drivers/ado/AKeys.cxx10
-rw-r--r--connectivity/source/drivers/ado/APreparedStatement.cxx71
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx93
-rw-r--r--connectivity/source/drivers/ado/AResultSetMetaData.cxx5
-rw-r--r--connectivity/source/drivers/ado/AStatement.cxx147
-rw-r--r--connectivity/source/drivers/ado/ATable.cxx31
-rw-r--r--connectivity/source/drivers/ado/ATables.cxx16
-rw-r--r--connectivity/source/drivers/ado/AUser.cxx28
-rw-r--r--connectivity/source/drivers/ado/AUsers.cxx9
-rw-r--r--connectivity/source/drivers/ado/AView.cxx26
-rw-r--r--connectivity/source/drivers/ado/AViews.cxx17
-rw-r--r--connectivity/source/drivers/ado/Aolevariant.cxx68
-rw-r--r--connectivity/source/drivers/ado/Awrapado.cxx518
-rw-r--r--connectivity/source/drivers/ado/adoimp.cxx10
-rw-r--r--connectivity/source/drivers/calc/CCatalog.cxx3
-rw-r--r--connectivity/source/drivers/calc/CConnection.cxx61
-rw-r--r--connectivity/source/drivers/calc/CDatabaseMetaData.cxx108
-rw-r--r--connectivity/source/drivers/calc/CDriver.cxx11
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx78
-rw-r--r--connectivity/source/drivers/calc/CTables.cxx14
-rw-r--r--connectivity/source/drivers/component/CColumns.cxx10
-rw-r--r--connectivity/source/drivers/component/CDatabaseMetaData.cxx151
-rw-r--r--connectivity/source/drivers/component/CPreparedStatement.cxx5
-rw-r--r--connectivity/source/drivers/component/CResultSet.cxx13
-rw-r--r--connectivity/source/drivers/component/CStatement.cxx7
-rw-r--r--connectivity/source/drivers/component/CTable.cxx8
-rw-r--r--connectivity/source/drivers/dbase/DCatalog.cxx3
-rw-r--r--connectivity/source/drivers/dbase/DColumns.cxx12
-rw-r--r--connectivity/source/drivers/dbase/DConnection.cxx19
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx258
-rw-r--r--connectivity/source/drivers/dbase/DDriver.cxx37
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx37
-rw-r--r--connectivity/source/drivers/dbase/DIndexColumns.cxx10
-rw-r--r--connectivity/source/drivers/dbase/DIndexIter.cxx5
-rw-r--r--connectivity/source/drivers/dbase/DIndexes.cxx51
-rw-r--r--connectivity/source/drivers/dbase/DPreparedStatement.cxx8
-rw-r--r--connectivity/source/drivers/dbase/DResultSet.cxx15
-rw-r--r--connectivity/source/drivers/dbase/DStatement.cxx5
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx289
-rw-r--r--connectivity/source/drivers/dbase/DTables.cxx23
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx56
-rw-r--r--connectivity/source/drivers/evoab2/EApi.cxx121
-rw-r--r--connectivity/source/drivers/evoab2/EApi.h8
-rw-r--r--connectivity/source/drivers/evoab2/NCatalog.cxx12
-rw-r--r--connectivity/source/drivers/evoab2/NCatalog.hxx35
-rw-r--r--connectivity/source/drivers/evoab2/NColumns.cxx56
-rw-r--r--connectivity/source/drivers/evoab2/NColumns.hxx31
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.cxx32
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.hxx142
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx272
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx369
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.cxx15
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.hxx66
-rw-r--r--connectivity/source/drivers/evoab2/NPreparedStatement.cxx59
-rw-r--r--connectivity/source/drivers/evoab2/NPreparedStatement.hxx132
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx240
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.hxx269
-rw-r--r--connectivity/source/drivers/evoab2/NResultSetMetaData.cxx17
-rw-r--r--connectivity/source/drivers/evoab2/NResultSetMetaData.hxx9
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.cxx116
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.hxx442
-rw-r--r--connectivity/source/drivers/evoab2/NTable.cxx15
-rw-r--r--connectivity/source/drivers/evoab2/NTable.hxx41
-rw-r--r--connectivity/source/drivers/evoab2/NTables.cxx40
-rw-r--r--connectivity/source/drivers/evoab2/NTables.hxx36
-rw-r--r--connectivity/source/drivers/file/FCatalog.cxx4
-rw-r--r--connectivity/source/drivers/file/FColumns.cxx53
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx54
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx70
-rw-r--r--connectivity/source/drivers/file/FDateFunctions.cxx26
-rw-r--r--connectivity/source/drivers/file/FDriver.cxx119
-rw-r--r--connectivity/source/drivers/file/FNoException.cxx4
-rw-r--r--connectivity/source/drivers/file/FNumericFunctions.cxx59
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx34
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx91
-rw-r--r--connectivity/source/drivers/file/FResultSetMetaData.cxx11
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx90
-rw-r--r--connectivity/source/drivers/file/FStringFunctions.cxx68
-rw-r--r--connectivity/source/drivers/file/FTable.cxx24
-rw-r--r--connectivity/source/drivers/file/FTables.cxx6
-rw-r--r--connectivity/source/drivers/file/fanalyzer.cxx1
-rw-r--r--connectivity/source/drivers/file/fcode.cxx39
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx48
-rw-r--r--connectivity/source/drivers/firebird/Blob.cxx35
-rw-r--r--connectivity/source/drivers/firebird/Blob.hxx158
-rw-r--r--connectivity/source/drivers/firebird/Catalog.cxx32
-rw-r--r--connectivity/source/drivers/firebird/Catalog.hxx40
-rw-r--r--connectivity/source/drivers/firebird/Clob.cxx90
-rw-r--r--connectivity/source/drivers/firebird/Clob.hxx78
-rw-r--r--connectivity/source/drivers/firebird/Column.cxx6
-rw-r--r--connectivity/source/drivers/firebird/Column.hxx36
-rw-r--r--connectivity/source/drivers/firebird/Columns.cxx6
-rw-r--r--connectivity/source/drivers/firebird/Columns.hxx28
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx252
-rw-r--r--connectivity/source/drivers/firebird/Connection.hxx398
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.cxx400
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.hxx376
-rw-r--r--connectivity/source/drivers/firebird/Driver.cxx61
-rw-r--r--connectivity/source/drivers/firebird/Driver.hxx117
-rw-r--r--connectivity/source/drivers/firebird/Indexes.cxx7
-rw-r--r--connectivity/source/drivers/firebird/Indexes.hxx45
-rw-r--r--connectivity/source/drivers/firebird/Keys.cxx6
-rw-r--r--connectivity/source/drivers/firebird/Keys.hxx34
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx409
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.hxx234
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.cxx127
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.hxx355
-rw-r--r--connectivity/source/drivers/firebird/ResultSetMetaData.cxx144
-rw-r--r--connectivity/source/drivers/firebird/ResultSetMetaData.hxx92
-rw-r--r--connectivity/source/drivers/firebird/Statement.cxx22
-rw-r--r--connectivity/source/drivers/firebird/Statement.hxx112
-rw-r--r--connectivity/source/drivers/firebird/StatementCommonBase.cxx203
-rw-r--r--connectivity/source/drivers/firebird/StatementCommonBase.hxx192
-rw-r--r--connectivity/source/drivers/firebird/SubComponent.hxx141
-rw-r--r--connectivity/source/drivers/firebird/Table.cxx72
-rw-r--r--connectivity/source/drivers/firebird/Table.hxx119
-rw-r--r--connectivity/source/drivers/firebird/Tables.cxx83
-rw-r--r--connectivity/source/drivers/firebird/Tables.hxx81
-rw-r--r--connectivity/source/drivers/firebird/User.cxx4
-rw-r--r--connectivity/source/drivers/firebird/User.hxx54
-rw-r--r--connectivity/source/drivers/firebird/Users.cxx10
-rw-r--r--connectivity/source/drivers/firebird/Users.hxx76
-rw-r--r--connectivity/source/drivers/firebird/Util.cxx103
-rw-r--r--connectivity/source/drivers/firebird/Util.hxx203
-rw-r--r--connectivity/source/drivers/firebird/View.cxx85
-rw-r--r--connectivity/source/drivers/firebird/View.hxx60
-rw-r--r--connectivity/source/drivers/firebird/Views.cxx113
-rw-r--r--connectivity/source/drivers/firebird/Views.hxx43
-rw-r--r--connectivity/source/drivers/flat/ECatalog.cxx3
-rw-r--r--connectivity/source/drivers/flat/EColumns.cxx10
-rw-r--r--connectivity/source/drivers/flat/EConnection.cxx26
-rw-r--r--connectivity/source/drivers/flat/EDatabaseMetaData.cxx87
-rw-r--r--connectivity/source/drivers/flat/EDriver.cxx81
-rw-r--r--connectivity/source/drivers/flat/EPreparedStatement.cxx8
-rw-r--r--connectivity/source/drivers/flat/EResultSet.cxx10
-rw-r--r--connectivity/source/drivers/flat/EStatement.cxx5
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx48
-rw-r--r--connectivity/source/drivers/flat/ETables.cxx16
-rw-r--r--connectivity/source/drivers/hsqldb/HCatalog.cxx15
-rw-r--r--connectivity/source/drivers/hsqldb/HColumns.cxx6
-rw-r--r--connectivity/source/drivers/hsqldb/HConnection.cxx29
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx230
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageAccess.cxx94
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageMap.cxx10
-rw-r--r--connectivity/source/drivers/hsqldb/HTable.cxx33
-rw-r--r--connectivity/source/drivers/hsqldb/HTables.cxx61
-rw-r--r--connectivity/source/drivers/hsqldb/HTerminateListener.cxx1
-rw-r--r--connectivity/source/drivers/hsqldb/HTerminateListener.hxx33
-rw-r--r--connectivity/source/drivers/hsqldb/HTools.cxx8
-rw-r--r--connectivity/source/drivers/hsqldb/HUser.cxx13
-rw-r--r--connectivity/source/drivers/hsqldb/HUsers.cxx16
-rw-r--r--connectivity/source/drivers/hsqldb/HView.cxx17
-rw-r--r--connectivity/source/drivers/hsqldb/HViews.cxx12
-rw-r--r--connectivity/source/drivers/hsqldb/StorageFileAccess.cxx49
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx13
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx4
-rw-r--r--connectivity/source/drivers/hsqldb/accesslog.hxx5
-rw-r--r--connectivity/source/drivers/jdbc/Blob.cxx5
-rw-r--r--connectivity/source/drivers/jdbc/CallableStatement.cxx13
-rw-r--r--connectivity/source/drivers/jdbc/Clob.cxx9
-rw-r--r--connectivity/source/drivers/jdbc/ContextClassLoader.cxx54
-rw-r--r--connectivity/source/drivers/jdbc/DatabaseMetaData.cxx13
-rw-r--r--connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx68
-rw-r--r--connectivity/source/drivers/jdbc/JDriver.cxx170
-rw-r--r--connectivity/source/drivers/jdbc/JStatement.cxx113
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx20
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx19
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx73
-rw-r--r--connectivity/source/drivers/jdbc/ResultSetMetaData.cxx3
-rw-r--r--connectivity/source/drivers/jdbc/SQLException.cxx3
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx3
-rw-r--r--connectivity/source/drivers/macab/MacabAddressBook.cxx11
-rw-r--r--connectivity/source/drivers/macab/MacabAddressBook.hxx41
-rw-r--r--connectivity/source/drivers/macab/MacabCatalog.cxx2
-rw-r--r--connectivity/source/drivers/macab/MacabCatalog.hxx39
-rw-r--r--connectivity/source/drivers/macab/MacabColumns.cxx7
-rw-r--r--connectivity/source/drivers/macab/MacabColumns.hxx27
-rw-r--r--connectivity/source/drivers/macab/MacabConnection.cxx8
-rw-r--r--connectivity/source/drivers/macab/MacabConnection.hxx155
-rw-r--r--connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx49
-rw-r--r--connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx325
-rw-r--r--connectivity/source/drivers/macab/MacabDriver.cxx4
-rw-r--r--connectivity/source/drivers/macab/MacabDriver.hxx200
-rw-r--r--connectivity/source/drivers/macab/MacabGroup.hxx13
-rw-r--r--connectivity/source/drivers/macab/MacabHeader.cxx4
-rw-r--r--connectivity/source/drivers/macab/MacabHeader.hxx64
-rw-r--r--connectivity/source/drivers/macab/MacabPreparedStatement.cxx4
-rw-r--r--connectivity/source/drivers/macab/MacabPreparedStatement.hxx161
-rw-r--r--connectivity/source/drivers/macab/MacabRecord.hxx63
-rw-r--r--connectivity/source/drivers/macab/MacabRecords.cxx185
-rw-r--r--connectivity/source/drivers/macab/MacabRecords.hxx176
-rw-r--r--connectivity/source/drivers/macab/MacabResultSet.cxx84
-rw-r--r--connectivity/source/drivers/macab/MacabResultSet.hxx348
-rw-r--r--connectivity/source/drivers/macab/MacabResultSetMetaData.cxx1
-rw-r--r--connectivity/source/drivers/macab/MacabResultSetMetaData.hxx87
-rw-r--r--connectivity/source/drivers/macab/MacabStatement.cxx112
-rw-r--r--connectivity/source/drivers/macab/MacabStatement.hxx263
-rw-r--r--connectivity/source/drivers/macab/MacabTable.cxx6
-rw-r--r--connectivity/source/drivers/macab/MacabTable.hxx55
-rw-r--r--connectivity/source/drivers/macab/MacabTables.cxx7
-rw-r--r--connectivity/source/drivers/macab/MacabTables.hxx45
-rw-r--r--connectivity/source/drivers/macab/macabcondition.hxx5
-rw-r--r--connectivity/source/drivers/macab/macaborder.hxx51
-rw-r--r--connectivity/source/drivers/macab/macabutilities.hxx174
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx136
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx77
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx159
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx28
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx94
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx54
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx212
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx80
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/README3
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component (renamed from connectivity/source/drivers/mysqlc/DataAccess.xcu)27
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YCatalog.cxx17
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YColumns.cxx6
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YDriver.cxx132
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTable.cxx43
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTables.cxx35
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YUser.cxx11
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YUsers.cxx23
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YViews.cxx15
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx93
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_catalog.hxx38
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_column.cxx45
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_column.hxx32
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_columns.cxx28
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_columns.hxx29
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_connection.cxx86
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_connection.hxx43
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx312
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.hxx7
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_driver.cxx43
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_driver.hxx30
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_general.cxx154
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_general.hxx7
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx25
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_indexes.hxx34
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_keys.cxx19
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_keys.hxx25
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx131
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx16
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx82
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx14
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_propertyids.hxx5
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx102
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx18
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx12
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx9
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_statement.cxx68
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_statement.hxx19
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_subcomponent.hxx20
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_table.cxx168
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_table.hxx69
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_tables.cxx165
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_tables.hxx59
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_types.cxx235
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_types.hxx5
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_user.cxx211
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_user.hxx71
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_users.cxx93
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_users.hxx44
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_view.cxx98
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_view.hxx72
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_views.cxx114
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_views.hxx51
-rw-r--r--connectivity/source/drivers/odbc/OConnection.cxx185
-rw-r--r--connectivity/source/drivers/odbc/ODatabaseMetaData.cxx46
-rw-r--r--connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx877
-rw-r--r--connectivity/source/drivers/odbc/ODriver.cxx900
-rw-r--r--connectivity/source/drivers/odbc/OFunctions.cxx243
-rw-r--r--connectivity/source/drivers/odbc/OPreparedStatement.cxx135
-rw-r--r--connectivity/source/drivers/odbc/ORealDriver.cxx291
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx567
-rw-r--r--connectivity/source/drivers/odbc/OResultSetMetaData.cxx141
-rw-r--r--connectivity/source/drivers/odbc/OStatement.cxx236
-rw-r--r--connectivity/source/drivers/odbc/OTools.cxx272
-rw-r--r--connectivity/source/drivers/postgresql/pq_array.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_array.hxx22
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.cxx14
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx52
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.hxx23
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx259
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.hxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_driver.cxx18
-rw-r--r--connectivity/source/drivers/postgresql/pq_driver.hxx12
-rw-r--r--connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx5
-rw-r--r--connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx56
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.hxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultset.cxx14
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultset.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx20
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx13
-rw-r--r--connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx16
-rw-r--r--connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx7
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx71
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.hxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_statics.cxx159
-rw-r--r--connectivity/source/drivers/postgresql/pq_statics.hxx24
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx115
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.hxx11
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.cxx29
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.hxx30
-rw-r--r--connectivity/source/drivers/postgresql/pq_xbase.cxx12
-rw-r--r--connectivity/source/drivers/postgresql/pq_xbase.hxx13
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumn.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumn.hxx5
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.cxx66
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.hxx12
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.cxx43
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.hxx16
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindex.cxx14
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindex.hxx17
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx5
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx37
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.cxx36
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkey.cxx14
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkey.hxx20
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx5
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx33
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeys.cxx46
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeys.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtable.cxx18
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtable.hxx26
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtables.cxx27
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtables.hxx12
-rw-r--r--connectivity/source/drivers/postgresql/pq_xuser.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xuser.hxx14
-rw-r--r--connectivity/source/drivers/postgresql/pq_xusers.cxx20
-rw-r--r--connectivity/source/drivers/postgresql/pq_xusers.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xview.cxx13
-rw-r--r--connectivity/source/drivers/postgresql/pq_xview.hxx15
-rw-r--r--connectivity/source/drivers/postgresql/pq_xviews.cxx28
-rw-r--r--connectivity/source/drivers/postgresql/pq_xviews.hxx12
-rw-r--r--connectivity/source/drivers/writer/WCatalog.cxx3
-rw-r--r--connectivity/source/drivers/writer/WConnection.cxx48
-rw-r--r--connectivity/source/drivers/writer/WDatabaseMetaData.cxx27
-rw-r--r--connectivity/source/drivers/writer/WDriver.cxx18
-rw-r--r--connectivity/source/drivers/writer/WTable.cxx23
-rw-r--r--connectivity/source/drivers/writer/WTables.cxx14
-rw-r--r--connectivity/source/inc/FDatabaseMetaDataResultSet.hxx74
-rw-r--r--connectivity/source/inc/OColumn.hxx10
-rw-r--r--connectivity/source/inc/OTypeInfo.hxx5
-rw-r--r--connectivity/source/inc/ParameterSubstitution.hxx7
-rw-r--r--connectivity/source/inc/RowFunctionParser.hxx5
-rw-r--r--connectivity/source/inc/TConnection.hxx8
-rw-r--r--connectivity/source/inc/TDatabaseMetaDataBase.hxx199
-rw-r--r--connectivity/source/inc/TKeyValue.hxx9
-rw-r--r--connectivity/source/inc/TPrivilegesResultSet.hxx8
-rw-r--r--connectivity/source/inc/TResultSetHelper.hxx5
-rw-r--r--connectivity/source/inc/TSkipDeletedSet.hxx4
-rw-r--r--connectivity/source/inc/TSortIndex.hxx9
-rw-r--r--connectivity/source/inc/ado/ACallableStatement.hxx80
-rw-r--r--connectivity/source/inc/ado/ACatalog.hxx38
-rw-r--r--connectivity/source/inc/ado/AColumn.hxx49
-rw-r--r--connectivity/source/inc/ado/AColumns.hxx50
-rw-r--r--connectivity/source/inc/ado/AConnection.hxx198
-rw-r--r--connectivity/source/inc/ado/ADatabaseMetaData.hxx377
-rw-r--r--connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx366
-rw-r--r--connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx124
-rw-r--r--connectivity/source/inc/ado/ADriver.hxx96
-rw-r--r--connectivity/source/inc/ado/AGroup.hxx66
-rw-r--r--connectivity/source/inc/ado/AGroups.hxx45
-rw-r--r--connectivity/source/inc/ado/AIndex.hxx37
-rw-r--r--connectivity/source/inc/ado/AIndexes.hxx51
-rw-r--r--connectivity/source/inc/ado/AKey.hxx58
-rw-r--r--connectivity/source/inc/ado/AKeys.hxx51
-rw-r--r--connectivity/source/inc/ado/APreparedStatement.hxx21
-rw-r--r--connectivity/source/inc/ado/AResultSet.hxx380
-rw-r--r--connectivity/source/inc/ado/AResultSetMetaData.hxx80
-rw-r--r--connectivity/source/inc/ado/AStatement.hxx353
-rw-r--r--connectivity/source/inc/ado/ATable.hxx65
-rw-r--r--connectivity/source/inc/ado/ATables.hxx48
-rw-r--r--connectivity/source/inc/ado/AUser.hxx101
-rw-r--r--connectivity/source/inc/ado/AUsers.hxx47
-rw-r--r--connectivity/source/inc/ado/AView.hxx37
-rw-r--r--connectivity/source/inc/ado/AViews.hxx40
-rw-r--r--connectivity/source/inc/ado/Aolevariant.hxx194
-rw-r--r--connectivity/source/inc/ado/Aolewrap.hxx276
-rw-r--r--connectivity/source/inc/ado/Awrapado.hxx670
-rw-r--r--connectivity/source/inc/ado/Awrapadox.hxx4
-rw-r--r--connectivity/source/inc/ado/WrapCatalog.hxx43
-rw-r--r--connectivity/source/inc/ado/WrapColumn.hxx63
-rw-r--r--connectivity/source/inc/ado/WrapIndex.hxx47
-rw-r--r--connectivity/source/inc/ado/WrapKey.hxx51
-rw-r--r--connectivity/source/inc/ado/WrapTable.hxx45
-rw-r--r--connectivity/source/inc/ado/WrapTypeDefs.hxx33
-rw-r--r--connectivity/source/inc/ado/adoimp.hxx91
-rw-r--r--connectivity/source/inc/calc/CCatalog.hxx16
-rw-r--r--connectivity/source/inc/calc/CConnection.hxx188
-rw-r--r--connectivity/source/inc/calc/CDatabaseMetaData.hxx22
-rw-r--r--connectivity/source/inc/calc/CDriver.hxx40
-rw-r--r--connectivity/source/inc/calc/CTable.hxx60
-rw-r--r--connectivity/source/inc/calc/CTables.hxx22
-rw-r--r--connectivity/source/inc/component/CColumns.hxx29
-rw-r--r--connectivity/source/inc/component/CDatabaseMetaData.hxx37
-rw-r--r--connectivity/source/inc/component/CPreparedStatement.hxx24
-rw-r--r--connectivity/source/inc/component/CResultSet.hxx89
-rw-r--r--connectivity/source/inc/component/CStatement.hxx24
-rw-r--r--connectivity/source/inc/component/CTable.hxx69
-rw-r--r--connectivity/source/inc/dbase/DCatalog.hxx20
-rw-r--r--connectivity/source/inc/dbase/DColumns.hxx35
-rw-r--r--connectivity/source/inc/dbase/DConnection.hxx36
-rw-r--r--connectivity/source/inc/dbase/DDatabaseMetaData.hxx56
-rw-r--r--connectivity/source/inc/dbase/DDriver.hxx30
-rw-r--r--connectivity/source/inc/dbase/DIndex.hxx202
-rw-r--r--connectivity/source/inc/dbase/DIndexColumns.hxx36
-rw-r--r--connectivity/source/inc/dbase/DIndexIter.hxx64
-rw-r--r--connectivity/source/inc/dbase/DIndexes.hxx42
-rw-r--r--connectivity/source/inc/dbase/DPreparedStatement.hxx22
-rw-r--r--connectivity/source/inc/dbase/DResultSet.hxx86
-rw-r--r--connectivity/source/inc/dbase/DStatement.hxx22
-rw-r--r--connectivity/source/inc/dbase/DTable.hxx293
-rw-r--r--connectivity/source/inc/dbase/DTables.hxx36
-rw-r--r--connectivity/source/inc/dbase/dindexnode.hxx535
-rw-r--r--connectivity/source/inc/file/FCatalog.hxx62
-rw-r--r--connectivity/source/inc/file/FColumns.hxx32
-rw-r--r--connectivity/source/inc/file/FConnection.hxx194
-rw-r--r--connectivity/source/inc/file/FDatabaseMetaData.hxx302
-rw-r--r--connectivity/source/inc/file/FDateFunctions.hxx403
-rw-r--r--connectivity/source/inc/file/FDriver.hxx69
-rw-r--r--connectivity/source/inc/file/FNumericFunctions.hxx647
-rw-r--r--connectivity/source/inc/file/FPreparedStatement.hxx177
-rw-r--r--connectivity/source/inc/file/FResultSet.hxx502
-rw-r--r--connectivity/source/inc/file/FResultSetMetaData.hxx84
-rw-r--r--connectivity/source/inc/file/FStatement.hxx307
-rw-r--r--connectivity/source/inc/file/FStringFunctions.hxx475
-rw-r--r--connectivity/source/inc/file/FTable.hxx138
-rw-r--r--connectivity/source/inc/file/FTables.hxx28
-rw-r--r--connectivity/source/inc/file/fanalyzer.hxx72
-rw-r--r--connectivity/source/inc/file/fcode.hxx17
-rw-r--r--connectivity/source/inc/file/fcomp.hxx9
-rw-r--r--connectivity/source/inc/file/filedllapi.hxx5
-rw-r--r--connectivity/source/inc/file/quotedstring.hxx5
-rw-r--r--connectivity/source/inc/flat/ECatalog.hxx20
-rw-r--r--connectivity/source/inc/flat/EColumns.hxx26
-rw-r--r--connectivity/source/inc/flat/EConnection.hxx70
-rw-r--r--connectivity/source/inc/flat/EDatabaseMetaData.hxx28
-rw-r--r--connectivity/source/inc/flat/EDriver.hxx30
-rw-r--r--connectivity/source/inc/flat/EPreparedStatement.hxx22
-rw-r--r--connectivity/source/inc/flat/EResultSet.hxx74
-rw-r--r--connectivity/source/inc/flat/EStatement.hxx22
-rw-r--r--connectivity/source/inc/flat/ETable.hxx119
-rw-r--r--connectivity/source/inc/flat/ETables.hxx6
-rw-r--r--connectivity/source/inc/hsqldb/HCatalog.hxx68
-rw-r--r--connectivity/source/inc/hsqldb/HColumns.hxx52
-rw-r--r--connectivity/source/inc/hsqldb/HConnection.hxx201
-rw-r--r--connectivity/source/inc/hsqldb/HDriver.hxx168
-rw-r--r--connectivity/source/inc/hsqldb/HStorageAccess.hxx10
-rw-r--r--connectivity/source/inc/hsqldb/HStorageMap.hxx99
-rw-r--r--connectivity/source/inc/hsqldb/HTable.hxx159
-rw-r--r--connectivity/source/inc/hsqldb/HTables.hxx45
-rw-r--r--connectivity/source/inc/hsqldb/HTools.hxx9
-rw-r--r--connectivity/source/inc/hsqldb/HUser.hxx80
-rw-r--r--connectivity/source/inc/hsqldb/HUsers.hxx11
-rw-r--r--connectivity/source/inc/hsqldb/HView.hxx5
-rw-r--r--connectivity/source/inc/hsqldb/HViews.hxx42
-rw-r--r--connectivity/source/inc/java/ContextClassLoader.hxx5
-rw-r--r--connectivity/source/inc/java/GlobalRef.hxx5
-rw-r--r--connectivity/source/inc/java/LocalRef.hxx5
-rw-r--r--connectivity/source/inc/java/io/InputStream.hxx4
-rw-r--r--connectivity/source/inc/java/io/Reader.hxx4
-rw-r--r--connectivity/source/inc/java/lang/Boolean.hxx5
-rw-r--r--connectivity/source/inc/java/lang/Class.hxx5
-rw-r--r--connectivity/source/inc/java/lang/Exception.hxx4
-rw-r--r--connectivity/source/inc/java/lang/Object.hxx4
-rw-r--r--connectivity/source/inc/java/lang/String.hxx5
-rw-r--r--connectivity/source/inc/java/lang/Throwable.hxx4
-rw-r--r--connectivity/source/inc/java/math/BigDecimal.hxx5
-rw-r--r--connectivity/source/inc/java/sql/Array.hxx4
-rw-r--r--connectivity/source/inc/java/sql/Blob.hxx4
-rw-r--r--connectivity/source/inc/java/sql/CallableStatement.hxx4
-rw-r--r--connectivity/source/inc/java/sql/Clob.hxx4
-rw-r--r--connectivity/source/inc/java/sql/Connection.hxx4
-rw-r--r--connectivity/source/inc/java/sql/ConnectionLog.hxx5
-rw-r--r--connectivity/source/inc/java/sql/DatabaseMetaData.hxx4
-rw-r--r--connectivity/source/inc/java/sql/Driver.hxx4
-rw-r--r--connectivity/source/inc/java/sql/JStatement.hxx12
-rw-r--r--connectivity/source/inc/java/sql/PreparedStatement.hxx4
-rw-r--r--connectivity/source/inc/java/sql/Ref.hxx4
-rw-r--r--connectivity/source/inc/java/sql/ResultSet.hxx10
-rw-r--r--connectivity/source/inc/java/sql/SQLException.hxx4
-rw-r--r--connectivity/source/inc/java/sql/SQLWarning.hxx4
-rw-r--r--connectivity/source/inc/java/sql/Timestamp.hxx4
-rw-r--r--connectivity/source/inc/java/tools.hxx9
-rw-r--r--connectivity/source/inc/java/util/Date.hxx4
-rw-r--r--connectivity/source/inc/java/util/Property.hxx5
-rw-r--r--connectivity/source/inc/mysql/YCatalog.hxx68
-rw-r--r--connectivity/source/inc/mysql/YColumns.hxx52
-rw-r--r--connectivity/source/inc/mysql/YDriver.hxx21
-rw-r--r--connectivity/source/inc/mysql/YTable.hxx159
-rw-r--r--connectivity/source/inc/mysql/YTables.hxx59
-rw-r--r--connectivity/source/inc/mysql/YUser.hxx80
-rw-r--r--connectivity/source/inc/mysql/YUsers.hxx11
-rw-r--r--connectivity/source/inc/mysql/YViews.hxx45
-rw-r--r--connectivity/source/inc/odbc/OBoundParam.hxx146
-rw-r--r--connectivity/source/inc/odbc/OConnection.hxx173
-rw-r--r--connectivity/source/inc/odbc/ODatabaseMetaData.hxx330
-rw-r--r--connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx420
-rw-r--r--connectivity/source/inc/odbc/ODriver.hxx68
-rw-r--r--connectivity/source/inc/odbc/OFunctions.hxx993
-rw-r--r--connectivity/source/inc/odbc/OPreparedStatement.hxx231
-rw-r--r--connectivity/source/inc/odbc/OResultSet.hxx548
-rw-r--r--connectivity/source/inc/odbc/OResultSetMetaData.hxx143
-rw-r--r--connectivity/source/inc/odbc/OStatement.hxx396
-rw-r--r--connectivity/source/inc/odbc/OTools.hxx258
-rw-r--r--connectivity/source/inc/odbc/odbcbasedllapi.hxx5
-rw-r--r--connectivity/source/inc/propertyids.hxx127
-rw-r--r--connectivity/source/inc/resource/sharedresources.hxx17
-rw-r--r--connectivity/source/inc/writer/WCatalog.hxx5
-rw-r--r--connectivity/source/inc/writer/WConnection.hxx13
-rw-r--r--connectivity/source/inc/writer/WDatabaseMetaData.hxx5
-rw-r--r--connectivity/source/inc/writer/WDriver.hxx10
-rw-r--r--connectivity/source/inc/writer/WTable.hxx19
-rw-r--r--connectivity/source/inc/writer/WTables.hxx7
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx160
-rw-r--r--connectivity/source/manager/mdrivermanager.hxx5
-rw-r--r--connectivity/source/parse/PColumn.cxx8
-rw-r--r--connectivity/source/parse/internalnode.cxx11
-rw-r--r--connectivity/source/parse/sqlbison.y77
-rw-r--r--connectivity/source/parse/sqlflex.l1
-rw-r--r--connectivity/source/parse/sqliterator.cxx229
-rw-r--r--connectivity/source/parse/sqlnode.cxx617
-rw-r--r--connectivity/source/resource/sharedresources.cxx31
-rw-r--r--connectivity/source/sdbcx/VCatalog.cxx2
-rw-r--r--connectivity/source/sdbcx/VCollection.cxx61
-rw-r--r--connectivity/source/sdbcx/VColumn.cxx42
-rw-r--r--connectivity/source/sdbcx/VDescriptor.cxx34
-rw-r--r--connectivity/source/sdbcx/VGroup.cxx13
-rw-r--r--connectivity/source/sdbcx/VIndex.cxx18
-rw-r--r--connectivity/source/sdbcx/VIndexColumn.cxx6
-rw-r--r--connectivity/source/sdbcx/VKey.cxx16
-rw-r--r--connectivity/source/sdbcx/VKeyColumn.cxx11
-rw-r--r--connectivity/source/sdbcx/VTable.cxx31
-rw-r--r--connectivity/source/sdbcx/VUser.cxx26
-rw-r--r--connectivity/source/sdbcx/VView.cxx28
-rw-r--r--connectivity/workben/skeleton/SResultSet.hxx386
671 files changed, 25030 insertions, 23623 deletions
diff --git a/connectivity/CppunitTest_connectivity_ado.mk b/connectivity/CppunitTest_connectivity_ado.mk
index 3dd95356195d..612671f6f626 100644
--- a/connectivity/CppunitTest_connectivity_ado.mk
+++ b/connectivity/CppunitTest_connectivity_ado.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_sdk_api,connectivity_ado))
ifeq ($(COM),GCC)
$(eval $(call gb_CppunitTest_add_cxxflags,connectivity_ado,\
-fpermissive \
+ -DADO_SUPPRESS_MESSAGE \
))
endif
diff --git a/connectivity/CppunitTest_connectivity_sharedresources.mk b/connectivity/CppunitTest_connectivity_sharedresources.mk
index 9af3f8ca2442..f9f8172c6fce 100644
--- a/connectivity/CppunitTest_connectivity_sharedresources.mk
+++ b/connectivity/CppunitTest_connectivity_sharedresources.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,connectivity_sharedresources, \
dbtools \
sal \
test \
+ utl \
unotest \
))
diff --git a/connectivity/IwyuFilter_connectivity.yaml b/connectivity/IwyuFilter_connectivity.yaml
index 8ce2a6d004bf..79403230c41c 100644
--- a/connectivity/IwyuFilter_connectivity.yaml
+++ b/connectivity/IwyuFilter_connectivity.yaml
@@ -39,6 +39,9 @@ excludelist:
- com/sun/star/form/XDatabaseParameterListener.hpp
- com/sun/star/sdbc/XParameters.hpp
- com/sun/star/task/XInteractionHandler.hpp
+ connectivity/source/commontools/DriversConfig.cxx:
+ # Needed for ENABLE_FUZZERS
+ - o3tl/string_view.hxx
connectivity/source/cpool/ZPoolCollection.cxx:
# Actually used
- com/sun/star/beans/PropertyValue.hpp
@@ -68,8 +71,8 @@ excludelist:
connectivity/source/drivers/mysql_jdbc/YDriver.cxx:
# Actually used
- com/sun/star/uno/XComponentContext.hpp
- connectivity/source/drivers/odbc/OTools.cxx:
- # OSL_BIGENDIAN is being checked
- - osl/endian.h
+ connectivity/source/drivers/postgresql/pq_connection.cxx:
+ # Needed for using deleter_from_fn
+ - pq_tools.hxx
connectivity/source/drivers/writer/WDatabaseMetaData.cxx:
- com/sun/star/text/XTextDocument.hpp
diff --git a/connectivity/Library_ado.mk b/connectivity/Library_ado.mk
index ca9633eca0bd..7a406299083d 100644
--- a/connectivity/Library_ado.mk
+++ b/connectivity/Library_ado.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,ado))
-$(eval $(call gb_Library_set_componentfile,ado,connectivity/source/drivers/ado/ado))
+$(eval $(call gb_Library_set_componentfile,ado,connectivity/source/drivers/ado/ado,services))
$(eval $(call gb_Library_set_include,ado,\
-I$(SRCDIR)/connectivity/inc \
@@ -31,6 +31,12 @@ $(eval $(call gb_Library_add_cxxflags,ado,\
))
endif
+ifeq ($(COM),MSC)
+$(eval $(call gb_Library_add_cxxflags,ado,\
+ -DADO_SUPPRESS_MESSAGE \
+))
+endif
+
$(eval $(call gb_Library_use_system_win32_libs,ado,\
ole32 \
oleaut32 \
@@ -42,6 +48,7 @@ $(eval $(call gb_Library_use_libraries,ado,\
cppuhelper \
sal \
salhelper \
+ utl \
dbtools \
comphelper \
))
diff --git a/connectivity/Library_calc.mk b/connectivity/Library_calc.mk
index b751ce16bfe3..925b6ec8fa49 100644
--- a/connectivity/Library_calc.mk
+++ b/connectivity/Library_calc.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,calc))
-$(eval $(call gb_Library_set_componentfile,calc,connectivity/source/drivers/calc/calc))
+$(eval $(call gb_Library_set_componentfile,calc,connectivity/source/drivers/calc/calc,services))
$(eval $(call gb_Library_use_external,calc,boost_headers))
diff --git a/connectivity/Library_dbase.mk b/connectivity/Library_dbase.mk
index ff1d703e520a..b69b25cb206e 100644
--- a/connectivity/Library_dbase.mk
+++ b/connectivity/Library_dbase.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,dbase))
-$(eval $(call gb_Library_set_componentfile,dbase,connectivity/source/drivers/dbase/dbase))
+$(eval $(call gb_Library_set_componentfile,dbase,connectivity/source/drivers/dbase/dbase,services))
$(eval $(call gb_Library_use_external,dbase,boost_headers))
@@ -58,6 +58,4 @@ $(eval $(call gb_Library_add_exception_objects,dbase,\
connectivity/source/drivers/dbase/DTable \
))
-#connectivity/source/drivers/dbase/DTable disable optimization?
-
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Library_dbpool2.mk b/connectivity/Library_dbpool2.mk
index fee4d3477087..334a225c8975 100644
--- a/connectivity/Library_dbpool2.mk
+++ b/connectivity/Library_dbpool2.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,dbpool2))
-$(eval $(call gb_Library_set_componentfile,dbpool2,connectivity/source/cpool/dbpool2))
+$(eval $(call gb_Library_set_componentfile,dbpool2,connectivity/source/cpool/dbpool2,services))
$(eval $(call gb_Library_set_include,dbpool2,\
$$(INCLUDE) \
diff --git a/connectivity/Library_dbtools.mk b/connectivity/Library_dbtools.mk
index 6869cd0bbc6b..f8f457e5aa35 100644
--- a/connectivity/Library_dbtools.mk
+++ b/connectivity/Library_dbtools.mk
@@ -14,7 +14,7 @@ $(eval $(call gb_Library_add_defs,dbtools,\
-DOOO_DLLIMPLEMENTATION_DBTOOLS \
))
-$(eval $(call gb_Library_set_componentfile,dbtools,connectivity/source/dbtools/dbtools))
+$(eval $(call gb_Library_set_componentfile,dbtools,connectivity/source/dbtools/dbtools,services))
$(eval $(call gb_Library_set_include,dbtools,\
$$(INCLUDE) \
@@ -49,8 +49,6 @@ $(eval $(call gb_Library_use_libraries,dbtools,\
))
endif
-#connectivity/source/commontools/RowFunctionParser.cxx disable optimization?
-
$(eval $(call gb_Library_add_exception_objects,dbtools,\
))
diff --git a/connectivity/Library_evoab.mk b/connectivity/Library_evoab.mk
index 28327f060bcf..12f69771797b 100644
--- a/connectivity/Library_evoab.mk
+++ b/connectivity/Library_evoab.mk
@@ -22,7 +22,7 @@ $(eval $(call gb_Library_use_externals,evoab,\
gobject \
))
-$(eval $(call gb_Library_set_componentfile,evoab,connectivity/source/drivers/evoab2/evoab))
+$(eval $(call gb_Library_set_componentfile,evoab,connectivity/source/drivers/evoab2/evoab,services))
$(eval $(call gb_Library_use_sdk_api,evoab))
@@ -30,6 +30,7 @@ $(eval $(call gb_Library_use_libraries,evoab,\
comphelper \
cppu \
cppuhelper \
+ i18nlangtag \
svl \
tl \
utl \
diff --git a/connectivity/Library_firebird_sdbc.mk b/connectivity/Library_firebird_sdbc.mk
index 5fb596ef8fb4..720dfeb878f7 100644
--- a/connectivity/Library_firebird_sdbc.mk
+++ b/connectivity/Library_firebird_sdbc.mk
@@ -38,7 +38,7 @@ $(eval $(call gb_Library_use_libraries,firebird_sdbc, \
vcl \
))
-$(eval $(call gb_Library_set_componentfile,firebird_sdbc,connectivity/source/drivers/firebird/firebird_sdbc))
+$(eval $(call gb_Library_set_componentfile,firebird_sdbc,connectivity/source/drivers/firebird/firebird_sdbc,services))
$(eval $(call gb_Library_add_exception_objects,firebird_sdbc,\
connectivity/source/drivers/firebird/Blob \
@@ -61,6 +61,8 @@ $(eval $(call gb_Library_add_exception_objects,firebird_sdbc,\
connectivity/source/drivers/firebird/User \
connectivity/source/drivers/firebird/Users \
connectivity/source/drivers/firebird/Util \
+ connectivity/source/drivers/firebird/View \
+ connectivity/source/drivers/firebird/Views \
))
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Library_flat.mk b/connectivity/Library_flat.mk
index 77e2dee405e2..0fdf43276034 100644
--- a/connectivity/Library_flat.mk
+++ b/connectivity/Library_flat.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,flat))
-$(eval $(call gb_Library_set_componentfile,flat,connectivity/source/drivers/flat/flat))
+$(eval $(call gb_Library_set_componentfile,flat,connectivity/source/drivers/flat/flat,services))
$(eval $(call gb_Library_use_external,flat,boost_headers))
diff --git a/connectivity/Library_hsqldb.mk b/connectivity/Library_hsqldb.mk
index 3c85fc462240..9b950eb6e7c7 100644
--- a/connectivity/Library_hsqldb.mk
+++ b/connectivity/Library_hsqldb.mk
@@ -32,10 +32,11 @@ $(eval $(call gb_Library_use_libraries,hsqldb,\
salhelper \
tl \
utl \
+ vcl \
i18nlangtag \
))
-$(eval $(call gb_Library_set_componentfile,hsqldb,connectivity/source/drivers/hsqldb/hsqldb))
+$(eval $(call gb_Library_set_componentfile,hsqldb,connectivity/source/drivers/hsqldb/hsqldb,services))
$(eval $(call gb_Library_add_exception_objects,hsqldb,\
connectivity/source/drivers/hsqldb/HCatalog \
diff --git a/connectivity/Library_jdbc.mk b/connectivity/Library_jdbc.mk
index 396369e8fc5b..578c7013db85 100644
--- a/connectivity/Library_jdbc.mk
+++ b/connectivity/Library_jdbc.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,jdbc))
-$(eval $(call gb_Library_set_componentfile,jdbc,connectivity/source/drivers/jdbc/jdbc))
+$(eval $(call gb_Library_set_componentfile,jdbc,connectivity/source/drivers/jdbc/jdbc,services))
$(eval $(call gb_Library_use_external,jdbc,boost_headers))
diff --git a/connectivity/Library_macab1.mk b/connectivity/Library_macab1.mk
index 58eca126917a..82e3cf489b18 100644
--- a/connectivity/Library_macab1.mk
+++ b/connectivity/Library_macab1.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,macab1))
-$(eval $(call gb_Library_set_componentfile,macab1,connectivity/source/drivers/macab/macab1))
+$(eval $(call gb_Library_set_componentfile,macab1,connectivity/source/drivers/macab/macab1,services))
$(eval $(call gb_Library_use_external,macab1,boost_headers))
diff --git a/connectivity/Library_mozbootstrap.mk b/connectivity/Library_mozbootstrap.mk
new file mode 100644
index 000000000000..dfa587fa0e7a
--- /dev/null
+++ b/connectivity/Library_mozbootstrap.mk
@@ -0,0 +1,35 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,mozbootstrap))
+
+$(eval $(call gb_Library_set_componentfile,mozbootstrap,connectivity/source/drivers/mozab/bootstrap/mozbootstrap,services))
+
+$(eval $(call gb_Library_set_include,mozbootstrap,\
+ -I$(SRCDIR)/connectivity/source/drivers/mozab \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_Library_use_sdk_api,mozbootstrap))
+
+$(eval $(call gb_Library_use_libraries,mozbootstrap,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+))
+
+$(eval $(call gb_Library_add_exception_objects,mozbootstrap,\
+ connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap \
+ connectivity/source/drivers/mozab/bootstrap/MNSFolders \
+ connectivity/source/drivers/mozab/bootstrap/MNSINIParser \
+ connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Library_mysql_jdbc.mk b/connectivity/Library_mysql_jdbc.mk
index b6916ce784b1..21317ad697da 100644
--- a/connectivity/Library_mysql_jdbc.mk
+++ b/connectivity/Library_mysql_jdbc.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,mysql_jdbc))
-$(eval $(call gb_Library_set_componentfile,mysql_jdbc,connectivity/source/drivers/mysql_jdbc/mysql_jdbc))
+$(eval $(call gb_Library_set_componentfile,mysql_jdbc,connectivity/source/drivers/mysql_jdbc/mysql_jdbc,services))
$(eval $(call gb_Library_use_external,mysql_jdbc,boost_headers))
@@ -29,6 +29,7 @@ $(eval $(call gb_Library_use_libraries,mysql_jdbc,\
cppuhelper \
sal \
salhelper \
+ utl \
dbtools \
comphelper \
))
diff --git a/connectivity/Library_mysqlc.mk b/connectivity/Library_mysqlc.mk
index f765fb1e305f..99410d2c0ddb 100644
--- a/connectivity/Library_mysqlc.mk
+++ b/connectivity/Library_mysqlc.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_Library_set_include,mysqlc,\
))
$(eval $(call gb_Library_add_libs,mysqlc,\
+ $(if $(WITH_GSSAPI),$(GSSAPI_LIBS)) \
$(if $(filter-out WNT,$(OS)),$(if $(filter HAIKU MACOSX SOLARIS,$(OS)),\
-lz -lm,-rdynamic -lz -lcrypt -lm)) \
$(if $(filter LINUX,$(OS)),-ldl,) \
@@ -30,13 +31,19 @@ $(eval $(call gb_Library_add_libs,mysqlc,\
$(eval $(call gb_Library_use_sdk_api,mysqlc))
+ifeq ($(OS),WNT)
+$(eval $(call gb_Library_use_system_win32_libs,mysqlc,\
+ Secur32 \
+))
+endif
+
$(eval $(call gb_Library_use_libraries,mysqlc,\
+ comphelper \
cppu \
- dbtools \
+ cppuhelper \
+ dbtools \
sal \
salhelper \
- comphelper \
- cppuhelper \
))
$(eval $(call gb_Library_add_defs,mysqlc,\
@@ -49,19 +56,30 @@ $(eval $(call gb_Library_add_defs,mysqlc,\
))
$(eval $(call gb_Library_add_exception_objects,mysqlc,\
- connectivity/source/drivers/mysqlc/mysqlc_driver \
- connectivity/source/drivers/mysqlc/mysqlc_services \
+ connectivity/source/drivers/mysqlc/mysqlc_catalog \
+ connectivity/source/drivers/mysqlc/mysqlc_column \
+ connectivity/source/drivers/mysqlc/mysqlc_columns \
connectivity/source/drivers/mysqlc/mysqlc_connection \
- connectivity/source/drivers/mysqlc/mysqlc_resultset \
+ connectivity/source/drivers/mysqlc/mysqlc_databasemetadata \
+ connectivity/source/drivers/mysqlc/mysqlc_driver \
+ connectivity/source/drivers/mysqlc/mysqlc_general \
+ connectivity/source/drivers/mysqlc/mysqlc_indexes \
+ connectivity/source/drivers/mysqlc/mysqlc_keys \
connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset \
+ connectivity/source/drivers/mysqlc/mysqlc_preparedstatement \
+ connectivity/source/drivers/mysqlc/mysqlc_resultset \
connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata \
+ connectivity/source/drivers/mysqlc/mysqlc_services \
connectivity/source/drivers/mysqlc/mysqlc_statement \
- connectivity/source/drivers/mysqlc/mysqlc_preparedstatement \
- connectivity/source/drivers/mysqlc/mysqlc_databasemetadata \
+ connectivity/source/drivers/mysqlc/mysqlc_table \
+ connectivity/source/drivers/mysqlc/mysqlc_tables \
connectivity/source/drivers/mysqlc/mysqlc_types \
- connectivity/source/drivers/mysqlc/mysqlc_general \
+ connectivity/source/drivers/mysqlc/mysqlc_user \
+ connectivity/source/drivers/mysqlc/mysqlc_users \
+ connectivity/source/drivers/mysqlc/mysqlc_view \
+ connectivity/source/drivers/mysqlc/mysqlc_views \
))
-$(eval $(call gb_Library_set_componentfile,mysqlc,connectivity/source/drivers/mysqlc/mysqlc))
+$(eval $(call gb_Library_set_componentfile,mysqlc,connectivity/source/drivers/mysqlc/mysqlc,services))
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Library_odbc.mk b/connectivity/Library_odbc.mk
index ae2b131c3649..9bc514c9d7d5 100644
--- a/connectivity/Library_odbc.mk
+++ b/connectivity/Library_odbc.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,odbc))
-$(eval $(call gb_Library_set_componentfile,odbc,connectivity/source/drivers/odbc/odbc))
+$(eval $(call gb_Library_set_componentfile,odbc,connectivity/source/drivers/odbc/odbc,services))
$(eval $(call gb_Library_use_sdk_api,odbc))
@@ -41,11 +41,10 @@ $(eval $(call gb_Library_use_libraries,odbc,\
dbtools \
sal \
salhelper \
+ utl \
))
$(eval $(call gb_Library_add_exception_objects,odbc,\
- connectivity/source/drivers/odbc/ORealDriver \
- connectivity/source/drivers/odbc/OFunctions \
connectivity/source/drivers/odbc/OPreparedStatement \
connectivity/source/drivers/odbc/OStatement \
connectivity/source/drivers/odbc/OResultSetMetaData \
diff --git a/connectivity/Library_postgresql-sdbc-impl.mk b/connectivity/Library_postgresql-sdbc-impl.mk
index c372f3f0c6f6..19a61ff92534 100644
--- a/connectivity/Library_postgresql-sdbc-impl.mk
+++ b/connectivity/Library_postgresql-sdbc-impl.mk
@@ -45,13 +45,12 @@ endif
$(eval $(call gb_Library_use_externals,postgresql-sdbc-impl,\
boost_headers \
postgresql \
- $(if $(filter-out MSC,$(COM)), \
- openssl \
- $(if $(ENABLE_LDAP),openldap) \
- nss3 \
- plc4 \
- ssl3 \
- ) \
+ $(if $(filter-out MSC,$(COM)), \
+ $(if $(ENABLE_OPENSSL),openssl) \
+ $(if $(ENABLE_LDAP), \
+ openldap \
+ ) \
+ ) \
))
ifeq ($(SYSTEM_POSTGRESQL),)
@@ -66,7 +65,7 @@ $(eval $(call gb_Library_add_libs,postgresql-sdbc-impl,\
endif
endif
-$(eval $(call gb_Library_set_componentfile,postgresql-sdbc-impl,connectivity/source/drivers/postgresql/postgresql-sdbc-impl))
+$(eval $(call gb_Library_set_componentfile,postgresql-sdbc-impl,connectivity/source/drivers/postgresql/postgresql-sdbc-impl,postgresql-sdbc))
$(eval $(call gb_Library_add_exception_objects,postgresql-sdbc-impl,\
connectivity/source/drivers/postgresql/pq_array \
diff --git a/connectivity/Library_postgresql-sdbc.mk b/connectivity/Library_postgresql-sdbc.mk
index 48613ab91bfc..b8b39faec9ca 100644
--- a/connectivity/Library_postgresql-sdbc.mk
+++ b/connectivity/Library_postgresql-sdbc.mk
@@ -25,7 +25,7 @@ $(eval $(call gb_Library_use_libraries,postgresql-sdbc,\
salhelper \
))
-$(eval $(call gb_Library_set_componentfile,postgresql-sdbc,connectivity/source/drivers/postgresql/postgresql-sdbc))
+$(eval $(call gb_Library_set_componentfile,postgresql-sdbc,connectivity/source/drivers/postgresql/postgresql-sdbc,postgresql-sdbc))
$(eval $(call gb_Library_add_exception_objects,postgresql-sdbc,\
connectivity/source/drivers/postgresql/pq_driver \
diff --git a/connectivity/Library_sdbc2.mk b/connectivity/Library_sdbc2.mk
index 5685d1af1de1..611eba1d6fab 100644
--- a/connectivity/Library_sdbc2.mk
+++ b/connectivity/Library_sdbc2.mk
@@ -10,10 +10,14 @@
$(eval $(call gb_Library_Library,sdbc2))
-$(eval $(call gb_Library_set_componentfile,sdbc2,connectivity/source/manager/sdbc2))
+$(eval $(call gb_Library_set_componentfile,sdbc2,connectivity/source/manager/sdbc2,services))
$(eval $(call gb_Library_use_external,sdbc2,boost_headers))
+$(eval $(call gb_Library_use_custom_headers,sdbc2,\
+ officecfg/registry \
+))
+
$(eval $(call gb_Library_use_sdk_api,sdbc2))
$(eval $(call gb_Library_set_include,sdbc2,\
diff --git a/connectivity/Library_writer.mk b/connectivity/Library_writer.mk
index 242d684c9de0..a653e5502d83 100644
--- a/connectivity/Library_writer.mk
+++ b/connectivity/Library_writer.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,writer))
-$(eval $(call gb_Library_set_componentfile,writer,connectivity/source/drivers/writer/writer))
+$(eval $(call gb_Library_set_componentfile,writer,connectivity/source/drivers/writer/writer,services))
$(eval $(call gb_Library_use_external,writer,boost_headers))
diff --git a/connectivity/Module_connectivity.mk b/connectivity/Module_connectivity.mk
index faac5a8827a1..b952594b0084 100644
--- a/connectivity/Module_connectivity.mk
+++ b/connectivity/Module_connectivity.mk
@@ -49,8 +49,6 @@ $(eval $(call gb_Module_add_targets,connectivity,\
))
endif
-ifneq ($(OS),WNT)
-
ifeq ($(OS),MACOSX)
$(eval $(call gb_Module_add_targets,connectivity,\
Configuration_macab \
@@ -59,14 +57,19 @@ $(eval $(call gb_Module_add_targets,connectivity,\
))
endif
-endif
-
ifeq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,connectivity,\
Configuration_ado \
Library_ado \
))
+
+# "ADO is not available on 64bit" said the commit
+ifeq ($(CPUNAME),INTEL)
+$(eval $(call gb_Module_add_check_targets,connectivity,\
+ CppunitTest_connectivity_ado \
+))
endif
+endif # WNT
ifeq ($(ENABLE_EVOAB2),TRUE)
$(eval $(call gb_Module_add_targets,connectivity,\
@@ -99,13 +102,12 @@ $(eval $(call gb_Module_add_targets,connectivity,\
))
endif
-ifeq ($(OS),WNT)
-# "ADO is not available on 64bit" said the commit
-ifneq ($(CPUNAME),X86_64)
-$(eval $(call gb_Module_add_check_targets,connectivity,\
- CppunitTest_connectivity_ado \
+ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
+
+$(eval $(call gb_Module_add_targets,connectivity,\
+ Library_mozbootstrap \
))
-endif
+
endif
ifneq ($(filter QADEVOOO,$(BUILD_TYPE)),)
@@ -129,6 +131,6 @@ $(eval $(call gb_Module_add_check_targets,connectivity,\
CppunitTest_connectivity_sharedresources \
))
-endif
+endif # DBCONNECTIVITY
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/README b/connectivity/README
deleted file mode 100644
index 40525a522227..000000000000
--- a/connectivity/README
+++ /dev/null
@@ -1,44 +0,0 @@
-Contains database pieces, drivers, etc.
-
-[[dbaccess]] builds UI on top of this.
-
-=== PostgreSQL ===
-
-For testing, use:
-
-podman pull postgres:latest
-podman run --name=postgres -e POSTGRES_PASSWORD=foobarbaz -p 127.0.0.1:5432:5432 postgres:latest
-
-In Base, Connect to an existing database, select PostgreSQL:
-
-URL: host=127.0.0.1 port=5432 dbname=postgres
-User: postgres
-Password: foobarbaz
-
-podman stop postgres
-podman rm postgres
-
-In order to test SCRAM authentication, create the container like this:
-
-podman run --name=postgres -e POSTGRES_PASSWORD=foobarbaz -e POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 -e POSTGRES_HOST_AUTH_METHOD=scram-sha-256 -p 127.0.0.1:5432:5432 postgres:latest
-
-=== mysql_test ===
-
-- The CppunitTest_mysql_test unit test can be used to test the mysqlc
- library with any versions of mysql or mariadb server of your choice.
-
-- This test does not run automatically. It can be triggered with setting
- the environment variable "CONNECTIVITY_TEST_MYSQL_DRIVER".
-
-- The environment variable should contain a URL of the following format:
- [user]/[passwd]@sdbc:mysql:mysqlc:[host]:[port]/db_name
-
-- tl;dr:
-
- podman pull mariadb/server
- podman run --name=mariadb -e MYSQL_ROOT_PASSWORD=foobarbaz -p 127.0.0.1:3306:3306 mariadb/server
- podman exec -it mariadb /bin/bash -c "echo -e CREATE DATABASE test | /usr/bin/mysql -u root"
- (cd connectivity && make -srj8 CppunitTest_connectivity_mysql_test CONNECTIVITY_TEST_MYSQL_DRIVER="root/foobarbaz@sdbc:mysql:mysqlc:127.0.0.1:3306/test")
- podman stop mariadb
- podman rm mariadb
-
diff --git a/connectivity/README.md b/connectivity/README.md
new file mode 100644
index 000000000000..a2c27677c3a4
--- /dev/null
+++ b/connectivity/README.md
@@ -0,0 +1,66 @@
+# Database Connectivity
+
+Contains database pieces, drivers, etc.
+
+`dbaccess` builds UI on top of this.
+
+## Testing
+### PostgreSQL
+
+For testing, use:
+
+ podman pull postgres:latest
+ podman run --name=postgres -e POSTGRES_PASSWORD=foobarbaz -p 127.0.0.1:5432:5432 postgres:latest
+
+In Base, Connect to an existing database, select PostgreSQL:
+
+ URL: host=127.0.0.1 port=5432 dbname=postgres
+ User: postgres
+ Password: foobarbaz
+
+ podman stop postgres
+ podman rm postgres
+
+In order to test SCRAM authentication, create the container like this:
+
+ podman run --name=postgres -e POSTGRES_PASSWORD=foobarbaz -e POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 -e POSTGRES_HOST_AUTH_METHOD=scram-sha-256 -p 127.0.0.1:5432:5432 postgres:latest
+
+### MySQL
+
+For mysql_test:
+
+- The CppunitTest_mysql_test unit test can be used to test the mysqlc
+library with any versions of mysql or mariadb server of your choice.
+
+- This test does not run automatically. It can be triggered with setting
+the environment variable "CONNECTIVITY_TEST_MYSQL_DRIVER".
+
+- The environment variable should contain a URL of the following format:
+`[user]/[passwd]@sdbc:mysql:mysqlc:[host]:[port]/db_name`
+
+- tl;dr:
+
+```
+ podman pull mariadb/server
+ podman run --name=mariadb -e MYSQL_ROOT_PASSWORD=foobarbaz -p 127.0.0.1:3306:3306 mariadb/server
+ podman exec -it mariadb /bin/bash -c "echo -e CREATE DATABASE test | /usr/bin/mysql -u root"
+ (cd connectivity && make -srj8 CppunitTest_connectivity_mysql_test CONNECTIVITY_TEST_MYSQL_DRIVER="root/foobarbaz@sdbc:mysql:mysqlc:127.0.0.1:3306/test")
+ podman stop mariadb
+ podman rm mariadb
+```
+
+### Firebird
+
+Firebird has two primary file types:
+
+- Databases - FDB files. These are version-specific, platform-specific, optimized for performance, and thus incompatible between versions. These are what those comments are about. Initially, when FB integration was considered, these files were evaluated for ODBs, but were rejected because of the said incompatibility - even when the version is the same, it will differ on big endian architecture and little endian one. The problem discussed in those comments is when people open stand-alone FDBs that are shipped e.g. with FB installation itself, not when people open ODBs.
+
+- Database backups - FBKs. These are what we use inside ODBs. These are designed to be compatible, independent of architecture; and later versions of FB are always able to open FBKs created in older FB versions.
+
+Our embedded FB is used like this:
+- FBK is extracted from ODB;
+- Embedded FB extracts the compatible FBK into an incompatible FDB (specific to this version of embedded FB DLL);
+- FB works with this temporary FDB;
+- When saving ODB, embedded FB backups the FDB into FBK again, and that is stored inside the ODB.
+
+It, indeed, creates additional performance penalty, but makes the ODB readable by all the future LO versions, no matter what future FB version they embed.
diff --git a/connectivity/Rdb_postgresql-sdbc.mk b/connectivity/Rdb_postgresql-sdbc.mk
index 6162b309d6ba..e6c3b06e0695 100644
--- a/connectivity/Rdb_postgresql-sdbc.mk
+++ b/connectivity/Rdb_postgresql-sdbc.mk
@@ -9,9 +9,4 @@
$(eval $(call gb_Rdb_Rdb_install,postgresql-sdbc))
-$(eval $(call gb_Rdb_add_components,postgresql-sdbc,\
- connectivity/source/drivers/postgresql/postgresql-sdbc \
- connectivity/source/drivers/postgresql/postgresql-sdbc-impl \
-))
-
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/inc/TIndexColumns.hxx b/connectivity/inc/TIndexColumns.hxx
index 6d02c445eda2..216a31c7909b 100644
--- a/connectivity/inc/TIndexColumns.hxx
+++ b/connectivity/inc/TIndexColumns.hxx
@@ -27,7 +27,7 @@ namespace connectivity
class OIndexColumns final : public sdbcx::OCollection
{
OIndexHelper* m_pIndex;
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ 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;
public:
diff --git a/connectivity/inc/TKeyColumns.hxx b/connectivity/inc/TKeyColumns.hxx
index 19510e4965e9..1a45fd244a0a 100644
--- a/connectivity/inc/TKeyColumns.hxx
+++ b/connectivity/inc/TKeyColumns.hxx
@@ -27,7 +27,7 @@ namespace connectivity
class OKeyColumnsHelper final : public connectivity::sdbcx::OCollection
{
OTableKeyHelper* m_pKey;
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ 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;
public:
diff --git a/connectivity/inc/bitmaps.hlst b/connectivity/inc/bitmaps.hlst
index d51533745e2e..e2bf53892d3e 100644
--- a/connectivity/inc/bitmaps.hlst
+++ b/connectivity/inc/bitmaps.hlst
@@ -7,11 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_INC_BITMAPS_HRC
-#define INCLUDED_CONNECTIVITY_INC_BITMAPS_HRC
+#pragma once
#define LINKED_TEXT_TABLE_IMAGE_RESOURCE "dbaccess/res/linked_text_table.png"
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/inc/pch/precompiled_ado.hxx b/connectivity/inc/pch/precompiled_ado.hxx
index 06911c5f2caf..90be947c2e8b 100644
--- a/connectivity/inc/pch/precompiled_ado.hxx
+++ b/connectivity/inc/pch/precompiled_ado.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-12-15 11:15:25 using:
+ Generated on 2021-04-11 19:47:44 using:
./bin/update_pch connectivity ado --cutoff=2 --exclude:system --exclude:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_ado.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <algorithm>
#include <cassert>
@@ -27,7 +28,6 @@
#include <cstdlib>
#include <limits>
#include <map>
-#include <memory>
#include <oledb.h>
#include <sstream>
#include <string>
@@ -41,9 +41,9 @@
#include <osl/thread.h>
#include <osl/time.h>
#include <rtl/alloc.h>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
-#include <sal/config.h>
#include <sal/detail/log.h>
#include <sal/log.hxx>
#include <sal/macros.h>
diff --git a/connectivity/inc/pch/precompiled_calc.hxx b/connectivity/inc/pch/precompiled_calc.hxx
index 4ca7fa2ec671..ff6ff7ed81f4 100644
--- a/connectivity/inc/pch/precompiled_calc.hxx
+++ b/connectivity/inc/pch/precompiled_calc.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-08-12 11:04:25 using:
+ Generated on 2021-03-08 13:12:43 using:
./bin/update_pch connectivity calc --cutoff=2 --exclude:system --exclude:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_calc.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <cassert>
#include <cstddef>
@@ -39,7 +40,6 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
#include <rtl/uuid.h>
-#include <sal/config.h>
#include <sal/log.hxx>
#include <sal/types.h>
#endif // PCH_LEVEL >= 2
diff --git a/connectivity/inc/pch/precompiled_dbase.hxx b/connectivity/inc/pch/precompiled_dbase.hxx
index 29b4a48bde6a..bef5dafcd982 100644
--- a/connectivity/inc/pch/precompiled_dbase.hxx
+++ b/connectivity/inc/pch/precompiled_dbase.hxx
@@ -13,16 +13,18 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-12-04 09:59:07 using:
+ Generated on 2021-04-08 13:55:37 using:
./bin/update_pch connectivity dbase --cutoff=2 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_dbase.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <algorithm>
#include <cassert>
+#include <chrono>
#include <cstddef>
#include <cstdlib>
#include <cstring>
@@ -73,7 +75,6 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
-#include <sal/config.h>
#include <sal/detail/log.h>
#include <sal/log.hxx>
#include <sal/macros.h>
@@ -82,7 +83,7 @@
#include <sal/types.h>
#include <sal/typesizes.h>
#include <vcl/dllapi.h>
-#include <vcl/errcode.hxx>
+#include <comphelper/errcode.hxx>
#endif // PCH_LEVEL >= 2
#if PCH_LEVEL >= 3
#include <com/sun/star/beans/Property.hpp>
diff --git a/connectivity/inc/pch/precompiled_dbpool2.hxx b/connectivity/inc/pch/precompiled_dbpool2.hxx
index cc57d0e60782..39808df459be 100644
--- a/connectivity/inc/pch/precompiled_dbpool2.hxx
+++ b/connectivity/inc/pch/precompiled_dbpool2.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-12-04 09:59:07 using:
+ Generated on 2021-03-08 13:12:45 using:
./bin/update_pch connectivity dbpool2 --cutoff=5 --exclude:system --include:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_dbpool2.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <algorithm>
#include <cassert>
@@ -55,7 +56,6 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
-#include <sal/config.h>
#include <sal/log.hxx>
#include <sal/macros.h>
#include <sal/saldllapi.h>
diff --git a/connectivity/inc/pch/precompiled_dbtools.hxx b/connectivity/inc/pch/precompiled_dbtools.hxx
index 1f649afaca54..f848fe094a64 100644
--- a/connectivity/inc/pch/precompiled_dbtools.hxx
+++ b/connectivity/inc/pch/precompiled_dbtools.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-12-04 09:59:07 using:
+ Generated on 2021-04-11 19:47:45 using:
./bin/update_pch connectivity dbtools --cutoff=2 --exclude:system --exclude:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_dbtools.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <algorithm>
#include <cassert>
@@ -58,7 +59,6 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
-#include <sal/config.h>
#include <sal/log.hxx>
#include <sal/macros.h>
#include <sal/saldllapi.h>
@@ -167,7 +167,7 @@
#include <sdbcx/VIndexColumn.hxx>
#include <sdbcx/VKey.hxx>
#include <sdbcx/VKeyColumn.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/toolsdllapi.h>
#include <unotools/resmgr.hxx>
#include <unotools/sharedunocomponent.hxx>
diff --git a/connectivity/inc/pch/precompiled_file.hxx b/connectivity/inc/pch/precompiled_file.hxx
index 42b99e7ff1ae..7d8dee504853 100644
--- a/connectivity/inc/pch/precompiled_file.hxx
+++ b/connectivity/inc/pch/precompiled_file.hxx
@@ -13,16 +13,18 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-12-04 09:59:08 using:
+ Generated on 2021-04-08 13:55:38 using:
./bin/update_pch connectivity file --cutoff=2 --exclude:system --include:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_file.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <algorithm>
#include <cassert>
+#include <chrono>
#include <cstddef>
#include <cstdlib>
#include <cstring>
@@ -72,7 +74,6 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
-#include <sal/config.h>
#include <sal/log.hxx>
#include <sal/macros.h>
#include <sal/mathconf.h>
@@ -80,7 +81,7 @@
#include <sal/types.h>
#include <sal/typesizes.h>
#include <vcl/dllapi.h>
-#include <vcl/errcode.hxx>
+#include <comphelper/errcode.hxx>
#endif // PCH_LEVEL >= 2
#if PCH_LEVEL >= 3
#include <com/sun/star/beans/Property.hpp>
@@ -189,7 +190,7 @@
#include <salhelper/simplereferenceobject.hxx>
#include <tools/date.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/lineend.hxx>
#include <tools/long.hxx>
#include <tools/ref.hxx>
diff --git a/connectivity/inc/pch/precompiled_firebird_sdbc.hxx b/connectivity/inc/pch/precompiled_firebird_sdbc.hxx
index d856c573467e..bd628cf76a9a 100644
--- a/connectivity/inc/pch/precompiled_firebird_sdbc.hxx
+++ b/connectivity/inc/pch/precompiled_firebird_sdbc.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-08-12 11:04:28 using:
+ Generated on 2021-03-08 13:12:28 using:
./bin/update_pch connectivity firebird_sdbc --cutoff=2 --exclude:system --exclude:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_firebird_sdbc.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <cassert>
#include <cstddef>
@@ -40,7 +41,6 @@
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
-#include <sal/config.h>
#include <sal/log.hxx>
#include <sal/types.h>
#endif // PCH_LEVEL >= 2
diff --git a/connectivity/inc/pch/precompiled_flat.hxx b/connectivity/inc/pch/precompiled_flat.hxx
index f0f7d485064d..73a8ee883b62 100644
--- a/connectivity/inc/pch/precompiled_flat.hxx
+++ b/connectivity/inc/pch/precompiled_flat.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-12-04 09:59:08 using:
+ Generated on 2021-04-08 13:43:09 using:
./bin/update_pch connectivity flat --cutoff=2 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_flat.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <algorithm>
#include <cassert>
@@ -70,7 +71,6 @@
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
#include <rtl/uuid.h>
-#include <sal/config.h>
#include <sal/detail/log.h>
#include <sal/log.hxx>
#include <sal/macros.h>
diff --git a/connectivity/inc/pch/precompiled_mysql_jdbc.hxx b/connectivity/inc/pch/precompiled_mysql_jdbc.hxx
index 436c66338622..4bb225104c93 100644
--- a/connectivity/inc/pch/precompiled_mysql_jdbc.hxx
+++ b/connectivity/inc/pch/precompiled_mysql_jdbc.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-08-12 11:04:29 using:
+ Generated on 2021-03-08 13:12:51 using:
./bin/update_pch connectivity mysql_jdbc --cutoff=1 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_mysql_jdbc.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#endif // PCH_LEVEL >= 1
#if PCH_LEVEL >= 2
diff --git a/connectivity/inc/pch/precompiled_odbc.hxx b/connectivity/inc/pch/precompiled_odbc.hxx
index b74b069a12f3..719180c13a9b 100644
--- a/connectivity/inc/pch/precompiled_odbc.hxx
+++ b/connectivity/inc/pch/precompiled_odbc.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-08-12 11:04:29 using:
+ Generated on 2021-03-08 13:12:40 using:
./bin/update_pch connectivity odbc --cutoff=2 --exclude:system --exclude:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_odbc.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <string.h>
#include <vector>
@@ -33,7 +34,6 @@
#include <rtl/textenc.h>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
-#include <sal/config.h>
#include <sal/log.hxx>
#include <sal/types.h>
#endif // PCH_LEVEL >= 2
diff --git a/connectivity/inc/pch/precompiled_postgresql-sdbc-impl.hxx b/connectivity/inc/pch/precompiled_postgresql-sdbc-impl.hxx
index 9111d7f1d3d3..d94cdcde3158 100644
--- a/connectivity/inc/pch/precompiled_postgresql-sdbc-impl.hxx
+++ b/connectivity/inc/pch/precompiled_postgresql-sdbc-impl.hxx
@@ -13,13 +13,14 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-12-04 09:59:09 using:
+ Generated on 2021-03-08 13:12:50 using:
./bin/update_pch connectivity postgresql-sdbc-impl --cutoff=3 --exclude:system --exclude:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
./bin/update_pch_bisect ./connectivity/inc/pch/precompiled_postgresql-sdbc-impl.hxx "make connectivity.build" --find-conflicts
*/
+#include <sal/config.h>
#if PCH_LEVEL >= 1
#include <string.h>
#include <string_view>
@@ -27,11 +28,11 @@
#if PCH_LEVEL >= 2
#include <osl/time.h>
#include <rtl/instance.hxx>
+#include <rtl/ref.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
#include <rtl/uuid.h>
-#include <sal/config.h>
#include <sal/log.hxx>
#include <sal/macros.h>
#include <sal/types.h>
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 6ab971680f34..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() throw() override;
- virtual void SAL_CALL release() throw() 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 9b486d85d04d..2591ef6efdbd 100644
--- a/connectivity/inc/sdbcx/VIndex.hxx
+++ b/connectivity/inc/sdbcx/VIndex.hxx
@@ -19,6 +19,7 @@
#pragma once
+#include <config_options.h>
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <comphelper/IdPropArrayHelper.hxx>
#include <cppuhelper/basemutex.hxx>
@@ -30,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 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,
- const 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() throw() override;
- virtual void SAL_CALL release() throw() 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 056b8239411b..d4b6c00e21d3 100644
--- a/connectivity/inc/sdbcx/VIndexColumn.hxx
+++ b/connectivity/inc/sdbcx/VIndexColumn.hxx
@@ -19,39 +19,40 @@
#pragma once
+#include <config_options.h>
#include <connectivity/dbtoolsdllapi.hxx>
#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 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 8594923bad24..7ee7dc563b04 100644
--- a/connectivity/inc/sdbcx/VKey.hxx
+++ b/connectivity/inc/sdbcx/VKey.hxx
@@ -30,78 +30,79 @@
#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <memory>
+#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(const OUString& ReferencedTable,
- sal_Int32 Type,
- sal_Int32 UpdateRule,
- sal_Int32 DeleteRule)
- :m_ReferencedTable(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,const std::shared_ptr<KeyProperties>& _rProps,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() throw() override;
- virtual void SAL_CALL release() throw() 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 5adf3e0aab9d..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( const 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 31a4be400657..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() throw() override;
- virtual void SAL_CALL release() throw() 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/inc/strings.hrc b/connectivity/inc/strings.hrc
index ce4177493bd9..873623bba05d 100644
--- a/connectivity/inc/strings.hrc
+++ b/connectivity/inc/strings.hrc
@@ -19,34 +19,33 @@
#pragma once
-#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String)
+#define NC_(Context, String) TranslateId(Context, u8##String)
// = common strings
#define STR_NO_CONNECTION_GIVEN NC_("STR_NO_CONNECTION_GIVEN", "No connection to the database exists.")
-#define STR_WRONG_PARAM_INDEX NC_("STR_WRONG_PARAM_INDEX", "You tried to set a parameter at position '$pos$' but there is/are only '$count$' parameter(s) allowed. One reason may be that the property \"ParameterNameSubstitution\" is not set to TRUE in the data source.")
+#define STR_WRONG_PARAM_INDEX NC_("STR_WRONG_PARAM_INDEX", "You tried to set a parameter at position “$pos$” but there is/are only “$count$” parameter(s) allowed. One reason may be that the property “ParameterNameSubstitution” is not set to TRUE in the data source.")
#define STR_NO_INPUTSTREAM NC_("STR_NO_INPUTSTREAM", "The input stream was not set.")
-#define STR_NO_ELEMENT_NAME NC_("STR_NO_ELEMENT_NAME", "There is no element named '$name$'.")
+#define STR_NO_ELEMENT_NAME NC_("STR_NO_ELEMENT_NAME", "There is no element named “$name$”.")
#define STR_INVALID_BOOKMARK NC_("STR_INVALID_BOOKMARK", "Invalid bookmark value")
#define STR_PRIVILEGE_NOT_GRANTED NC_("STR_PRIVILEGE_NOT_GRANTED", "Privilege not granted: Only table privileges can be granted.")
#define STR_PRIVILEGE_NOT_REVOKED NC_("STR_PRIVILEGE_NOT_REVOKED", "Privilege not revoked: Only table privileges can be revoked.")
#define STR_ERRORMSG_SEQUENCE NC_("STR_ERRORMSG_SEQUENCE", "Function sequence error.")
#define STR_INVALID_INDEX NC_("STR_INVALID_INDEX", "Invalid descriptor index.")
-#define STR_UNSUPPORTED_FUNCTION NC_("STR_UNSUPPORTED_FUNCTION", "The driver does not support the function '$functionname$'.")
-#define STR_UNSUPPORTED_FEATURE NC_("STR_UNSUPPORTED_FEATURE", "The driver does not support the functionality for '$featurename$'. It is not implemented.")
+#define STR_UNSUPPORTED_FUNCTION NC_("STR_UNSUPPORTED_FUNCTION", "The driver does not support the function “$functionname$”.")
+#define STR_UNSUPPORTED_FEATURE NC_("STR_UNSUPPORTED_FEATURE", "The driver does not support the functionality for “$featurename$”. It is not implemented.")
#define STR_FORMULA_WRONG NC_("STR_FORMULA_WRONG", "The formula for TypeInfoSettings is wrong!")
-#define STR_STRING_LENGTH_EXCEEDED NC_("STR_STRING_LENGTH_EXCEEDED", "The string '$string$' exceeds the maximum length of $maxlen$ characters when converted to the target character set '$charset$'.")
-#define STR_CANNOT_CONVERT_STRING NC_("STR_CANNOT_CONVERT_STRING", "The string '$string$' cannot be converted using the encoding '$charset$'.")
+#define STR_STRING_LENGTH_EXCEEDED NC_("STR_STRING_LENGTH_EXCEEDED", "The string “$string$” exceeds the maximum length of $maxlen$ characters when converted to the target character set “$charset$”.")
+#define STR_CANNOT_CONVERT_STRING NC_("STR_CANNOT_CONVERT_STRING", "The string “$string$” cannot be converted using the encoding “$charset$”.")
#define STR_URI_SYNTAX_ERROR NC_("STR_URI_SYNTAX_ERROR", "The connection URL is invalid.")
-#define STR_QUERY_TOO_COMPLEX NC_("STR_QUERY_TOO_COMPLEX", "The query can not be executed. It is too complex.")
-#define STR_OPERATOR_TOO_COMPLEX NC_("STR_OPERATOR_TOO_COMPLEX", "The query can not be executed. The operator is too complex.")
-#define STR_QUERY_INVALID_LIKE_COLUMN NC_("STR_QUERY_INVALID_LIKE_COLUMN", "The query can not be executed. You cannot use 'LIKE' with columns of this type.")
-#define STR_QUERY_INVALID_LIKE_STRING NC_("STR_QUERY_INVALID_LIKE_STRING", "The query can not be executed. 'LIKE' can be used with a string argument only.")
-#define STR_QUERY_NOT_LIKE_TOO_COMPLEX NC_("STR_QUERY_NOT_LIKE_TOO_COMPLEX", "The query can not be executed. The 'NOT LIKE' condition is too complex.")
-#define STR_QUERY_LIKE_WILDCARD NC_("STR_QUERY_LIKE_WILDCARD", "The query can not be executed. The 'LIKE' condition contains wildcard in the middle.")
-#define STR_QUERY_LIKE_WILDCARD_MANY NC_("STR_QUERY_LIKE_WILDCARD_MANY", "The query can not be executed. The 'LIKE' condition contains too many wildcards.")
-#define STR_INVALID_COLUMNNAME NC_("STR_INVALID_COLUMNNAME", "The column name '$columnname$' is not valid.")
+#define STR_QUERY_TOO_COMPLEX NC_("STR_QUERY_TOO_COMPLEX", "The query cannot be executed. It is too complex.")
+#define STR_OPERATOR_TOO_COMPLEX NC_("STR_OPERATOR_TOO_COMPLEX", "The query cannot be executed. The operator is too complex.")
+#define STR_QUERY_INVALID_LIKE_COLUMN NC_("STR_QUERY_INVALID_LIKE_COLUMN", "The query cannot be executed. You cannot use “LIKE” with columns of this type.")
+#define STR_QUERY_INVALID_LIKE_STRING NC_("STR_QUERY_INVALID_LIKE_STRING", "The query cannot be executed. “LIKE” can be used with a string argument only.")
+#define STR_QUERY_NOT_LIKE_TOO_COMPLEX NC_("STR_QUERY_NOT_LIKE_TOO_COMPLEX", "The query cannot be executed. The “NOT LIKE” condition is too complex.")
+#define STR_QUERY_LIKE_WILDCARD NC_("STR_QUERY_LIKE_WILDCARD", "The query cannot be executed. The “LIKE” condition contains wildcard in the middle.")
+#define STR_QUERY_LIKE_WILDCARD_MANY NC_("STR_QUERY_LIKE_WILDCARD_MANY", "The query cannot be executed. The “LIKE” condition contains too many wildcards.")
+#define STR_INVALID_COLUMNNAME NC_("STR_INVALID_COLUMNNAME", "The column name “$columnname$” is not valid.")
#define STR_INVALID_COLUMN_SELECTION NC_("STR_INVALID_COLUMN_SELECTION", "The statement contains an invalid selection of columns.")
-#define STR_COLUMN_NOT_UPDATEABLE NC_("STR_COLUMN_NOT_UPDATEABLE", "The column at position '$position$' could not be updated.")
#define STR_COULD_NOT_LOAD_FILE NC_("STR_COULD_NOT_LOAD_FILE", "The file $filename$ could not be loaded.")
#define STR_LOAD_FILE_ERROR_MESSAGE NC_("STR_LOAD_FILE_ERROR_MESSAGE", "The attempt to load the file resulted in the following error message ($exception_type$):\n\n$error_message$")
// = the ado driver's resource strings
@@ -59,70 +58,70 @@
#define STR_INVALID_USER_DESCRIPTOR_ERROR NC_("STR_INVALID_USER_DESCRIPTOR_ERROR", "Could not create user: invalid object descriptor.")
#define STR_INVALID_VIEW_DESCRIPTOR_ERROR NC_("STR_INVALID_VIEW_DESCRIPTOR_ERROR", "Could not create view: invalid object descriptor.")
#define STR_VIEW_NO_COMMAND_ERROR NC_("STR_VIEW_NO_COMMAND_ERROR", "Could not create view: no command object.")
-#define STR_NO_CONNECTION NC_("STR_NO_CONNECTION", "The connection could not be created. May be the necessary data provider is not installed.")
+#define STR_NO_CONNECTION NC_("STR_NO_CONNECTION", "The connection could not be created. Maybe the necessary data provider is not installed.")
// dbase
#define STR_COULD_NOT_DELETE_INDEX NC_("STR_COULD_NOT_DELETE_INDEX", "The index could not be deleted. An unknown error while accessing the file system occurred.")
#define STR_ONL_ONE_COLUMN_PER_INDEX NC_("STR_ONL_ONE_COLUMN_PER_INDEX", "The index could not be created. Only one column per index is allowed.")
#define STR_COULD_NOT_CREATE_INDEX_NOT_UNIQUE NC_("STR_COULD_NOT_CREATE_INDEX_NOT_UNIQUE", "The index could not be created. The values are not unique.")
#define STR_COULD_NOT_CREATE_INDEX NC_("STR_COULD_NOT_CREATE_INDEX", "The index could not be created. An unknown error appeared.")
-#define STR_COULD_NOT_CREATE_INDEX_NAME NC_("STR_COULD_NOT_CREATE_INDEX_NAME", "The index could not be created. The file '$filename$' is used by another index.")
+#define STR_COULD_NOT_CREATE_INDEX_NAME NC_("STR_COULD_NOT_CREATE_INDEX_NAME", "The index could not be created. The file “$filename$” is used by another index.")
#define STR_COULD_NOT_CREATE_INDEX_KEYSIZE NC_("STR_COULD_NOT_CREATE_INDEX_KEYSIZE", "The index could not be created. The size of the chosen column is too big.")
-#define STR_SQL_NAME_ERROR NC_("STR_SQL_NAME_ERROR", "The name '$name$' doesn't match SQL naming constraints.")
+#define STR_SQL_NAME_ERROR NC_("STR_SQL_NAME_ERROR", "The name “$name$” does not match SQL naming constraints.")
#define STR_COULD_NOT_DELETE_FILE NC_("STR_COULD_NOT_DELETE_FILE", "The file $filename$ could not be deleted.")
-#define STR_INVALID_COLUMN_TYPE NC_("STR_INVALID_COLUMN_TYPE", "Invalid column type for column '$columnname$'.")
-#define STR_INVALID_COLUMN_PRECISION NC_("STR_INVALID_COLUMN_PRECISION", "Invalid precision for column '$columnname$'.")
-#define STR_INVALID_PRECISION_SCALE NC_("STR_INVALID_PRECISION_SCALE", "Precision is less than scale for column '$columnname$'.")
-#define STR_INVALID_COLUMN_NAME_LENGTH NC_("STR_INVALID_COLUMN_NAME_LENGTH", "Invalid column name length for column '$columnname$'.")
-#define STR_DUPLICATE_VALUE_IN_COLUMN NC_("STR_DUPLICATE_VALUE_IN_COLUMN", "Duplicate value found in column '$columnname$'.")
-#define STR_INVALID_COLUMN_DECIMAL_VALUE NC_("STR_INVALID_COLUMN_DECIMAL_VALUE", "The '$columnname$' column has been defined as a \"Decimal\" type, the max. length is $precision$ characters (with $scale$ decimal places).\n\nThe specified value \"$value$ is longer than the number of digits allowed.")
-#define STR_COLUMN_NOT_ALTERABLE NC_("STR_COLUMN_NOT_ALTERABLE", "The column '$columnname$' could not be altered. May be the file system is write protected.")
-#define STR_INVALID_COLUMN_VALUE NC_("STR_INVALID_COLUMN_VALUE", "The column '$columnname$' could not be updated. The value is invalid for that column.")
-#define STR_COLUMN_NOT_ADDABLE NC_("STR_COLUMN_NOT_ADDABLE", "The column '$columnname$' could not be added. May be the file system is write protected.")
-#define STR_COLUMN_NOT_DROP NC_("STR_COLUMN_NOT_DROP", "The column at position '$position$' could not be dropped. May be the file system is write protected.")
-#define STR_TABLE_NOT_DROP NC_("STR_TABLE_NOT_DROP", "The table '$tablename$' could not be dropped. May be the file system is write protected.")
+#define STR_INVALID_COLUMN_TYPE NC_("STR_INVALID_COLUMN_TYPE", "Invalid column type for column “$columnname$”.")
+#define STR_INVALID_COLUMN_PRECISION NC_("STR_INVALID_COLUMN_PRECISION", "Invalid precision for column “$columnname$”.")
+#define STR_INVALID_PRECISION_SCALE NC_("STR_INVALID_PRECISION_SCALE", "Precision is less than scale for column “$columnname$”.")
+#define STR_INVALID_COLUMN_NAME_LENGTH NC_("STR_INVALID_COLUMN_NAME_LENGTH", "Invalid column name length for column “$columnname$”.")
+#define STR_DUPLICATE_VALUE_IN_COLUMN NC_("STR_DUPLICATE_VALUE_IN_COLUMN", "Duplicate value found in column “$columnname$”.")
+#define STR_INVALID_COLUMN_DECIMAL_VALUE NC_("STR_INVALID_COLUMN_DECIMAL_VALUE", "The “$columnname$” column has been defined as a “Decimal” type, the maximum length is $precision$ characters (with $scale$ decimal places).\n\nThe specified value “$value$” is longer than the number of digits allowed.")
+#define STR_COLUMN_NOT_ALTERABLE NC_("STR_COLUMN_NOT_ALTERABLE", "The column “$columnname$” could not be altered. Maybe the file system is write-protected.")
+#define STR_INVALID_COLUMN_VALUE NC_("STR_INVALID_COLUMN_VALUE", "The column “$columnname$” could not be updated. The value is invalid for that column.")
+#define STR_COLUMN_NOT_ADDABLE NC_("STR_COLUMN_NOT_ADDABLE", "The column “$columnname$” could not be added. Maybe the file system is write-protected.")
+#define STR_COLUMN_NOT_DROP NC_("STR_COLUMN_NOT_DROP", "The column at position “$position$” could not be dropped. Maybe the file system is write-protected.")
+#define STR_TABLE_NOT_DROP NC_("STR_TABLE_NOT_DROP", "The table “$tablename$” could not be dropped. Maybe the file system is write-protected.")
#define STR_COULD_NOT_ALTER_TABLE NC_("STR_COULD_NOT_ALTER_TABLE", "The table could not be altered.")
-#define STR_INVALID_DBASE_FILE NC_("STR_INVALID_DBASE_FILE", "The file '$filename$' is an invalid (or unrecognized) dBase file.")
+#define STR_INVALID_DBASE_FILE NC_("STR_INVALID_DBASE_FILE", "The file “$filename$” is an invalid (or unrecognized) dBASE file.")
// Evoab2
#define STR_CANNOT_OPEN_BOOK NC_("STR_CANNOT_OPEN_BOOK", "Cannot open Evolution address book.")
#define STR_SORT_BY_COL_ONLY NC_("STR_SORT_BY_COL_ONLY", "Can only sort by table columns.")
// File
-#define STR_QUERY_COMPLEX_COUNT NC_("STR_QUERY_COMPLEX_COUNT", "The query can not be executed. It is too complex. Only \"COUNT(*)\" is supported.")
-#define STR_QUERY_INVALID_BETWEEN NC_("STR_QUERY_INVALID_BETWEEN", "The query can not be executed. The 'BETWEEN' arguments are not correct.")
-#define STR_QUERY_FUNCTION_NOT_SUPPORTED NC_("STR_QUERY_FUNCTION_NOT_SUPPORTED", "The query can not be executed. The function is not supported.")
-#define STR_TABLE_READONLY NC_("STR_TABLE_READONLY", "The table can not be changed. It is read only.")
-#define STR_DELETE_ROW NC_("STR_DELETE_ROW", "The row could not be deleted. The option \"Display inactive records\" is set.")
+#define STR_QUERY_COMPLEX_COUNT NC_("STR_QUERY_COMPLEX_COUNT", "The query cannot be executed. It is too complex. Only “COUNT(*)” is supported.")
+#define STR_QUERY_INVALID_BETWEEN NC_("STR_QUERY_INVALID_BETWEEN", "The query cannot be executed. The “BETWEEN” arguments are not correct.")
+#define STR_QUERY_FUNCTION_NOT_SUPPORTED NC_("STR_QUERY_FUNCTION_NOT_SUPPORTED", "The query cannot be executed. The function is not supported.")
+#define STR_TABLE_READONLY NC_("STR_TABLE_READONLY", "The table cannot be changed. It is read only.")
+#define STR_DELETE_ROW NC_("STR_DELETE_ROW", "The row could not be deleted. The option “Display inactive records” is set.")
#define STR_ROW_ALREADY_DELETED NC_("STR_ROW_ALREADY_DELETED", "The row could not be deleted. It is already deleted.")
-#define STR_QUERY_MORE_TABLES NC_("STR_QUERY_MORE_TABLES", "The query can not be executed. It contains more than one table.")
-#define STR_QUERY_NO_TABLE NC_("STR_QUERY_NO_TABLE", "The query can not be executed. It contains no valid table.")
-#define STR_QUERY_NO_COLUMN NC_("STR_QUERY_NO_COLUMN", "The query can not be executed. It contains no valid columns.")
-#define STR_INVALID_PARA_COUNT NC_("STR_INVALID_PARA_COUNT", "The count of the given parameter values doesn't match the parameters.")
-#define STR_NO_VALID_FILE_URL NC_("STR_NO_VALID_FILE_URL", "The URL '$URL$' is not valid. A connection can not be created.")
-#define STR_NO_CLASSNAME NC_("STR_NO_CLASSNAME", "The driver class '$classname$' could not be loaded.")
+#define STR_QUERY_MORE_TABLES NC_("STR_QUERY_MORE_TABLES", "The query cannot be executed. It contains more than one table.")
+#define STR_QUERY_NO_TABLE NC_("STR_QUERY_NO_TABLE", "The query cannot be executed. It contains no valid table.")
+#define STR_QUERY_NO_COLUMN NC_("STR_QUERY_NO_COLUMN", "The query cannot be executed. It contains no valid columns.")
+#define STR_INVALID_PARA_COUNT NC_("STR_INVALID_PARA_COUNT", "The count of the given parameter values does not match the parameters.")
+#define STR_NO_VALID_FILE_URL NC_("STR_NO_VALID_FILE_URL", "The URL “$URL$” is not valid. A connection cannot be created.")
+#define STR_NO_CLASSNAME NC_("STR_NO_CLASSNAME", "The driver class “$classname$” could not be loaded.")
#define STR_NO_JAVA NC_("STR_NO_JAVA", "No Java installation could be found. Please check your installation.")
-#define STR_NO_RESULTSET NC_("STR_NO_RESULTSET", "The execution of the query doesn't return a valid result set.")
-#define STR_NO_ROWCOUNT NC_("STR_NO_ROWCOUNT", "The execution of the update statement doesn't effect any rows.")
-#define STR_NO_CLASSNAME_PATH NC_("STR_NO_CLASSNAME_PATH", "The additional driver class path is '$classpath$'.")
-#define STR_UNKNOWN_PARA_TYPE NC_("STR_UNKNOWN_PARA_TYPE", "The type of parameter at position '$position$' is unknown.")
-#define STR_UNKNOWN_COLUMN_TYPE NC_("STR_UNKNOWN_COLUMN_TYPE", "The type of column at position '$position$' is unknown.")
+#define STR_NO_RESULTSET NC_("STR_NO_RESULTSET", "The execution of the query does not return a valid result set.")
+#define STR_NO_ROWCOUNT NC_("STR_NO_ROWCOUNT", "The execution of the update statement does not affect any rows.")
+#define STR_NO_CLASSNAME_PATH NC_("STR_NO_CLASSNAME_PATH", "The additional driver class path is “$classpath$”.")
+#define STR_UNKNOWN_PARA_TYPE NC_("STR_UNKNOWN_PARA_TYPE", "The type of parameter at position “$position$” is unknown.")
+#define STR_UNKNOWN_COLUMN_TYPE NC_("STR_UNKNOWN_COLUMN_TYPE", "The type of column at position “$position$” is unknown.")
// KAB
#define STR_PARA_ONLY_PREPARED NC_("STR_PARA_ONLY_PREPARED", "Parameters can appear only in prepared statements.")
// MACAB
#define STR_NO_TABLE NC_("STR_NO_TABLE", "No such table!")
-#define STR_NO_MAC_OS_FOUND NC_("STR_NO_MAC_OS_FOUND", "No suitable Mac OS installation was found.")
+#define STR_NO_MAC_OS_FOUND NC_("STR_NO_MAC_OS_FOUND", "No suitable macOS installation was found.")
// hsqldb
#define STR_NO_STORAGE NC_("STR_NO_STORAGE", "The connection can not be established. No storage or URL was given.")
#define STR_INVALID_FILE_URL NC_("STR_INVALID_FILE_URL", "The given URL contains no valid local file system path. Please check the location of your database file.")
-#define STR_NO_TABLE_CONTAINER NC_("STR_NO_TABLE_CONTAINER", "An error occurred while obtaining the connection's table container.")
-#define STR_NO_TABLENAME NC_("STR_NO_TABLENAME", "There is no table named '$tablename$'.")
+#define STR_NO_TABLE_CONTAINER NC_("STR_NO_TABLE_CONTAINER", "An error occurred while obtaining the connection’s table container.")
+#define STR_NO_TABLENAME NC_("STR_NO_TABLENAME", "There is no table named “$tablename$”.")
#define STR_NO_DOCUMENTUI NC_("STR_NO_DOCUMENTUI", "The provided DocumentUI is not allowed to be NULL.")
#define STR_ERROR_NEW_VERSION NC_("STR_ERROR_NEW_VERSION", "The connection could not be established. The database was created by a newer version of %PRODUCTNAME.")
#define STR_ROW_SET_OPERATION_VETOED NC_("STR_ROW_SET_OPERATION_VETOED", "The record operation has been vetoed.")
-#define STR_PARSER_CYCLIC_SUB_QUERIES NC_("STR_PARSER_CYCLIC_SUB_QUERIES", "The statement contains a cyclic reference to one or more sub queries.")
-#define STR_DB_OBJECT_NAME_WITH_SLASHES NC_("STR_DB_OBJECT_NAME_WITH_SLASHES", "The name must not contain any slashes ('/').")
+#define STR_PARSER_CYCLIC_SUB_QUERIES NC_("STR_PARSER_CYCLIC_SUB_QUERIES", "The statement contains a cyclic reference to one or more subqueries.")
+#define STR_DB_OBJECT_NAME_WITH_SLASHES NC_("STR_DB_OBJECT_NAME_WITH_SLASHES", "The name must not contain any slashes (“/”).")
#define STR_DB_INVALID_SQL_NAME NC_("STR_DB_INVALID_SQL_NAME", "$1$ is no SQL conform identifier.")
#define STR_DB_QUERY_NAME_WITH_QUOTES NC_("STR_DB_QUERY_NAME_WITH_QUOTES", "Query names must not contain quote characters.")
-#define STR_DB_OBJECT_NAME_IS_USED NC_("STR_DB_OBJECT_NAME_IS_USED", "The name '$1$' is already in use in the database.")
+#define STR_DB_OBJECT_NAME_IS_USED NC_("STR_DB_OBJECT_NAME_IS_USED", "The name “$1$” is already in use in the database.")
#define STR_DB_NOT_CONNECTED NC_("STR_DB_NOT_CONNECTED", "No connection to the database exists.")
#define STR_AB_ADDRESSBOOK_NOT_FOUND NC_("STR_AB_ADDRESSBOOK_NOT_FOUND", "No $1$ exists.")
#define STR_DATA_CANNOT_SELECT_UNFILTERED NC_("STR_DATA_CANNOT_SELECT_UNFILTERED", "Unable to display the complete table content. Please apply a filter.")
diff --git a/connectivity/inc/strings.hxx b/connectivity/inc/strings.hxx
index c81b2a08b74b..b6bd8e5458de 100644
--- a/connectivity/inc/strings.hxx
+++ b/connectivity/inc/strings.hxx
@@ -7,71 +7,70 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_INC_STRINGS_HXX
-#define INCLUDED_CONNECTIVITY_INC_STRINGS_HXX
+#pragma once
+
+#include <rtl/ustring.hxx>
// = log messages for the JDBC driver
#define STR_LOG_DRIVER_CONNECTING_URL "jdbcBridge: connecting to URL '$1$'"
-#define STR_LOG_DRIVER_SUCCESS "jdbcBridge: success"
-#define STR_LOG_CREATE_STATEMENT "c$1$: creating statement"
-#define STR_LOG_CREATED_STATEMENT_ID "c$1$: created statement, statement id: s$2$"
-#define STR_LOG_PREPARE_STATEMENT "c$1$: preparing statement: $2$"
-#define STR_LOG_PREPARED_STATEMENT_ID "c$1$: prepared statement, statement id: s$2$"
-#define STR_LOG_PREPARE_CALL "c$1$: preparing call: $2$"
-#define STR_LOG_PREPARED_CALL_ID "c$1$: prepared call, statement id: s$2$"
-#define STR_LOG_NATIVE_SQL "c$1$: native SQL: $2$ -> $3$"
-#define STR_LOG_LOADING_DRIVER "c$1$: attempting to load driver class $2$"
-#define STR_LOG_NO_DRIVER_CLASS "c$1$: no Java Driver Class was provided"
-#define STR_LOG_CONN_SUCCESS "c$1$: success"
-#define STR_LOG_NO_SYSTEM_CONNECTION "c$1$: JDBC driver did not provide a JDBC connection"
-#define STR_LOG_GOT_JDBC_CONNECTION "c$1$: obtained a JDBC connection for $2$"
-#define STR_LOG_SHUTDOWN_CONNECTION "c$1$: shutting down connection"
-#define STR_LOG_GENERATED_VALUES "s$1$: retrieving generated values"
-#define STR_LOG_GENERATED_VALUES_FALLBACK "s$1$: getGeneratedValues: falling back to statement: $2$"
-#define STR_LOG_EXECUTE_STATEMENT "s$1$: going to execute: $2$"
-#define STR_LOG_EXECUTE_QUERY "s$1$: going to execute query: $2$"
-#define STR_LOG_CLOSING_STATEMENT "s$1$: closing/disposing statement"
-#define STR_LOG_EXECUTE_UPDATE "s$1$: going to execute update: $2$"
-#define STR_LOG_UPDATE_COUNT "s$1$: update count: $2$"
-#define STR_LOG_RESULT_SET_CONCURRENCY "s$1$: going to set result set concurrency: $2$"
-#define STR_LOG_RESULT_SET_TYPE "s$1$: going to set result set type: $2$"
-#define STR_LOG_FETCH_DIRECTION "s$1$: fetch direction: $2$"
-#define STR_LOG_FETCH_SIZE "s$1$: fetch size: $2$"
-#define STR_LOG_SET_ESCAPE_PROCESSING "s$1$: going to set escape processing: $2$"
-#define STR_LOG_EXECUTING_PREPARED "s$1$: executing previously prepared statement"
-#define STR_LOG_EXECUTING_PREPARED_UPDATE "s$1$: executing previously prepared update statement"
-#define STR_LOG_EXECUTING_PREPARED_QUERY "s$1$: executing previously prepared query"
-#define STR_LOG_STRING_PARAMETER "s$1$: parameter no. $2$: type: string; value: $3$"
-#define STR_LOG_BOOLEAN_PARAMETER "s$1$: parameter no. $2$: type: boolean; value: $3$"
-#define STR_LOG_BYTE_PARAMETER "s$1$: parameter no. $2$: type: byte; value: $3$"
-#define STR_LOG_DATE_PARAMETER "s$1$: parameter no. $2$: type: date; value: $3$"
-#define STR_LOG_TIME_PARAMETER "s$1$: parameter no. $2$: type: time; value: $3$"
-#define STR_LOG_TIMESTAMP_PARAMETER "s$1$: parameter no. $2$: type: timestamp; value: $3$"
-#define STR_LOG_DOUBLE_PARAMETER "s$1$: parameter no. $2$: type: double; value: $3$"
-#define STR_LOG_FLOAT_PARAMETER "s$1$: parameter no. $2$: type: float; value: $3$"
-#define STR_LOG_INT_PARAMETER "s$1$: parameter no. $2$: type: int; value: $3$"
-#define STR_LOG_LONG_PARAMETER "s$1$: parameter no. $2$: type: long; value: $3$"
-#define STR_LOG_NULL_PARAMETER "s$1$: parameter no. $2$: sql-type: $3$; value: null"
-#define STR_LOG_OBJECT_NULL_PARAMETER "s$1$: parameter no. $2$: setting to null"
-#define STR_LOG_SHORT_PARAMETER "s$1$: parameter no. $2$: type: short; value: $3$"
-#define STR_LOG_BYTES_PARAMETER "s$1$: parameter no. $2$: type: byte[]"
-#define STR_LOG_CHARSTREAM_PARAMETER "s$1$: parameter no. $2$: type: character stream"
-#define STR_LOG_BINARYSTREAM_PARAMETER "s$1$: parameter no. $2$: type: binary stream"
-#define STR_LOG_CLEAR_PARAMETERS "s$1$: clearing all parameters"
-#define STR_LOG_META_DATA_METHOD "c$1$: entering XDatabaseMetaData::$2$"
-#define STR_LOG_META_DATA_METHOD_ARG1 "c$1$: entering XDatabaseMetaData::$2$( '$3$' )"
-#define STR_LOG_META_DATA_METHOD_ARG2 "c$1$: entering XDatabaseMetaData::$2$( '$3$', '$4$' )"
-#define STR_LOG_META_DATA_METHOD_ARG3 "c$1$: entering XDatabaseMetaData::$2$( '$3$', '$4$', '$5$' )"
-#define STR_LOG_META_DATA_METHOD_ARG4 "c$1$: entering XDatabaseMetaData::$2$( '$3$', '$4$', '$5$', '$6$' )"
-#define STR_LOG_META_DATA_RESULT "c$1$: leaving XDatabaseMetaData::$2$: success-with-result: $3$"
-#define STR_LOG_META_DATA_SUCCESS "c$1$: leaving XDatabaseMetaData::$2$: success"
+inline constexpr OUString STR_LOG_DRIVER_SUCCESS = u"jdbcBridge: success"_ustr;
+inline constexpr OUString STR_LOG_CREATE_STATEMENT = u"c$1$: creating statement"_ustr;
+inline constexpr OUString STR_LOG_CREATED_STATEMENT_ID = u"c$1$: created statement, statement id: s$2$"_ustr;
+inline constexpr OUString STR_LOG_PREPARE_STATEMENT = u"c$1$: preparing statement: $2$"_ustr;
+inline constexpr OUString STR_LOG_PREPARED_STATEMENT_ID = u"c$1$: prepared statement, statement id: s$2$"_ustr;
+inline constexpr OUString STR_LOG_PREPARE_CALL = u"c$1$: preparing call: $2$"_ustr;
+inline constexpr OUString STR_LOG_PREPARED_CALL_ID = u"c$1$: prepared call, statement id: s$2$"_ustr;
+inline constexpr OUString STR_LOG_NATIVE_SQL = u"c$1$: native SQL: $2$ -> $3$"_ustr;
+inline constexpr OUString STR_LOG_LOADING_DRIVER = u"c$1$: attempting to load driver class $2$"_ustr;
+inline constexpr OUString STR_LOG_NO_DRIVER_CLASS = u"c$1$: no Java Driver Class was provided"_ustr;
+inline constexpr OUString STR_LOG_CONN_SUCCESS = u"c$1$: success"_ustr;
+inline constexpr OUString STR_LOG_NO_SYSTEM_CONNECTION = u"c$1$: JDBC driver did not provide a JDBC connection"_ustr;
+inline constexpr OUString STR_LOG_GOT_JDBC_CONNECTION = u"c$1$: obtained a JDBC connection for $2$"_ustr;
+inline constexpr OUString STR_LOG_SHUTDOWN_CONNECTION = u"c$1$: shutting down connection"_ustr;
+inline constexpr OUString STR_LOG_GENERATED_VALUES = u"s$1$: retrieving generated values"_ustr;
+inline constexpr OUString STR_LOG_GENERATED_VALUES_FALLBACK = u"s$1$: getGeneratedValues: falling back to statement: $2$"_ustr;
+inline constexpr OUString STR_LOG_EXECUTE_STATEMENT = u"s$1$: going to execute: $2$"_ustr;
+inline constexpr OUString STR_LOG_EXECUTE_QUERY = u"s$1$: going to execute query: $2$"_ustr;
+inline constexpr OUString STR_LOG_CLOSING_STATEMENT = u"s$1$: closing/disposing statement"_ustr;
+inline constexpr OUString STR_LOG_EXECUTE_UPDATE = u"s$1$: going to execute update: $2$"_ustr;
+inline constexpr OUString STR_LOG_UPDATE_COUNT = u"s$1$: update count: $2$"_ustr;
+inline constexpr OUString STR_LOG_RESULT_SET_CONCURRENCY = u"s$1$: going to set result set concurrency: $2$"_ustr;
+inline constexpr OUString STR_LOG_RESULT_SET_TYPE = u"s$1$: going to set result set type: $2$"_ustr;
+inline constexpr OUString STR_LOG_FETCH_DIRECTION = u"s$1$: fetch direction: $2$"_ustr;
+inline constexpr OUString STR_LOG_FETCH_SIZE = u"s$1$: fetch size: $2$"_ustr;
+inline constexpr OUString STR_LOG_SET_ESCAPE_PROCESSING = u"s$1$: going to set escape processing: $2$"_ustr;
+inline constexpr OUString STR_LOG_EXECUTING_PREPARED = u"s$1$: executing previously prepared statement"_ustr;
+inline constexpr OUString STR_LOG_EXECUTING_PREPARED_UPDATE = u"s$1$: executing previously prepared update statement"_ustr;
+inline constexpr OUString STR_LOG_EXECUTING_PREPARED_QUERY = u"s$1$: executing previously prepared query"_ustr;
+inline constexpr OUString STR_LOG_STRING_PARAMETER = u"s$1$: parameter no. $2$: type: string; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_BOOLEAN_PARAMETER = u"s$1$: parameter no. $2$: type: boolean; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_BYTE_PARAMETER = u"s$1$: parameter no. $2$: type: byte; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_DATE_PARAMETER = u"s$1$: parameter no. $2$: type: date; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_TIME_PARAMETER = u"s$1$: parameter no. $2$: type: time; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_TIMESTAMP_PARAMETER = u"s$1$: parameter no. $2$: type: timestamp; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_DOUBLE_PARAMETER = u"s$1$: parameter no. $2$: type: double; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_FLOAT_PARAMETER = u"s$1$: parameter no. $2$: type: float; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_INT_PARAMETER = u"s$1$: parameter no. $2$: type: int; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_LONG_PARAMETER = u"s$1$: parameter no. $2$: type: long; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_NULL_PARAMETER = u"s$1$: parameter no. $2$: sql-type: $3$; value: null"_ustr;
+inline constexpr OUString STR_LOG_OBJECT_NULL_PARAMETER = u"s$1$: parameter no. $2$: setting to null"_ustr;
+inline constexpr OUString STR_LOG_SHORT_PARAMETER = u"s$1$: parameter no. $2$: type: short; value: $3$"_ustr;
+inline constexpr OUString STR_LOG_BYTES_PARAMETER = u"s$1$: parameter no. $2$: type: byte[]"_ustr;
+inline constexpr OUString STR_LOG_CHARSTREAM_PARAMETER = u"s$1$: parameter no. $2$: type: character stream"_ustr;
+inline constexpr OUString STR_LOG_BINARYSTREAM_PARAMETER = u"s$1$: parameter no. $2$: type: binary stream"_ustr;
+inline constexpr OUString STR_LOG_CLEAR_PARAMETERS = u"s$1$: clearing all parameters"_ustr;
+inline constexpr OUString STR_LOG_META_DATA_METHOD = u"c$1$: entering XDatabaseMetaData::$2$"_ustr;
+inline constexpr OUString STR_LOG_META_DATA_METHOD_ARG1 = u"c$1$: entering XDatabaseMetaData::$2$( '$3$' )"_ustr;
+inline constexpr OUString STR_LOG_META_DATA_METHOD_ARG2 = u"c$1$: entering XDatabaseMetaData::$2$( '$3$', '$4$' )"_ustr;
+inline constexpr OUString STR_LOG_META_DATA_METHOD_ARG3 = u"c$1$: entering XDatabaseMetaData::$2$( '$3$', '$4$', '$5$' )"_ustr;
+inline constexpr OUString STR_LOG_META_DATA_METHOD_ARG4 = u"c$1$: entering XDatabaseMetaData::$2$( '$3$', '$4$', '$5$', '$6$' )"_ustr;
+inline constexpr OUString STR_LOG_META_DATA_RESULT = u"c$1$: leaving XDatabaseMetaData::$2$: success-with-result: $3$"_ustr;
+inline constexpr OUString STR_LOG_META_DATA_SUCCESS = u"c$1$: leaving XDatabaseMetaData::$2$: success"_ustr;
#define STR_LOG_THROWING_EXCEPTION "SQLException to be thrown: message: '$1$', SQLState: $2$, ErrorCode: $3$"
-#define STR_LOG_SETTING_SYSTEM_PROPERTY "setting system property \"$1$\" to value \"$2$\""
-
-#define STR_DB_NOT_CONNECTED_STATE "08003"
-#define STR_DATA_CANNOT_SELECT_UNFILTERED_STATE "IM001"
+inline constexpr OUString STR_LOG_SETTING_SYSTEM_PROPERTY = u"setting system property \"$1$\" to value \"$2$\""_ustr;
-#endif
+inline constexpr OUString STR_DB_NOT_CONNECTED_STATE = u"08003"_ustr;
+inline constexpr OUString STR_DATA_CANNOT_SELECT_UNFILTERED_STATE = u"IM001"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java b/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java
index d3c802e15a40..d2ee3c680291 100644
--- a/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java
+++ b/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java
@@ -467,7 +467,7 @@ public class TestCacheSize {
|| (slow && (i + 1) % 100 == 0)) {
System.out.println("Select " + (i + 1) + " : "
+ sw.elapsedTime() + " rps: "
- + (1000L * i / (sw.elapsedTime() + 1)));
+ + (1000 * i / (sw.elapsedTime() + 1)));
}
}
} catch (SQLException e) {
@@ -476,7 +476,7 @@ public class TestCacheSize {
System.out.println("Select random zip " + i + " rows : "
+ sw.elapsedTime() + " rps: "
- + (1000L * i / (sw.elapsedTime() + 1)));
+ + (1000 * i / (sw.elapsedTime() + 1)));
sw.zero();
try {
@@ -500,7 +500,7 @@ public class TestCacheSize {
System.out.println("Select random id " + i + " rows : "
+ sw.elapsedTime() + " rps: "
- + (1000L * i / (sw.elapsedTime() + 1)));
+ + (1000 * i / (sw.elapsedTime() + 1)));
sw.zero();
try {
@@ -524,7 +524,7 @@ public class TestCacheSize {
System.out.println("Select random zip from zip table " + i
+ " rows : " + sw.elapsedTime() + " rps: "
- + (1000L * i / (sw.elapsedTime() + 1)));
+ + (1000 * i / (sw.elapsedTime() + 1)));
}
private void checkUpdates() {
@@ -559,7 +559,7 @@ public class TestCacheSize {
System.out.println("Update with random zip " + i
+ " UPDATE commands, " + count + " rows : "
+ sw.elapsedTime() + " rps: "
- + (1000L * count / (sw.elapsedTime() + 1)));
+ + (1000 * count / (sw.elapsedTime() + 1)));
sw.zero();
try {
@@ -577,7 +577,7 @@ public class TestCacheSize {
|| (slow && (i + 1) % 100 == 0)) {
System.out.println("Update " + (i + 1) + " : "
+ sw.elapsedTime() + " rps: "
- + (1000L * i / (sw.elapsedTime() + 1)));
+ + (1000 * i / (sw.elapsedTime() + 1)));
}
}
} catch (SQLException e) {
@@ -586,6 +586,6 @@ public class TestCacheSize {
System.out.println("Update with random id " + i + " rows : "
+ sw.elapsedTime() + " rps: "
- + (1000L * i / (sw.elapsedTime() + 1)));
+ + (1000 * i / (sw.elapsedTime() + 1)));
}
}
diff --git a/connectivity/qa/connectivity/ado/DriverTest.cxx b/connectivity/qa/connectivity/ado/DriverTest.cxx
index 1be8c04c7fb5..a737387fe010 100644
--- a/connectivity/qa/connectivity/ado/DriverTest.cxx
+++ b/connectivity/qa/connectivity/ado/DriverTest.cxx
@@ -93,8 +93,8 @@ void AdoDriverTest::test_metadata()
}
const Any catalog;
- const OUString schemaPattern = "%";
- const OUString tableNamePattern = "%";
+ static constexpr OUStringLiteral schemaPattern = u"%";
+ static constexpr OUStringLiteral tableNamePattern = u"%";
const Sequence< OUString > types;
Reference< XResultSet > xResultSet =
@@ -107,7 +107,7 @@ void AdoDriverTest::test_metadata()
void AdoDriverTest::test_select_default_all()
{
- const OUString sql = "select \"FirstName\" from \"Students\" ORDER BY \"FirstName\"";
+ static constexpr OUStringLiteral sql = u"select \"FirstName\" from \"Students\" ORDER BY \"FirstName\"";
Reference< XPreparedStatement > xStatement = m_xConnection->prepareStatement(sql);
if (!xStatement.is())
{
diff --git a/connectivity/qa/connectivity/commontools/FValue_test.cxx b/connectivity/qa/connectivity/commontools/FValue_test.cxx
index b6f0e36588ad..de6b2b27ddac 100644
--- a/connectivity/qa/connectivity/commontools/FValue_test.cxx
+++ b/connectivity/qa/connectivity/commontools/FValue_test.cxx
@@ -320,37 +320,37 @@ void FValueTest::test_bool_creation()
ORowSetValue vFalse(false);
{
- ORowSetValue v(OUString("1"));
+ ORowSetValue v(u"1"_ustr);
v.setTypeKind(DataType::BOOLEAN);
CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", bool(v == vTrue));
}
{
- ORowSetValue v(OUString("0"));
+ ORowSetValue v(u"0"_ustr);
v.setTypeKind(DataType::BOOLEAN);
CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", bool(v == vFalse));
}
{
- ORowSetValue v(OUString("true"));
+ ORowSetValue v(u"true"_ustr);
v.setTypeKind(DataType::BOOLEAN);
CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", bool(v == vTrue));
}
{
- ORowSetValue v(OUString("tRuE"));
+ ORowSetValue v(u"tRuE"_ustr);
v.setTypeKind(DataType::BOOLEAN);
CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", bool(v == vTrue));
}
{
- ORowSetValue v(OUString("false"));
+ ORowSetValue v(u"false"_ustr);
v.setTypeKind(DataType::BOOLEAN);
CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", bool(v == vFalse));
}
{
- ORowSetValue v(OUString("0"));
+ ORowSetValue v(u"0"_ustr);
v.setTypeKind(DataType::BOOLEAN);
CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", bool(v == vFalse));
}
diff --git a/connectivity/qa/connectivity/mysql/mysql.cxx b/connectivity/qa/connectivity/mysql/mysql.cxx
index 7a4267b5e95b..4b1a9a4e4f08 100644
--- a/connectivity/qa/connectivity/mysql/mysql.cxx
+++ b/connectivity/qa/connectivity/mysql/mysql.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/util/DateTime.hpp>
+#include <comphelper/propertysequence.hxx>
#include <svtools/miscopt.hxx>
#include <osl/process.h>
@@ -101,16 +102,16 @@ void MysqlTestDriver::setUp()
CPPUNIT_ASSERT_MESSAGE("no mysqlc component!", m_xMysqlcComponent.is());
// set user name and password
- m_infos = Sequence<PropertyValue>{ 2 };
- m_infos[0].Name = OUString{ "user" };
sal_Int32 nPer = m_sUrl.indexOf("/");
- m_infos[0].Value = makeAny(m_sUrl.copy(0, nPer));
+ OUString sUsername = m_sUrl.copy(0, nPer);
m_sUrl = m_sUrl.copy(nPer + 1);
- m_infos[1].Name = OUString{ "password" };
sal_Int32 nAt = m_sUrl.indexOf("@");
- m_infos[1].Value = makeAny(m_sUrl.copy(0, nAt));
+ OUString sPassword = m_sUrl.copy(0, nAt);
m_sUrl = m_sUrl.copy(nAt + 1);
+ m_infos = comphelper::InitPropertySequence(
+ { { "user", makeAny(sUsername) }, { "password", makeAny(sPassword) } });
+
m_xDriver.set(m_xMysqlcComponent, UNO_QUERY);
if (!m_xDriver.is())
{
diff --git a/connectivity/qa/connectivity/resource/sharedresources_test.cxx b/connectivity/qa/connectivity/resource/sharedresources_test.cxx
index a6bf22fba858..0f180ba018ca 100644
--- a/connectivity/qa/connectivity/resource/sharedresources_test.cxx
+++ b/connectivity/qa/connectivity/resource/sharedresources_test.cxx
@@ -60,40 +60,39 @@ SharedResourcesTest::SharedResourcesTest()
void SharedResourcesTest::testGetSourceString()
{
- CPPUNIT_ASSERT_EQUAL(OUString("UnitTest"), m_aResource.getResourceString(TEST_SOURCE_STRING));
+ CPPUNIT_ASSERT_EQUAL(u"UnitTest"_ustr, m_aResource.getResourceString(TEST_SOURCE_STRING));
}
void SharedResourcesTest::testGetSourceStringWithSubstitutionOne()
{
- CPPUNIT_ASSERT_EQUAL(OUString("One substitution UnitTest"),
+ CPPUNIT_ASSERT_EQUAL(u"One substitution UnitTest"_ustr,
m_aResource.getResourceStringWithSubstitution(TEST_SOURCE_ONE_SUBSTITUTION,
- "$sub$", "UnitTest"));
+ "$sub$", u"UnitTest"_ustr));
}
void SharedResourcesTest::testGetSourceStringWithSubstitutionTwo()
{
- CPPUNIT_ASSERT_EQUAL(OUString("Two substitution UnitTest1 UnitTest2"),
- m_aResource.getResourceStringWithSubstitution(TEST_SOURCE_TWO_SUBSTITUTION,
- "$sub0$", "UnitTest1",
- "$sub1$", "UnitTest2"));
+ CPPUNIT_ASSERT_EQUAL(u"Two substitution UnitTest1 UnitTest2"_ustr,
+ m_aResource.getResourceStringWithSubstitution(
+ TEST_SOURCE_TWO_SUBSTITUTION, "$sub0$", u"UnitTest1"_ustr, "$sub1$",
+ u"UnitTest2"_ustr));
}
void SharedResourcesTest::testGetSourceStringWithSubstitutionThree()
{
- CPPUNIT_ASSERT_EQUAL(OUString("Three substitution UnitTest1 UnitTest2 UnitTest3"),
+ CPPUNIT_ASSERT_EQUAL(u"Three substitution UnitTest1 UnitTest2 UnitTest3"_ustr,
m_aResource.getResourceStringWithSubstitution(
- TEST_SOURCE_THREE_SUBSTITUTION, "$sub0$", "UnitTest1", "$sub1$",
- "UnitTest2", "$sub2$", "UnitTest3"));
+ TEST_SOURCE_THREE_SUBSTITUTION, "$sub0$", u"UnitTest1"_ustr, "$sub1$",
+ u"UnitTest2"_ustr, "$sub2$", u"UnitTest3"_ustr));
}
void SharedResourcesTest::testGetSourceStringWithSubstitutionVector()
{
- std::vector<std::pair<const char*, OUString>> aStringToSubstitutes;
- aStringToSubstitutes.push_back(std::pair<const char*, OUString>("$sub0$", "vector0"));
- aStringToSubstitutes.push_back(std::pair<const char*, OUString>("$sub1$", "vector1"));
- aStringToSubstitutes.push_back(std::pair<const char*, OUString>("$sub2$", "vector2"));
+ std::vector<std::pair<const char*, OUString>> aStringToSubstitutes{ { "$sub0$", "vector0" },
+ { "$sub1$", "vector1" },
+ { "$sub2$", "vector2" } };
- CPPUNIT_ASSERT_EQUAL(OUString("Three substitution vector0 vector1 vector2"),
+ CPPUNIT_ASSERT_EQUAL(u"Three substitution vector0 vector1 vector2"_ustr,
m_aResource.getResourceStringWithSubstitution(
TEST_SOURCE_THREE_SUBSTITUTION, aStringToSubstitutes));
}
diff --git a/connectivity/qa/connectivity/tools/CRMDatabase.java b/connectivity/qa/connectivity/tools/CRMDatabase.java
index 3d33926280c3..204b90fa9def 100644
--- a/connectivity/qa/connectivity/tools/CRMDatabase.java
+++ b/connectivity/qa/connectivity/tools/CRMDatabase.java
@@ -203,43 +203,6 @@ public class CRMDatabase
m_connection.refreshTables();
}
-
- private void validateUnparseable()
- {
- /*
- // The "unparseable" query should be indeed be unparseable by OOo (though a valid HSQL query)
- XSingleSelectQueryComposer composer;
- QueryDefinition unparseableQuery;
- try
- {
- final XMultiServiceFactory factory = UnoRuntime.queryInterface(
- XMultiServiceFactory.class, m_database.defaultConnection().getXConnection() );
- composer = UnoRuntime.queryInterface(
- XSingleSelectQueryComposer.class, factory.createInstance( "com.sun.star.sdb.SingleSelectQueryComposer" ) );
- unparseableQuery = m_dataSource.getQueryDefinition( "unparseable" );
- }
- catch( Exception e )
- {
- throw new RuntimeException( "caught an unexpected exception: " + e.getMessage() );
- }
-
- boolean caughtExpected = false;
- try
- {
- composer.setQuery( unparseableQuery.getCommand() );
- }
- catch (WrappedTargetException e) { }
- catch( SQLException e )
- {
- caughtExpected = true;
- }
-
- if ( !caughtExpected )
- throw new RuntimeException( "Somebody improved the parser! This is bad :), since we need an unparsable query here!" );
- */
- }
-
-
private void createQueries() throws ElementExistException, WrappedTargetException, com.sun.star.lang.IllegalArgumentException
{
m_database.getDataSource().createQuery(
@@ -268,10 +231,5 @@ public class CRMDatabase
m_database.getDataSource().createQuery( "parseable", "SELECT * FROM \"customers\"" );
m_database.getDataSource().createQuery( "parseable native", "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VIEWS", false );
-/*
- m_database.getDataSource().createQuery( "unparseable",
- "SELECT {fn DAYOFMONTH ('2001-01-01')} AS \"ID_VARCHAR\" FROM \"products\"", false );
-*/
- validateUnparseable();
}
}
diff --git a/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu
index 288c23e2e497..28f915ff8e3e 100644
--- a/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -214,7 +214,7 @@
</node>
</node>
</node>
- <node oor:name="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*" oor:op="replace">
+ <node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">
<prop oor:name="Driver">
<value>com.sun.star.comp.sdbc.ado.ODriver</value>
</prop>
@@ -340,7 +340,7 @@
</node>
<node oor:name="Extension" oor:op="replace">
<prop oor:name="Value" oor:type="xs:string">
- <value>mdb</value>
+ <value></value>
</prop>
</node>
<node oor:name="SupportsColumnDescription" oor:op="replace">
@@ -350,20 +350,5 @@
</node>
</node>
</node>
- <node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">
- <prop oor:name="ParentURLPattern">
- <value>sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Microsoft Access 2007</value>
- </prop>
- <node oor:name="MetaData">
- <node oor:name="Extension" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- </node>
- </node>
</node>
</oor:component-data>
diff --git a/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu
index 586264183b60..11b214855bc6 100644
--- a/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -77,13 +77,13 @@
<node oor:name="MetaData">
</node>
</node>
- <!-- Firebird FILE Driver -->
+ <!-- Firebird EXTERNAL Driver -->
<node oor:name="sdbc:firebird:*" oor:op="replace">
<prop oor:name="Driver">
<value>com.sun.star.comp.sdbc.firebird.Driver</value>
</prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Firebird File</value>
+ <value xml:lang="en-US">Firebird External</value>
</prop>
<node oor:name="Properties">
<!-- Don't use ODBC syntax for date&time literals and (full) outer joins,
@@ -124,6 +124,11 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
</node>
</node>
</node>
diff --git a/connectivity/registry/flat/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/flat/org/openoffice/Office/DataAccess/Drivers.xcu
index af1e37962be1..a0f69df29185 100644
--- a/connectivity/registry/flat/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/flat/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -23,7 +23,7 @@
<value>com.sun.star.comp.sdbc.flat.ODriver</value>
</prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Text</value>
+ <value xml:lang="en-US">Text/CSV</value>
</prop>
<node oor:name="Properties">
<node oor:name="CharSet" oor:op="replace">
diff --git a/connectivity/registry/macab/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/macab/org/openoffice/Office/DataAccess/Drivers.xcu
index 3d9d3121de6e..027b6482535f 100644
--- a/connectivity/registry/macab/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/macab/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -23,7 +23,7 @@
<value>com.sun.star.comp.sdbc.macab.Driver</value>
</prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Mac OS X Address Book</value>
+ <value xml:lang="en-US">macOS Address Book</value>
</prop>
<node oor:name="Properties">
<node oor:name="EscapeDateTime" oor:op="replace">
diff --git a/connectivity/registry/mysql_jdbc/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/mysql_jdbc/org/openoffice/Office/DataAccess/Drivers.xcu
index a4e95b04fe9b..38be69b48a4d 100644
--- a/connectivity/registry/mysql_jdbc/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/mysql_jdbc/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -176,89 +176,5 @@
</node>
</node>
</node>
- <node oor:name="sdbc:mysql:mysqlc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>org.openoffice.comp.drivers.MySQL.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL (Native)</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="LocalSocket" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="NamedPipe" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="ParameterNameSubstitution" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="SupportsColumnDescription" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
</node>
</oor:component-data>
diff --git a/connectivity/registry/mysqlc/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/mysqlc/org/openoffice/Office/DataAccess/Drivers.xcu
index 1b83115dc7d0..13ed25f95e06 100644
--- a/connectivity/registry/mysqlc/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/mysqlc/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -23,7 +23,7 @@
<value>com.sun.star.comp.sdbc.mysqlc.MysqlCDriver</value>
</prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL Connector</value>
+ <value xml:lang="en-US">MySQL/MariaDB Connector</value>
</prop>
<node oor:name="Properties">
<node oor:name="CharSet" oor:op="replace">
@@ -41,6 +41,11 @@
<value></value>
</prop>
</node>
+ <node oor:name="AddIndexAppendix" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
<node oor:name="GenerateASBeforeCorrelationName" oor:op="replace">
<!-- Corresponds to UseKeywordAsBeforeAlias in Features - see connectivity/registry/README -->
<prop oor:name="Value" oor:type="xs:boolean">
@@ -122,6 +127,11 @@
<value>UserPassword</value>
</prop>
</node>
+ <node oor:name="SupportsColumnDescription" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
</node>
</node>
</node>
diff --git a/connectivity/source/commontools/AutoRetrievingBase.cxx b/connectivity/source/commontools/AutoRetrievingBase.cxx
index d1170fdd972b..99327f27eeb5 100644
--- a/connectivity/source/commontools/AutoRetrievingBase.cxx
+++ b/connectivity/source/commontools/AutoRetrievingBase.cxx
@@ -20,6 +20,7 @@
#include <AutoRetrievingBase.hxx>
#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
namespace connectivity
{
@@ -39,7 +40,7 @@ namespace connectivity
{ // we need a table name
sal_Int32 nIntoIndex = sStmt.indexOf("INTO ") + 5;
while (nIntoIndex<sStmt.getLength() && sStmt[nIntoIndex]==' ') ++nIntoIndex;
- const OUString sTableName = sStmt.getToken(0, ' ', nIntoIndex);
+ const std::u16string_view sTableName = o3tl::getToken(sStmt, 0, ' ', nIntoIndex);
return m_sGeneratedValueStatement.replaceAt(nTableIndex, strlen(sTable), sTableName);
}
return m_sGeneratedValueStatement;
diff --git a/connectivity/source/commontools/BlobHelper.cxx b/connectivity/source/commontools/BlobHelper.cxx
index 591fe961e517..844299e20a49 100644
--- a/connectivity/source/commontools/BlobHelper.cxx
+++ b/connectivity/source/commontools/BlobHelper.cxx
@@ -20,6 +20,7 @@
#include <comphelper/seqstream.hxx>
#include <connectivity/dbexception.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
+#include <o3tl/unreachable.hxx>
using namespace connectivity;
using namespace dbtools;
@@ -47,25 +48,14 @@ css::uno::Reference< css::io::XInputStream > SAL_CALL BlobHelper::getBinaryStrea
return new ::comphelper::SequenceInputStream(m_aValue);
}
-
-// The "return" after a call to throwFeatureNotImplementedSQLException()
-// (which always throws) will be detected as unreachable when doing
-// global inlining.
-
-SAL_WNOUNREACHABLE_CODE_PUSH
-
::sal_Int64 SAL_CALL BlobHelper::position( const css::uno::Sequence< ::sal_Int8 >& /*pattern*/, ::sal_Int64 /*start*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XBlob::position", *this );
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XBlob::position"_ustr, *this );
}
::sal_Int64 SAL_CALL BlobHelper::positionOfBlob( const css::uno::Reference< css::sdbc::XBlob >& /*pattern*/, ::sal_Int64 /*start*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XBlob::positionOfBlob", *this );
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XBlob::positionOfBlob"_ustr, *this );
}
-SAL_WNOUNREACHABLE_CODE_POP
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx
index 223129a71e92..cae16e17eb6e 100644
--- a/connectivity/source/commontools/CommonTools.cxx
+++ b/connectivity/source/commontools/CommonTools.cxx
@@ -29,9 +29,8 @@
#include <osl/diagnose.h>
#include <rtl/character.hxx>
#include <rtl/process.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-using namespace ::comphelper;
static sal_Unicode rtl_ascii_toUpperCase( sal_Unicode ch )
{
return ch >= 0x0061 && ch <= 0x007a ? ch + 0x20 : ch;
@@ -40,8 +39,6 @@ static sal_Unicode rtl_ascii_toUpperCase( sal_Unicode ch )
namespace connectivity
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::java;
using namespace dbtools;
@@ -120,15 +117,15 @@ namespace connectivity
{
Reference< XJavaVM > xVM = JavaVirtualMachine::create(_rxContext);
- Sequence<sal_Int8> processID(16);
- rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(processID.getArray()) );
- processID.realloc(17);
- processID[16] = 0;
+ Sequence<sal_Int8> processID(17); // 16 + 1
+ auto pprocessID = processID.getArray();
+ rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(pprocessID) );
+ pprocessID[16] = 0; // RETURN_VIRTUALMACHINE
Any uaJVM = xVM->getJavaVM( processID );
sal_Int64 nTemp;
if (!(uaJVM >>= nTemp)) {
- throw Exception("cannot get result for getJavaVM", nullptr); // -5
+ throw Exception(u"cannot get result for getJavaVM"_ustr, nullptr); // -5
}
aRet = reinterpret_cast<jvmaccess::VirtualMachine *>(
static_cast<sal_IntPtr>(nTemp));
@@ -165,15 +162,15 @@ namespace connectivity
namespace dbtools
{
-static bool isCharOk(sal_Unicode c,const OUString& _rSpecials)
+static bool isCharOk(sal_Unicode c, std::u16string_view _rSpecials)
{
return ( ((c >= 97) && (c <= 122)) || ((c >= 65) && (c <= 90)) || ((c >= 48) && (c <= 57)) ||
- c == '_' || _rSpecials.indexOf(c) != -1);
+ c == '_' || _rSpecials.find(c) != std::u16string_view::npos);
}
-bool isValidSQLName(const OUString& rName,const OUString& _rSpecials)
+bool isValidSQLName(const OUString& rName, std::u16string_view _rSpecials)
{
// Test for correct naming (in SQL sense)
// This is important for table names for example
@@ -202,7 +199,7 @@ bool isValidSQLName(const OUString& rName,const OUString& _rSpecials)
}
// Creates a new name if necessary
-OUString convertName2SQLName(const OUString& rName,const OUString& _rSpecials)
+OUString convertName2SQLName(const OUString& rName, std::u16string_view _rSpecials)
{
if(isValidSQLName(rName,_rSpecials))
return rName;
@@ -221,10 +218,10 @@ OUString convertName2SQLName(const OUString& rName,const OUString& _rSpecials)
return aNewName.makeStringAndClear();
}
-OUString quoteName(const OUString& _rQuote, const OUString& _rName)
+OUString quoteName(std::u16string_view _rQuote, const OUString& _rName)
{
OUString sName = _rName;
- if( !_rQuote.isEmpty() && _rQuote.toChar() != ' ')
+ if( !_rQuote.empty() && _rQuote[0] != ' ')
sName = _rQuote + _rName + _rQuote;
return sName;
}
diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx
index d7d999058a24..ec244af8130b 100644
--- a/connectivity/source/commontools/ConnectionWrapper.cxx
+++ b/connectivity/source/commontools/ConnectionWrapper.cxx
@@ -25,7 +25,6 @@
#include <comphelper/servicehelper.hxx>
#include <comphelper/hash.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/reflection/ProxyFactory.hpp>
#include <algorithm>
@@ -38,14 +37,16 @@ using namespace com::sun::star::sdbc;
using namespace ::com::sun::star::reflection;
OConnectionWrapper::OConnectionWrapper()
+ : OConnection_BASE(m_aMutex)
{
}
-void OConnectionWrapper::setDelegation(Reference< XAggregation >& _rxProxyConnection,oslInterlockedCount& _rRefCount)
+void OConnectionWrapper::setDelegation(Reference< XAggregation >& _rxProxyConnection)
{
+ // So far only called from constructors
OSL_ENSURE(_rxProxyConnection.is(),"OConnectionWrapper: Connection must be valid!");
- osl_atomic_increment( &_rRefCount );
+ osl_atomic_increment(&m_refCount);
if (_rxProxyConnection.is())
{
// transfer the (one and only) real ref to the aggregate to our member
@@ -61,15 +62,15 @@ void OConnectionWrapper::setDelegation(Reference< XAggregation >& _rxProxyConnec
m_xProxyConnection->setDelegator( xIf );
}
- osl_atomic_decrement( &_rRefCount );
+ osl_atomic_decrement(&m_refCount);
}
void OConnectionWrapper::setDelegation(const Reference< XConnection >& _xConnection
- ,const Reference< XComponentContext>& _rxContext
- ,oslInterlockedCount& _rRefCount)
+ ,const Reference< XComponentContext>& _rxContext)
{
+ // So far only called from constructors
OSL_ENSURE(_xConnection.is(),"OConnectionWrapper: Connection must be valid!");
- osl_atomic_increment( &_rRefCount );
+ osl_atomic_increment(&m_refCount);
m_xConnection = _xConnection;
m_xTypeProvider.set(m_xConnection,UNO_QUERY);
@@ -81,19 +82,21 @@ void OConnectionWrapper::setDelegation(const Reference< XConnection >& _xConnect
if (xConProxy.is())
{
// transfer the (one and only) real ref to the aggregate to our member
- m_xProxyConnection = xConProxy;
+ m_xProxyConnection = std::move(xConProxy);
// set ourself as delegator
Reference<XInterface> xIf = static_cast< XUnoTunnel* >( this );
m_xProxyConnection->setDelegator( xIf );
}
- osl_atomic_decrement( &_rRefCount );
+ osl_atomic_decrement(&m_refCount);
}
void OConnectionWrapper::disposing()
{
-m_xConnection.clear();
+ osl::MutexGuard aGuard(m_aMutex);
+ OConnection_BASE::disposing();
+ m_xConnection.clear();
}
OConnectionWrapper::~OConnectionWrapper()
@@ -106,24 +109,25 @@ OConnectionWrapper::~OConnectionWrapper()
OUString SAL_CALL OConnectionWrapper::getImplementationName( )
{
- return "com.sun.star.sdbc.drivers.OConnectionWrapper";
+ return u"com.sun.star.sdbc.drivers.OConnectionWrapper"_ustr;
}
css::uno::Sequence< OUString > SAL_CALL OConnectionWrapper::getSupportedServiceNames( )
{
+ osl::MutexGuard aGuard(m_aMutex);
// first collect the services which are supported by our aggregate
Sequence< OUString > aSupported;
if ( m_xServiceInfo.is() )
aSupported = m_xServiceInfo->getSupportedServiceNames();
// append our own service, if necessary
- OUString sConnectionService( "com.sun.star.sdbc.Connection" );
+ OUString sConnectionService( u"com.sun.star.sdbc.Connection"_ustr );
if ( ::comphelper::findValue( aSupported, sConnectionService ) == -1 )
{
sal_Int32 nLen = aSupported.getLength();
aSupported.realloc( nLen + 1 );
- aSupported[ nLen ] = sConnectionService;
+ aSupported.getArray()[ nLen ] = sConnectionService;
}
// outta here
@@ -139,12 +143,14 @@ sal_Bool SAL_CALL OConnectionWrapper::supportsService( const OUString& _rService
Any SAL_CALL OConnectionWrapper::queryInterface( const Type& _rType )
{
+ osl::MutexGuard aGuard(m_aMutex);
Any aReturn = OConnection_BASE::queryInterface(_rType);
return aReturn.hasValue() ? aReturn : (m_xProxyConnection.is() ? m_xProxyConnection->queryAggregation(_rType) : aReturn);
}
Sequence< Type > SAL_CALL OConnectionWrapper::getTypes( )
{
+ osl::MutexGuard aGuard(m_aMutex);
return ::comphelper::concatSequences(
OConnection_BASE::getTypes(),
m_xTypeProvider->getTypes()
@@ -154,20 +160,20 @@ Sequence< Type > SAL_CALL OConnectionWrapper::getTypes( )
// css::lang::XUnoTunnel
sal_Int64 SAL_CALL OConnectionWrapper::getSomething( const Sequence< sal_Int8 >& rId )
{
- if (isUnoTunnelId<OConnectionWrapper>(rId))
- return reinterpret_cast< sal_Int64 >( this );
+ if (comphelper::isUnoTunnelId<OConnectionWrapper>(rId))
+ return comphelper::getSomething_cast(this);
+ osl::MutexGuard aGuard(m_aMutex);
if(m_xUnoTunnel.is())
return m_xUnoTunnel->getSomething(rId);
return 0;
}
-Sequence< sal_Int8 > OConnectionWrapper::getUnoTunnelId()
+const Sequence< sal_Int8 > & OConnectionWrapper::getUnoTunnelId()
{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
}
namespace
@@ -195,15 +201,16 @@ void OConnectionWrapper::createUniqueId( const OUString& _rURL
{
// first we create the digest we want to have
::comphelper::Hash sha1(::comphelper::HashType::SHA1);
- sha1.update(reinterpret_cast<unsigned char const*>(_rURL.getStr()), _rURL.getLength() * sizeof(sal_Unicode));
+ sha1.update(_rURL.getStr(), _rURL.getLength() * sizeof(sal_Unicode));
if ( !_rUserName.isEmpty() )
- sha1.update(reinterpret_cast<unsigned char const*>(_rUserName.getStr()), _rUserName.getLength() * sizeof(sal_Unicode));
+ sha1.update(_rUserName.getStr(), _rUserName.getLength() * sizeof(sal_Unicode));
if ( !_rPassword.isEmpty() )
- sha1.update(reinterpret_cast<unsigned char const*>(_rPassword.getStr()), _rPassword.getLength() * sizeof(sal_Unicode));
+ sha1.update(_rPassword.getStr(), _rPassword.getLength() * sizeof(sal_Unicode));
// now we need to sort the properties
- std::sort(_rInfo.begin(),_rInfo.end(),TPropertyValueLessFunctor());
+ auto [begin, end] = asNonConstRange(_rInfo);
+ std::sort(begin,end,TPropertyValueLessFunctor());
- for (PropertyValue const & prop : std::as_const(_rInfo))
+ for (PropertyValue const& prop : _rInfo)
{
// we only include strings an integer values
OUString sValue;
@@ -219,15 +226,15 @@ void OConnectionWrapper::createUniqueId( const OUString& _rURL
Sequence< OUString> aSeq;
if ( prop.Value >>= aSeq )
{
- for(OUString const & s : std::as_const(aSeq))
- sha1.update(reinterpret_cast<unsigned char const*>(s.getStr()), s.getLength() * sizeof(sal_Unicode));
+ for (OUString const& s : aSeq)
+ sha1.update(s.getStr(), s.getLength() * sizeof(sal_Unicode));
}
}
}
if ( !sValue.isEmpty() )
{
// we don't have to convert this into UTF8 because we don't store on a file system
- sha1.update(reinterpret_cast<unsigned char const*>(sValue.getStr()), sValue.getLength() * sizeof(sal_Unicode));
+ sha1.update(sValue.getStr(), sValue.getLength() * sizeof(sal_Unicode));
}
}
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx
index 09b80f62653c..30e9a323dc12 100644
--- a/connectivity/source/commontools/DateConversion.cxx
+++ b/connectivity/source/commontools/DateConversion.cxx
@@ -33,7 +33,7 @@
#include <comphelper/types.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::connectivity;
@@ -62,7 +62,7 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
case DataType::BOOLEAN:
case DataType::TINYINT:
case DataType::SMALLINT:
- if (_rVal.getValueType().getTypeClass() == css::uno::TypeClass_BOOLEAN)
+ if (_rVal.getValueTypeClass() == css::uno::TypeClass_BOOLEAN)
{
if (::cppu::any2bool(_rVal))
aRet.append("1");
@@ -83,16 +83,7 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
{
OUString aTemp;
_rxTypeConverter->convertToSimpleType(_rVal, TypeClass_STRING) >>= aTemp;
- sal_Int32 nIndex = sal_Int32(-2);
- const OUString sQuot("\'");
- do
- {
- nIndex += 2;
- nIndex = aTemp.indexOf(sQuot,nIndex);
- if(nIndex != -1)
- aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), "\'\'");
- } while (nIndex != -1);
-
+ aTemp = aTemp.replaceAll(u"\'", u"\'\'");
aRet.append(aTemp);
}
aRet.append("'");
@@ -113,14 +104,14 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
{
DateTime aDateTime;
bool bOk = false;
- if (_rVal.getValueType().getTypeClass() == css::uno::TypeClass_DOUBLE)
+ if (_rVal.getValueTypeClass() == css::uno::TypeClass_DOUBLE)
{
double nValue = 0.0;
_rVal >>= nValue;
aDateTime = DBTypeConversion::toDateTime(nValue);
bOk = true;
}
- else if (_rVal.getValueType().getTypeClass() == css::uno::TypeClass_STRING)
+ else if (_rVal.getValueTypeClass() == css::uno::TypeClass_STRING)
{
OUString sValue;
_rVal >>= sValue;
@@ -134,9 +125,9 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
// check if this is really a timestamp or only a date
if ( bOk )
{
- aRet.append("{ts '");
- aRet.append(DBTypeConversion::toDateTimeString(aDateTime));
- aRet.append("'}");
+ aRet.append("{ts '"
+ + DBTypeConversion::toDateTimeString(aDateTime)
+ + "'}");
break;
}
break;
@@ -145,14 +136,14 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
{
Date aDate;
bool bOk = false;
- if (_rVal.getValueType().getTypeClass() == css::uno::TypeClass_DOUBLE)
+ if (_rVal.getValueTypeClass() == css::uno::TypeClass_DOUBLE)
{
double nValue = 0.0;
_rVal >>= nValue;
aDate = DBTypeConversion::toDate(nValue);
bOk = true;
}
- else if (_rVal.getValueType().getTypeClass() == css::uno::TypeClass_STRING)
+ else if (_rVal.getValueTypeClass() == css::uno::TypeClass_STRING)
{
OUString sValue;
_rVal >>= sValue;
@@ -162,22 +153,22 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
else
bOk = _rVal >>= aDate;
OSL_ENSURE( bOk, "DBTypeConversion::toSQLString: _rVal is not date!");
- aRet.append("{d '");
- aRet.append(DBTypeConversion::toDateString(aDate));
- aRet.append("'}");
+ aRet.append("{d '"
+ + DBTypeConversion::toDateString(aDate)
+ + "'}");
} break;
case DataType::TIME:
{
css::util::Time aTime;
bool bOk = false;
- if (_rVal.getValueType().getTypeClass() == css::uno::TypeClass_DOUBLE)
+ if (_rVal.getValueTypeClass() == css::uno::TypeClass_DOUBLE)
{
double nValue = 0.0;
_rVal >>= nValue;
aTime = DBTypeConversion::toTime(nValue);
bOk = true;
}
- else if (_rVal.getValueType().getTypeClass() == css::uno::TypeClass_STRING)
+ else if (_rVal.getValueTypeClass() == css::uno::TypeClass_STRING)
{
OUString sValue;
_rVal >>= sValue;
@@ -187,9 +178,9 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
else
bOk = _rVal >>= aTime;
OSL_ENSURE( bOk,"DBTypeConversion::toSQLString: _rVal is not time!");
- aRet.append("{t '");
- aRet.append(DBTypeConversion::toTimeString(aTime));
- aRet.append("'}");
+ aRet.append("{t '"
+ + DBTypeConversion::toTimeString(aTime)
+ + "'}");
} break;
}
}
@@ -212,7 +203,7 @@ Date DBTypeConversion::getNULLDate(const Reference< XNumberFormatsSupplier > &xS
{
// get the null date
Date aDate;
- xSupplier->getNumberFormatSettings()->getPropertyValue("NullDate") >>= aDate;
+ xSupplier->getNumberFormatSettings()->getPropertyValue(u"NullDate"_ustr) >>= aDate;
return aDate;
}
catch ( const Exception& )
@@ -252,7 +243,7 @@ void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant,
if (xFormatProps.is())
{
css::lang::Locale loc;
- if (xFormatProps->getPropertyValue("Locale") >>= loc)
+ if (xFormatProps->getPropertyValue(u"Locale"_ustr) >>= loc)
nStandardKey = xFormatTypes->getStandardIndex(loc);
else
{
@@ -478,7 +469,7 @@ OUString DBTypeConversion::getFormattedValue(const Reference<XColumn>& xVariant,
{
Reference< XNumberFormatsSupplier > xSupplier( xFormatter->getNumberFormatsSupplier(), UNO_SET_THROW );
Reference< XPropertySet > xFormatterSettings( xSupplier->getNumberFormatSettings(), UNO_SET_THROW );
- OSL_VERIFY( xFormatterSettings->getPropertyValue("NullDate") >>= aFormatterNullDate );
+ OSL_VERIFY( xFormatterSettings->getPropertyValue(u"NullDate"_ustr) >>= aFormatterNullDate );
}
catch( const Exception& )
{
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx
index c95d30091184..fac2feb872ed 100644
--- a/connectivity/source/commontools/DriversConfig.cxx
+++ b/connectivity/source/commontools/DriversConfig.cxx
@@ -16,9 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_fuzzers.h>
+
#include <connectivity/DriversConfig.hxx>
+#include <o3tl/string_view.hxx>
#include <tools/wldcrd.hxx>
#include <comphelper/sequence.hxx>
+#include <utility>
using namespace connectivity;
using namespace utl;
@@ -29,13 +33,8 @@ namespace
void lcl_convert(const uno::Sequence< OUString >& _aSource,uno::Any& _rDest)
{
uno::Sequence<uno::Any> aRet(_aSource.getLength());
- uno::Any* pAny = aRet.getArray();
- const OUString* pIter = _aSource.getConstArray();
- const OUString* pEnd = pIter + _aSource.getLength();
- for (;pIter != pEnd ; ++pIter,++pAny)
- {
- *pAny <<= *pIter;
- }
+ std::transform(_aSource.begin(), _aSource.end(), aRet.getArray(),
+ [](auto& str) { return uno::Any(str); });
_rDest <<= aRet;
}
void lcl_fillValues(const ::utl::OConfigurationNode& _aURLPatternNode,const OUString& _sNode,::comphelper::NamedValueCollection& _rValues)
@@ -45,17 +44,14 @@ namespace
return;
uno::Sequence< OUString > aStringSeq;
- const uno::Sequence< OUString > aProperties = aPropertiesNode.getNodeNames();
- const OUString* pPropertiesIter = aProperties.getConstArray();
- const OUString* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
- for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ for (auto& prop : aPropertiesNode.getNodeNames())
{
- uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + "/Value");
+ uno::Any aValue = aPropertiesNode.getNodeValue(prop + "/Value");
if ( aValue >>= aStringSeq )
{
lcl_convert(aStringSeq,aValue);
}
- _rValues.put(*pPropertiesIter,aValue);
+ _rValues.put(prop, aValue);
} // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter,++pNamedIter)
}
void lcl_readURLPatternNode(const ::utl::OConfigurationTreeRoot& _aInstalled,const OUString& _sEntry,TInstalledDriver& _rInstalledDriver)
@@ -65,24 +61,24 @@ namespace
return;
OUString sParentURLPattern;
- aURLPatternNode.getNodeValue("ParentURLPattern") >>= sParentURLPattern;
+ aURLPatternNode.getNodeValue(u"ParentURLPattern"_ustr) >>= sParentURLPattern;
if ( !sParentURLPattern.isEmpty() )
lcl_readURLPatternNode(_aInstalled,sParentURLPattern,_rInstalledDriver);
OUString sDriverFactory;
- aURLPatternNode.getNodeValue("Driver") >>= sDriverFactory;
+ aURLPatternNode.getNodeValue(u"Driver"_ustr) >>= sDriverFactory;
if ( !sDriverFactory.isEmpty() )
_rInstalledDriver.sDriverFactory = sDriverFactory;
OUString sDriverTypeDisplayName;
- aURLPatternNode.getNodeValue("DriverTypeDisplayName") >>= sDriverTypeDisplayName;
+ aURLPatternNode.getNodeValue(u"DriverTypeDisplayName"_ustr) >>= sDriverTypeDisplayName;
OSL_ENSURE(!sDriverTypeDisplayName.isEmpty(),"No valid DriverTypeDisplayName property!");
if ( !sDriverTypeDisplayName.isEmpty() )
_rInstalledDriver.sDriverTypeDisplayName = sDriverTypeDisplayName;
- lcl_fillValues(aURLPatternNode,"Properties",_rInstalledDriver.aProperties);
- lcl_fillValues(aURLPatternNode,"Features",_rInstalledDriver.aFeatures);
- lcl_fillValues(aURLPatternNode,"MetaData",_rInstalledDriver.aMetaData);
+ lcl_fillValues(aURLPatternNode,u"Properties"_ustr,_rInstalledDriver.aProperties);
+ lcl_fillValues(aURLPatternNode,u"Features"_ustr,_rInstalledDriver.aFeatures);
+ lcl_fillValues(aURLPatternNode,u"MetaData"_ustr,_rInstalledDriver.aMetaData);
}
}
@@ -97,28 +93,25 @@ const TInstalledDrivers& DriversConfigImpl::getInstalledDrivers(const uno::Refer
if ( !m_aInstalled.isValid() )
{
m_aInstalled = ::utl::OConfigurationTreeRoot::createWithComponentContext(_rxORB,
- "org.openoffice.Office.DataAccess.Drivers/Installed", -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ u"org.openoffice.Office.DataAccess.Drivers/Installed"_ustr, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
}
if ( m_aInstalled.isValid() )
{
- const uno::Sequence< OUString > aURLPatterns = m_aInstalled.getNodeNames();
- const OUString* pPatternIter = aURLPatterns.getConstArray();
- const OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength();
- for (;pPatternIter != pPatternEnd ; ++pPatternIter)
+ for (auto& pattern : m_aInstalled.getNodeNames())
{
TInstalledDriver aInstalledDriver;
- lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver);
+ lcl_readURLPatternNode(m_aInstalled, pattern, aInstalledDriver);
if ( !aInstalledDriver.sDriverFactory.isEmpty() )
- m_aDrivers.emplace(*pPatternIter,aInstalledDriver);
+ m_aDrivers.emplace(pattern, aInstalledDriver);
}
} // if ( m_aInstalled.isValid() )
}
return m_aDrivers;
}
-DriversConfig::DriversConfig(const uno::Reference< uno::XComponentContext >& _rxORB)
-:m_xORB(_rxORB)
+DriversConfig::DriversConfig(uno::Reference< uno::XComponentContext > _xORB)
+:m_xORB(std::move(_xORB))
{
}
@@ -146,6 +139,11 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs )
OUString DriversConfig::getDriverFactoryName(std::u16string_view _sURL) const
{
+#if ENABLE_FUZZERS
+ if (o3tl::starts_with(_sURL, u"sdbc:dbase:"))
+ return "com.sun.star.comp.sdbc.dbase.ODriver";
+#endif
+
const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB);
OUString sRet;
OUString sOldPattern;
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
index 24be4d72a6ce..b2f7f8d86e51 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
@@ -27,6 +27,7 @@
#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <connectivity/dbexception.hxx>
+#include <o3tl/safeint.hxx>
#include <o3tl/unreachable.hxx>
#include <TConnection.hxx>
@@ -36,16 +37,13 @@ using namespace cppu;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet()
- :ODatabaseMetaDataResultSet_BASE(m_aMutex)
- ,::comphelper::OPropertyContainer(ODatabaseMetaDataResultSet_BASE::rBHelper)
- ,m_aStatement(nullptr)
- ,m_nColPos(0)
+ :
+ m_nColPos(0)
,m_bBOF(true)
,m_bEOF(true)
{
@@ -54,10 +52,8 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet()
ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet( MetaDataResultSetType _eType )
- :ODatabaseMetaDataResultSet_BASE(m_aMutex)
- ,::comphelper::OPropertyContainer(ODatabaseMetaDataResultSet_BASE::rBHelper)
- ,m_aStatement(nullptr)
- ,m_nColPos(0)
+ :
+ m_nColPos(0)
,m_bBOF(true)
,m_bEOF(true)
{
@@ -106,24 +102,22 @@ void ODatabaseMetaDataResultSet::setType(MetaDataResultSetType _eType)
}
}
-void ODatabaseMetaDataResultSet::disposing()
+void ODatabaseMetaDataResultSet::disposing(std::unique_lock<std::mutex>& rGuard)
{
- OPropertySetHelper::disposing();
+ OPropertySetHelper::disposing(rGuard);
- ::osl::MutexGuard aGuard(m_aMutex);
- m_aStatement = nullptr;
m_xMetaData.clear();
m_aRowsIter = m_aRows.end();
m_aRows.clear();
m_aRowsIter = m_aRows.end();
}
-void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw()
+void SAL_CALL ODatabaseMetaDataResultSet::acquire() noexcept
{
ODatabaseMetaDataResultSet_BASE::acquire();
}
-void SAL_CALL ODatabaseMetaDataResultSet::release() throw()
+void SAL_CALL ODatabaseMetaDataResultSet::release() noexcept
{
ODatabaseMetaDataResultSet_BASE::release();
}
@@ -143,20 +137,19 @@ Sequence< Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( )
return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes());
}
-void ODatabaseMetaDataResultSet::setRows(const ORows& _rRows)
+void ODatabaseMetaDataResultSet::setRows(ORows&& _rRows)
{
- m_aRows = _rRows;
+ m_aRows = std::move(_rRows);
m_bBOF = true;
m_bEOF = m_aRows.empty();
}
sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& columnName )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
+ std::unique_lock aGuard( m_aMutex );
+ throwIfDisposed(aGuard);
-
- Reference< XResultSetMetaData > xMeta = getMetaData();
+ Reference< XResultSetMetaData > xMeta = getMetaData(aGuard);
sal_Int32 nLen = xMeta->getColumnCount();
sal_Int32 i = 1;
for(;i<=nLen;++i)
@@ -168,12 +161,11 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& colum
}
::dbtools::throwInvalidColumnException( columnName, *this );
- O3TL_UNREACHABLE;
}
-void ODatabaseMetaDataResultSet::checkIndex(sal_Int32 columnIndex )
+void ODatabaseMetaDataResultSet::checkIndex(std::unique_lock<std::mutex>& /*rGuard*/, sal_Int32 columnIndex )
{
- if(columnIndex >= static_cast<sal_Int32>((*m_aRowsIter).size()) || columnIndex < 1)
+ if(columnIndex < 1 || o3tl::make_unsigned(columnIndex) >= (*m_aRowsIter).size())
::dbtools::throwInvalidIndexException(*this);
}
@@ -190,43 +182,43 @@ Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getChara
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex )
{
- return bool(getValue(columnIndex));
+ return getValue(columnIndex).getBool();
}
sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt8();
}
Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getSequence();
}
css::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDate();
}
double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDouble();
}
float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getFloat();
}
sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt32();
}
@@ -238,15 +230,19 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( )
sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getLong();
}
Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
+ std::unique_lock aGuard( m_aMutex );
+ return getMetaData(aGuard);
+}
+Reference< XResultSetMetaData > ODatabaseMetaDataResultSet::getMetaData( std::unique_lock<std::mutex>& rGuard )
+{
+ throwIfDisposed(rGuard);
if(!m_xMetaData.is())
m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
@@ -285,51 +281,48 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const
sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt16();
}
OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getString();
}
css::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDateTime();
}
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( )
+sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast()
{
return m_bEOF;
}
-
-SAL_WNOUNREACHABLE_CODE_PUSH
+bool ODatabaseMetaDataResultSet::isAfterLast( std::unique_lock<std::mutex>& /*rGuard*/)
+{
+ return m_bEOF;
+}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
-SAL_WNOUNREACHABLE_CODE_POP
-
-
void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( )
{
::dbtools::throwFunctionSequenceException(*this);
@@ -344,89 +337,76 @@ void SAL_CALL ODatabaseMetaDataResultSet::afterLast( )
void SAL_CALL ODatabaseMetaDataResultSet::close( )
{
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
-
+ std::unique_lock aGuard( m_aMutex );
+ throwIfDisposed(aGuard);
}
dispose();
}
-
-SAL_WNOUNREACHABLE_CODE_PUSH
-
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
-
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 /*row*/ )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 /*row*/ )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
-SAL_WNOUNREACHABLE_CODE_POP
-
-
Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( )
{
- return m_aStatement.get();
+ return nullptr;
}
-
-SAL_WNOUNREACHABLE_CODE_PUSH
-
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
}
-SAL_WNOUNREACHABLE_CODE_POP
-
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( )
+sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst()
{
return m_bBOF;
}
+bool ODatabaseMetaDataResultSet::isBeforeFirst(std::unique_lock<std::mutex>& /*rGuard*/)
+{
+ return m_bBOF;
+}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
+ std::unique_lock aGuard( m_aMutex );
+ return next(aGuard);
+}
+
+bool ODatabaseMetaDataResultSet::next( std::unique_lock<std::mutex>& rGuard )
+{
+ throwIfDisposed(rGuard);
if ( m_bBOF )
{
@@ -454,9 +434,8 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( )
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
-
+ std::unique_lock aGuard( m_aMutex );
+ throwIfDisposed(aGuard);
if(m_aRowsIter == m_aRows.end() || !(*m_aRowsIter)[m_nColPos].is())
return true;
@@ -496,130 +475,110 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( )
void ODatabaseMetaDataResultSet::setProceduresMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setProceduresMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setProceduresMap();
}
void ODatabaseMetaDataResultSet::setCatalogsMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setCatalogsMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setCatalogsMap();
}
void ODatabaseMetaDataResultSet::setSchemasMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setSchemasMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setSchemasMap();
}
void ODatabaseMetaDataResultSet::setColumnPrivilegesMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setColumnPrivilegesMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setColumnPrivilegesMap();
}
void ODatabaseMetaDataResultSet::setColumnsMap()
{
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setColumnsMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setColumnsMap();
}
void ODatabaseMetaDataResultSet::setTablesMap()
{
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setTablesMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setTablesMap();
}
void ODatabaseMetaDataResultSet::setProcedureColumnsMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setProcedureColumnsMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setProcedureColumnsMap();
}
void ODatabaseMetaDataResultSet::setPrimaryKeysMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setPrimaryKeysMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setPrimaryKeysMap();
}
void ODatabaseMetaDataResultSet::setIndexInfoMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setIndexInfoMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setIndexInfoMap();
}
void ODatabaseMetaDataResultSet::setTablePrivilegesMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setTablePrivilegesMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setTablePrivilegesMap();
}
void ODatabaseMetaDataResultSet::setCrossReferenceMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setCrossReferenceMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setCrossReferenceMap();
}
void ODatabaseMetaDataResultSet::setVersionColumnsMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setVersionColumnsMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setVersionColumnsMap();
}
void ODatabaseMetaDataResultSet::setBestRowIdentifierMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setBestRowIdentifierMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setBestRowIdentifierMap();
}
void ODatabaseMetaDataResultSet::setTypeInfoMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setTypeInfoMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setTypeInfoMap();
}
void ODatabaseMetaDataResultSet::setUDTsMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setUDTsMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setUDTsMap();
}
void ODatabaseMetaDataResultSet::setTableTypes()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setTableTypes();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setTableTypes();
}
void ODatabaseMetaDataResultSet::setExportedKeysMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setExportedKeysMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setExportedKeysMap();
}
void ODatabaseMetaDataResultSet::setImportedKeysMap()
{
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
- pMetaData->setImportedKeysMap();
- m_xMetaData = pMetaData;
+ m_xMetaData = new ODatabaseMetaDataResultSetMetaData();
+ m_xMetaData->setImportedKeysMap();
}
Reference< css::beans::XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( )
@@ -635,13 +594,13 @@ ORowSetValueDecorator& ORowSetValueDecorator::operator=(const ORowSetValue& _aVa
const ORowSetValue& ODatabaseMetaDataResultSet::getValue(sal_Int32 columnIndex)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
+ std::unique_lock aGuard( m_aMutex );
+ throwIfDisposed(aGuard);
- if ( isBeforeFirst() || isAfterLast() )
+ if ( isBeforeFirst(aGuard) || isAfterLast(aGuard) )
::dbtools::throwFunctionSequenceException( *this );
- checkIndex(columnIndex );
+ checkIndex(aGuard, columnIndex);
m_nColPos = columnIndex;
if(m_aRowsIter != m_aRows.end() && (*m_aRowsIter)[columnIndex].is())
@@ -679,55 +638,55 @@ ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getBasicValue()
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getSelectValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("SELECT"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"SELECT"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getInsertValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("INSERT"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"INSERT"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getDeleteValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("DELETE"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"DELETE"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getUpdateValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("UPDATE"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"UPDATE"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getCreateValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("CREATE"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"CREATE"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getReadValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("READ"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"READ"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getAlterValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("ALTER"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"ALTER"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getDropValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("DROP"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"DROP"_ustr);
return aValueRef;
}
ORowSetValueDecoratorRef const & ODatabaseMetaDataResultSet::getQuoteValue()
{
- static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(OUString("'"));
+ static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(u"'"_ustr);
return aValueRef;
}
@@ -746,29 +705,25 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
return;
ORows aRowsToSet;
- const Sequence<Any>* pRowsIter = aRows.getConstArray();
- const Sequence<Any>* pRowsEnd = pRowsIter + aRows.getLength();
- for (; pRowsIter != pRowsEnd;++pRowsIter)
+ for (auto& row : aRows)
{
ORow aRowToSet;
- const Any* pRowIter = pRowsIter->getConstArray();
- const Any* pRowEnd = pRowIter + pRowsIter->getLength();
- for (; pRowIter != pRowEnd;++pRowIter)
+ for (auto& field : row)
{
ORowSetValueDecoratorRef aValue;
- switch( pRowIter->getValueTypeClass() )
+ switch (field.getValueTypeClass())
{
case TypeClass_BOOLEAN:
{
bool bValue = false;
- *pRowIter >>= bValue;
+ field >>= bValue;
aValue = new ORowSetValueDecorator(ORowSetValue(bValue));
}
break;
case TypeClass_BYTE:
{
sal_Int8 nValue(0);
- *pRowIter >>= nValue;
+ field >>= nValue;
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
}
break;
@@ -776,7 +731,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
case TypeClass_UNSIGNED_SHORT:
{
sal_Int16 nValue(0);
- *pRowIter >>= nValue;
+ field >>= nValue;
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
}
break;
@@ -784,7 +739,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
case TypeClass_UNSIGNED_LONG:
{
sal_Int32 nValue(0);
- *pRowIter >>= nValue;
+ field >>= nValue;
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
}
break;
@@ -792,28 +747,28 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
case TypeClass_UNSIGNED_HYPER:
{
sal_Int64 nValue(0);
- *pRowIter >>= nValue;
+ field >>= nValue;
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
}
break;
case TypeClass_FLOAT:
{
float nValue(0.0);
- *pRowIter >>= nValue;
+ field >>= nValue;
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
}
break;
case TypeClass_DOUBLE:
{
double nValue(0.0);
- *pRowIter >>= nValue;
+ field >>= nValue;
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
}
break;
case TypeClass_STRING:
{
OUString sValue;
- *pRowIter >>= sValue;
+ field >>= sValue;
aValue = new ORowSetValueDecorator(ORowSetValue(sValue));
}
break;
@@ -824,14 +779,14 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
}
aRowsToSet.push_back(aRowToSet);
} // for (; pRowsIter != pRowsEnd;++pRowsIter
- setRows(aRowsToSet);
+ setRows(std::move(aRowsToSet));
}
// XServiceInfo
OUString SAL_CALL ODatabaseMetaDataResultSet::getImplementationName( )
{
- return "org.openoffice.comp.helper.DatabaseMetaDataResultSet";
+ return u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::supportsService( const OUString& _rServiceName )
@@ -841,7 +796,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
Sequence< OUString > SAL_CALL ODatabaseMetaDataResultSet::getSupportedServiceNames( )
{
- return Sequence<OUString>{ "com.sun.star.sdbc.ResultSet" };
+ return Sequence<OUString>{ u"com.sun.star.sdbc.ResultSet"_ustr };
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
index 561953a0796c..02c0a402a0fc 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
@@ -22,9 +22,7 @@
#include <com/sun/star/sdbc/ColumnValue.hpp>
using namespace connectivity;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
ODatabaseMetaDataResultSetMetaData::~ODatabaseMetaDataResultSetMetaData()
{
@@ -167,191 +165,191 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isWritable( sal_Int32 colu
void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap()
{
setColumnMap();
- m_mColumns[5] = OColumn(OUString(),"GRANTOR", ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
- m_mColumns[6] = OColumn(OUString(),"GRANTEE", ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
- m_mColumns[7] = OColumn(OUString(),"PRIVILEGE", ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
- m_mColumns[8] = OColumn(OUString(),"IS_GRANTABLE", ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"GRANTOR"_ustr, ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
+ m_mColumns[6] = OColumn(OUString(),u"GRANTEE"_ustr, ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
+ m_mColumns[7] = OColumn(OUString(),u"PRIVILEGE"_ustr, ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
+ m_mColumns[8] = OColumn(OUString(),u"IS_GRANTABLE"_ustr, ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setTableNameMap()
{
- m_mColumns[1] = OColumn(OUString(),"TABLE_CAT", ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
- m_mColumns[2] = OColumn(OUString(),"TABLE_SCHEM", ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
- m_mColumns[3] = OColumn(OUString(),"TABLE_NAME", ColumnValue::NO_NULLS, 3,3,0, DataType::VARCHAR);
+ m_mColumns[1] = OColumn(OUString(),u"TABLE_CAT"_ustr, ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
+ m_mColumns[2] = OColumn(OUString(),u"TABLE_SCHEM"_ustr, ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR);
+ m_mColumns[3] = OColumn(OUString(),u"TABLE_NAME"_ustr, ColumnValue::NO_NULLS, 3,3,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setColumnMap()
{
setTableNameMap();
- m_mColumns[4] = OColumn(OUString(),"COLUMN_NAME", ColumnValue::NO_NULLS, 3,3,0, DataType::VARCHAR);
+ m_mColumns[4] = OColumn(OUString(),u"COLUMN_NAME"_ustr, ColumnValue::NO_NULLS, 3,3,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setColumnsMap()
{
setColumnMap();
- m_mColumns[5] = OColumn(OUString(),"DATA_TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[6] = OColumn(OUString(),"TYPE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[7] = OColumn(OUString(),"COLUMN_SIZE", ColumnValue::NO_NULLS, 3,3,0, DataType::INTEGER);
- m_mColumns[8] = OColumn(OUString(),"BUFFER_LENGTH", ColumnValue::NULLABLE, 3,3,0, DataType::INTEGER);
- m_mColumns[9] = OColumn(OUString(),"DECIMAL_DIGITS", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[10] = OColumn(OUString(),"NUM_PREC_RADIX", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[11] = OColumn(OUString(),"NULLABLE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[12] = OColumn(OUString(),"REMARKS", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[13] = OColumn(OUString(),"COLUMN_DEF", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[14] = OColumn(OUString(),"SQL_DATA_TYPE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[15] = OColumn(OUString(),"SQL_DATETIME_SUB", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[16] = OColumn(OUString(),"CHAR_OCTET_LENGTH", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[17] = OColumn(OUString(),"ORDINAL_POSITION", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[18] = OColumn(OUString(),"IS_NULLABLE", ColumnValue::NO_NULLS, 1,1,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"DATA_TYPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[6] = OColumn(OUString(),u"TYPE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[7] = OColumn(OUString(),u"COLUMN_SIZE"_ustr, ColumnValue::NO_NULLS, 3,3,0, DataType::INTEGER);
+ m_mColumns[8] = OColumn(OUString(),u"BUFFER_LENGTH"_ustr, ColumnValue::NULLABLE, 3,3,0, DataType::INTEGER);
+ m_mColumns[9] = OColumn(OUString(),u"DECIMAL_DIGITS"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[10] = OColumn(OUString(),u"NUM_PREC_RADIX"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[11] = OColumn(OUString(),u"NULLABLE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[12] = OColumn(OUString(),u"REMARKS"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[13] = OColumn(OUString(),u"COLUMN_DEF"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[14] = OColumn(OUString(),u"SQL_DATA_TYPE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[15] = OColumn(OUString(),u"SQL_DATETIME_SUB"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[16] = OColumn(OUString(),u"CHAR_OCTET_LENGTH"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[17] = OColumn(OUString(),u"ORDINAL_POSITION"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[18] = OColumn(OUString(),u"IS_NULLABLE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setTablesMap()
{
setTableNameMap();
- m_mColumns[4] = OColumn(OUString(),"TABLE_TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"REMARKS", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[4] = OColumn(OUString(),u"TABLE_TYPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"REMARKS"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setProcedureNameMap()
{
- m_mColumns[1] = OColumn(OUString(),"PROCEDURE_CAT", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[2] = OColumn(OUString(),"PROCEDURE_SCHEM", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[3] = OColumn(OUString(),"PROCEDURE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[1] = OColumn(OUString(),u"PROCEDURE_CAT"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[2] = OColumn(OUString(),u"PROCEDURE_SCHEM"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[3] = OColumn(OUString(),u"PROCEDURE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap()
{
setProcedureNameMap();
- m_mColumns[4] = OColumn(OUString(),"COLUMN_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"COLUMN_TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[6] = OColumn(OUString(),"DATA_TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[7] = OColumn(OUString(),"TYPE_NAME", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[8] = OColumn(OUString(),"PRECISION", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[9] = OColumn(OUString(),"LENGTH", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[10] = OColumn(OUString(),"SCALE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[11] = OColumn(OUString(),"RADIX", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[12] = OColumn(OUString(),"NULLABLE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[13] = OColumn(OUString(),"REMARKS", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[4] = OColumn(OUString(),u"COLUMN_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"COLUMN_TYPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[6] = OColumn(OUString(),u"DATA_TYPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[7] = OColumn(OUString(),u"TYPE_NAME"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[8] = OColumn(OUString(),u"PRECISION"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[9] = OColumn(OUString(),u"LENGTH"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[10] = OColumn(OUString(),u"SCALE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[11] = OColumn(OUString(),u"RADIX"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[12] = OColumn(OUString(),u"NULLABLE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[13] = OColumn(OUString(),u"REMARKS"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap()
{
setColumnMap();
- m_mColumns[5] = OColumn(OUString(),"KEY_SEQ", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[6] = OColumn(OUString(),"PK_NAME", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"KEY_SEQ"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[6] = OColumn(OUString(),u"PK_NAME"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap()
{
setTableNameMap();
- m_mColumns[4] = OColumn(OUString(),"NON_UNIQUE", ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
- m_mColumns[5] = OColumn(OUString(),"INDEX_QUALIFIER", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[6] = OColumn(OUString(),"INDEX_NAME", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[7] = OColumn(OUString(),"TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[8] = OColumn(OUString(),"ORDINAL_POSITION", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[9] = OColumn(OUString(),"COLUMN_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[10] = OColumn(OUString(),"ASC_OR_DESC", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[11] = OColumn(OUString(),"CARDINALITY", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[12] = OColumn(OUString(),"PAGES", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[13] = OColumn(OUString(),"FILTER_CONDITION", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[4] = OColumn(OUString(),u"NON_UNIQUE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
+ m_mColumns[5] = OColumn(OUString(),u"INDEX_QUALIFIER"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[6] = OColumn(OUString(),u"INDEX_NAME"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[7] = OColumn(OUString(),u"TYPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[8] = OColumn(OUString(),u"ORDINAL_POSITION"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[9] = OColumn(OUString(),u"COLUMN_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[10] = OColumn(OUString(),u"ASC_OR_DESC"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[11] = OColumn(OUString(),u"CARDINALITY"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[12] = OColumn(OUString(),u"PAGES"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[13] = OColumn(OUString(),u"FILTER_CONDITION"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap()
{
setTableNameMap();
- m_mColumns[4] = OColumn(OUString(),"GRANTOR", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"GRANTEE", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[6] = OColumn(OUString(),"PRIVILEGE", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[7] = OColumn(OUString(),"IS_GRANTABLE", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[4] = OColumn(OUString(),u"GRANTOR"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"GRANTEE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[6] = OColumn(OUString(),u"PRIVILEGE"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[7] = OColumn(OUString(),u"IS_GRANTABLE"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap()
{
- m_mColumns[1] = OColumn(OUString(),"PKTABLE_CAT", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[2] = OColumn(OUString(),"PKTABLE_SCHEM", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[3] = OColumn(OUString(),"PKTABLE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[4] = OColumn(OUString(),"PKCOLUMN_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"FKTABLE_CAT", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[6] = OColumn(OUString(),"FKTABLE_SCHEM", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[7] = OColumn(OUString(),"FKTABLE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[8] = OColumn(OUString(),"FKCOLUMN_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[1] = OColumn(OUString(),u"PKTABLE_CAT"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[2] = OColumn(OUString(),u"PKTABLE_SCHEM"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[3] = OColumn(OUString(),u"PKTABLE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[4] = OColumn(OUString(),u"PKCOLUMN_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"FKTABLE_CAT"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[6] = OColumn(OUString(),u"FKTABLE_SCHEM"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[7] = OColumn(OUString(),u"FKTABLE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[8] = OColumn(OUString(),u"FKCOLUMN_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[9] = OColumn(OUString(),"KEY_SEQ", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[10] = OColumn(OUString(),"UPDATE_RULE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[11] = OColumn(OUString(),"DELETE_RULE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[12] = OColumn(OUString(),"FK_NAME", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[13] = OColumn(OUString(),"PK_NAME", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[14] = OColumn(OUString(),"DEFERRABILITY", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[9] = OColumn(OUString(),u"KEY_SEQ"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[10] = OColumn(OUString(),u"UPDATE_RULE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[11] = OColumn(OUString(),u"DELETE_RULE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[12] = OColumn(OUString(),u"FK_NAME"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[13] = OColumn(OUString(),u"PK_NAME"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[14] = OColumn(OUString(),u"DEFERRABILITY"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
}
void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap()
{
- m_mColumns[1] = OColumn(OUString(),"TYPE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[2] = OColumn(OUString(),"DATA_TYPE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[3] = OColumn(OUString(),"PRECISION", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[4] = OColumn(OUString(),"LITERAL_PREFIX", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"LITERAL_SUFFIX", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[6] = OColumn(OUString(),"CREATE_PARAMS", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[7] = OColumn(OUString(),"NULLABLE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[8] = OColumn(OUString(),"CASE_SENSITIVE", ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
- m_mColumns[9] = OColumn(OUString(),"SEARCHABLE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[10] = OColumn(OUString(),"UNSIGNED_ATTRIBUTE", ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
- m_mColumns[11] = OColumn(OUString(),"FIXED_PREC_SCALE", ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
- m_mColumns[12] = OColumn(OUString(),"AUTO_INCREMENT", ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
- m_mColumns[13] = OColumn(OUString(),"LOCAL_TYPE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[14] = OColumn(OUString(),"MINIMUM_SCALE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[15] = OColumn(OUString(),"MAXIMUM_SCALE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[16] = OColumn(OUString(),"SQL_DATA_TYPE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[17] = OColumn(OUString(),"SQL_DATETIME_SUB", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
- m_mColumns[18] = OColumn(OUString(),"NUM_PREC_RADIX", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[1] = OColumn(OUString(),u"TYPE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[2] = OColumn(OUString(),u"DATA_TYPE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[3] = OColumn(OUString(),u"PRECISION"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[4] = OColumn(OUString(),u"LITERAL_PREFIX"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"LITERAL_SUFFIX"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[6] = OColumn(OUString(),u"CREATE_PARAMS"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[7] = OColumn(OUString(),u"NULLABLE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[8] = OColumn(OUString(),u"CASE_SENSITIVE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
+ m_mColumns[9] = OColumn(OUString(),u"SEARCHABLE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[10] = OColumn(OUString(),u"UNSIGNED_ATTRIBUTE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
+ m_mColumns[11] = OColumn(OUString(),u"FIXED_PREC_SCALE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
+ m_mColumns[12] = OColumn(OUString(),u"AUTO_INCREMENT"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::BIT);
+ m_mColumns[13] = OColumn(OUString(),u"LOCAL_TYPE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[14] = OColumn(OUString(),u"MINIMUM_SCALE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[15] = OColumn(OUString(),u"MAXIMUM_SCALE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[16] = OColumn(OUString(),u"SQL_DATA_TYPE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[17] = OColumn(OUString(),u"SQL_DATETIME_SUB"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[18] = OColumn(OUString(),u"NUM_PREC_RADIX"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
}
void ODatabaseMetaDataResultSetMetaData::setProceduresMap()
{
setProcedureNameMap();
- m_mColumns[4] = OColumn(OUString(),"RESERVED1", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"RESERVED2", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[6] = OColumn(OUString(),"RESERVED3", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[7] = OColumn(OUString(),"REMARKS", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[8] = OColumn(OUString(),"PROCEDURE_TYPE", ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
+ m_mColumns[4] = OColumn(OUString(),u"RESERVED1"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"RESERVED2"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[6] = OColumn(OUString(),u"RESERVED3"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[7] = OColumn(OUString(),u"REMARKS"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[8] = OColumn(OUString(),u"PROCEDURE_TYPE"_ustr, ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER);
}
void ODatabaseMetaDataResultSetMetaData::setTableTypes()
{
- m_mColumns[1] = OColumn(OUString(),"TABLE_TYPE", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[1] = OColumn(OUString(),u"TABLE_TYPE"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setCatalogsMap()
{
- m_mColumns[1] = OColumn(OUString(),"TABLE_CAT", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[1] = OColumn(OUString(),u"TABLE_CAT"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setSchemasMap()
{
- m_mColumns[1] = OColumn(OUString(),"TABLE_SCHEM", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[1] = OColumn(OUString(),u"TABLE_SCHEM"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
}
void ODatabaseMetaDataResultSetMetaData::setVersionColumnsMap()
{
- m_mColumns[1] = OColumn(OUString(),"SCOPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[2] = OColumn(OUString(),"COLUMN_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[3] = OColumn(OUString(),"DATA_TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[4] = OColumn(OUString(),"TYPE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"COLUMN_SIZE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[6] = OColumn(OUString(),"BUFFER_LENGTH", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
- m_mColumns[7] = OColumn(OUString(),"DECIMAL_DIGITS", ColumnValue::NULLABLE, 0,0,0, DataType::INTEGER);
- m_mColumns[8] = OColumn(OUString(),"PSEUDO_COLUMN", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[1] = OColumn(OUString(),u"SCOPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[2] = OColumn(OUString(),u"COLUMN_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[3] = OColumn(OUString(),u"DATA_TYPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[4] = OColumn(OUString(),u"TYPE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"COLUMN_SIZE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[6] = OColumn(OUString(),u"BUFFER_LENGTH"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+ m_mColumns[7] = OColumn(OUString(),u"DECIMAL_DIGITS"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::INTEGER);
+ m_mColumns[8] = OColumn(OUString(),u"PSEUDO_COLUMN"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
}
void ODatabaseMetaDataResultSetMetaData::setUDTsMap()
{
- m_mColumns[1] = OColumn(OUString(),"TYPE_CAT", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[2] = OColumn(OUString(),"TYPE_SCHEM", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
- m_mColumns[3] = OColumn(OUString(),"TYPE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[4] = OColumn(OUString(),"CLASS_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[5] = OColumn(OUString(),"DATA_TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
- m_mColumns[6] = OColumn(OUString(),"REMARKS", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[1] = OColumn(OUString(),u"TYPE_CAT"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[2] = OColumn(OUString(),u"TYPE_SCHEM"_ustr, ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+ m_mColumns[3] = OColumn(OUString(),u"TYPE_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[4] = OColumn(OUString(),u"CLASS_NAME"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[5] = OColumn(OUString(),u"DATA_TYPE"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+ m_mColumns[6] = OColumn(OUString(),u"REMARKS"_ustr, ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 2f1cabbd4520..cd47492326c9 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -818,8 +818,6 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- bRet = false;
- break;
case DataType::BLOB:
case DataType::CLOB:
case DataType::OBJECT:
@@ -860,21 +858,21 @@ Any ORowSetValue::makeAny() const
rValue <<= m_aValue.m_nDouble;
break;
case DataType::DATE:
- OSL_ENSURE(m_aValue.m_pValue,"Value is null!");
+ assert(m_aValue.m_pValue && "Value is null!");
rValue <<= *static_cast<Date*>(m_aValue.m_pValue);
break;
case DataType::TIME:
- OSL_ENSURE(m_aValue.m_pValue,"Value is null!");
+ assert(m_aValue.m_pValue && "Value is null!");
rValue <<= *static_cast<Time*>(m_aValue.m_pValue);
break;
case DataType::TIMESTAMP:
- OSL_ENSURE(m_aValue.m_pValue,"Value is null!");
+ assert(m_aValue.m_pValue && "Value is null!");
rValue <<= *static_cast<DateTime*>(m_aValue.m_pValue);
break;
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- OSL_ENSURE(m_aValue.m_pValue,"Value is null!");
+ assert(m_aValue.m_pValue && "Value is null!");
rValue <<= *static_cast<Sequence<sal_Int8>*>(m_aValue.m_pValue);
break;
case DataType::BLOB:
@@ -945,53 +943,50 @@ OUString ORowSetValue::getString( ) const
aRet = m_aValue.m_pString;
break;
case DataType::FLOAT:
- aRet = OUString::number(static_cast<float>(*this));
+ aRet = OUString::number(getFloat());
break;
case DataType::DOUBLE:
case DataType::REAL:
- aRet = OUString::number(static_cast<double>(*this));
+ aRet = OUString::number(getDouble());
break;
case DataType::DATE:
- aRet = DBTypeConversion::toDateString(*this);
+ aRet = DBTypeConversion::toDateString(getDate());
break;
case DataType::TIME:
- aRet = DBTypeConversion::toTimeString(*this);
+ aRet = DBTypeConversion::toTimeString(getTime());
break;
case DataType::TIMESTAMP:
- aRet = DBTypeConversion::toDateTimeString(*this);
+ aRet = DBTypeConversion::toDateTimeString(getDateTime());
break;
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
{
OUStringBuffer sVal("0x");
- Sequence<sal_Int8> aSeq(getSequence());
- const sal_Int8* pBegin = aSeq.getConstArray();
- const sal_Int8* pEnd = pBegin + aSeq.getLength();
- for(;pBegin != pEnd;++pBegin)
- sVal.append(static_cast<sal_Int32>(*pBegin),16);
+ for (sal_Int32 byte : getSequence())
+ sVal.append(byte, 16);
aRet = sVal.makeStringAndClear();
}
break;
case DataType::BIT:
- aRet = OUString::number(int(static_cast<bool>(*this)));
+ aRet = OUString::number(int(getBool()));
break;
case DataType::BOOLEAN:
- aRet = OUString::boolean(static_cast<bool>(*this));
+ aRet = OUString::boolean(getBool());
break;
case DataType::TINYINT:
case DataType::SMALLINT:
case DataType::INTEGER:
if ( m_bSigned )
- aRet = OUString::number(static_cast<sal_Int32>(*this));
+ aRet = OUString::number(getInt32());
else
- aRet = OUString::number(static_cast<sal_uInt32>(*this));
+ aRet = OUString::number(getUInt32());
break;
case DataType::BIGINT:
if ( m_bSigned )
- aRet = OUString::number(static_cast<sal_Int64>(*this));
+ aRet = OUString::number(getLong());
else
- aRet = OUString::number(static_cast<sal_uInt64>(*this));
+ aRet = OUString::number(getULong());
break;
case DataType::CLOB:
{
@@ -1041,7 +1036,7 @@ bool ORowSetValue::getBool() const
case DataType::DECIMAL:
case DataType::NUMERIC:
- bRet = OUString(m_aValue.m_pString).toInt32() != 0;
+ bRet = OUString::unacquired(&m_aValue.m_pString).toInt32() != 0;
break;
case DataType::FLOAT:
bRet = m_aValue.m_nFloat != 0.0;
@@ -1098,7 +1093,7 @@ sal_Int8 ORowSetValue::getInt8() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = sal_Int8(OUString(m_aValue.m_pString).toInt32());
+ nRet = sal_Int8(OUString::unacquired(&m_aValue.m_pString).toInt32());
break;
case DataType::FLOAT:
nRet = sal_Int8(m_aValue.m_nFloat);
@@ -1169,7 +1164,7 @@ sal_uInt8 ORowSetValue::getUInt8() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = sal_uInt8(OUString(m_aValue.m_pString).toInt32());
+ nRet = sal_uInt8(OUString::unacquired(&m_aValue.m_pString).toInt32());
break;
case DataType::FLOAT:
nRet = sal_uInt8(m_aValue.m_nFloat);
@@ -1244,7 +1239,7 @@ sal_Int16 ORowSetValue::getInt16() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = sal_Int16(OUString(m_aValue.m_pString).toInt32());
+ nRet = sal_Int16(OUString::unacquired(&m_aValue.m_pString).toInt32());
break;
case DataType::FLOAT:
nRet = sal_Int16(m_aValue.m_nFloat);
@@ -1315,7 +1310,7 @@ sal_uInt16 ORowSetValue::getUInt16() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = sal_uInt16(OUString(m_aValue.m_pString).toInt32());
+ nRet = sal_uInt16(OUString::unacquired(&m_aValue.m_pString).toInt32());
break;
case DataType::FLOAT:
nRet = sal_uInt16(m_aValue.m_nFloat);
@@ -1386,7 +1381,7 @@ sal_Int32 ORowSetValue::getInt32() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = OUString(m_aValue.m_pString).toInt32();
+ nRet = OUString::unacquired(&m_aValue.m_pString).toInt32();
break;
case DataType::FLOAT:
nRet = sal_Int32(m_aValue.m_nFloat);
@@ -1459,7 +1454,7 @@ sal_uInt32 ORowSetValue::getUInt32() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = OUString(m_aValue.m_pString).toUInt32();
+ nRet = OUString::unacquired(&m_aValue.m_pString).toUInt32();
break;
case DataType::FLOAT:
nRet = sal_uInt32(m_aValue.m_nFloat);
@@ -1532,7 +1527,7 @@ sal_Int64 ORowSetValue::getLong() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = OUString(m_aValue.m_pString).toInt64();
+ nRet = OUString::unacquired(&m_aValue.m_pString).toInt64();
break;
case DataType::FLOAT:
nRet = sal_Int64(m_aValue.m_nFloat);
@@ -1605,7 +1600,7 @@ sal_uInt64 ORowSetValue::getULong() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = OUString(m_aValue.m_pString).toUInt64();
+ nRet = OUString::unacquired(&m_aValue.m_pString).toUInt64();
break;
case DataType::FLOAT:
nRet = sal_uInt64(m_aValue.m_nFloat);
@@ -1678,7 +1673,7 @@ float ORowSetValue::getFloat() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = OUString(m_aValue.m_pString).toFloat();
+ nRet = OUString::unacquired(&m_aValue.m_pString).toFloat();
break;
case DataType::FLOAT:
nRet = m_aValue.m_nFloat;
@@ -1754,7 +1749,7 @@ double ORowSetValue::getDouble() const
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
- nRet = OUString(m_aValue.m_pString).toDouble();
+ nRet = OUString::unacquired(&m_aValue.m_pString).toDouble();
break;
case DataType::FLOAT:
nRet = m_aValue.m_nFloat;
@@ -1907,7 +1902,7 @@ css::util::Date ORowSetValue::getDate() const
case DataType::FLOAT:
case DataType::DOUBLE:
case DataType::REAL:
- aValue = DBTypeConversion::toDate(static_cast<double>(*this));
+ aValue = DBTypeConversion::toDate(getDouble());
break;
case DataType::DATE:
@@ -1927,7 +1922,7 @@ css::util::Date ORowSetValue::getDate() const
case DataType::SMALLINT:
case DataType::INTEGER:
case DataType::BIGINT:
- aValue = DBTypeConversion::toDate( double( sal_Int64( *this ) ) );
+ aValue = DBTypeConversion::toDate( double( getLong() ) );
break;
case DataType::BLOB:
@@ -1962,12 +1957,10 @@ css::util::Time ORowSetValue::getTime() const
break;
case DataType::DECIMAL:
case DataType::NUMERIC:
- aValue = DBTypeConversion::toTime(static_cast<double>(*this));
- break;
case DataType::FLOAT:
case DataType::DOUBLE:
case DataType::REAL:
- aValue = DBTypeConversion::toTime(static_cast<double>(*this));
+ aValue = DBTypeConversion::toTime(getDouble());
break;
case DataType::TIMESTAMP:
{
@@ -2006,12 +1999,10 @@ css::util::DateTime ORowSetValue::getDateTime() const
break;
case DataType::DECIMAL:
case DataType::NUMERIC:
- aValue = DBTypeConversion::toDateTime(static_cast<double>(*this));
- break;
case DataType::FLOAT:
case DataType::DOUBLE:
case DataType::REAL:
- aValue = DBTypeConversion::toDateTime(static_cast<double>(*this));
+ aValue = DBTypeConversion::toDateTime(getDouble());
break;
case DataType::DATE:
{
@@ -2285,11 +2276,11 @@ void ORowSetValue::impl_fill( const sal_Int32 _nType, bool _bNullable, const det
(*this) = _rValueSource.getLong();
break;
case DataType::CLOB:
- (*this) = css::uno::makeAny(_rValueSource.getClob());
+ (*this) = css::uno::Any(_rValueSource.getClob());
setTypeKind(DataType::CLOB);
break;
case DataType::BLOB:
- (*this) = css::uno::makeAny(_rValueSource.getBlob());
+ (*this) = css::uno::Any(_rValueSource.getBlob());
setTypeKind(DataType::BLOB);
break;
case DataType::OTHER:
@@ -2308,7 +2299,7 @@ void ORowSetValue::impl_fill( const sal_Int32 _nType, bool _bNullable, const det
void ORowSetValue::fill(const Any& _rValue)
{
- switch (_rValue.getValueType().getTypeClass())
+ switch (_rValue.getValueTypeClass())
{
case TypeClass_VOID:
setNull(); break;
diff --git a/connectivity/source/commontools/ParameterSubstitution.cxx b/connectivity/source/commontools/ParameterSubstitution.cxx
index ca96cf331406..e5d08fbe499f 100644
--- a/connectivity/source/commontools/ParameterSubstitution.cxx
+++ b/connectivity/source/commontools/ParameterSubstitution.cxx
@@ -20,6 +20,7 @@
#include <connectivity/sqlparse.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <utility>
namespace connectivity
{
@@ -28,7 +29,7 @@ namespace connectivity
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
- ParameterSubstitution::ParameterSubstitution(const css::uno::Reference< css::uno::XComponentContext >& _rxContext ) : m_xContext(_rxContext)
+ ParameterSubstitution::ParameterSubstitution(css::uno::Reference< css::uno::XComponentContext > _xContext ) : m_xContext(std::move(_xContext))
{
}
void SAL_CALL ParameterSubstitution::initialize( const uno::Sequence< uno::Any >& _aArguments )
@@ -36,13 +37,13 @@ namespace connectivity
::osl::MutexGuard aGuard(m_aMutex);
comphelper::SequenceAsHashMap aArgs(_aArguments);
uno::Reference< sdbc::XConnection > xConnection;
- xConnection = aArgs.getUnpackedValueOrDefault("ActiveConnection",xConnection);
+ xConnection = aArgs.getUnpackedValueOrDefault(u"ActiveConnection"_ustr,xConnection);
m_xConnection = xConnection;
}
OUString SAL_CALL ParameterSubstitution::getImplementationName( )
{
- return "org.openoffice.comp.helper.ParameterSubstitution";
+ return u"org.openoffice.comp.helper.ParameterSubstitution"_ustr;
}
sal_Bool SAL_CALL ParameterSubstitution::supportsService( const OUString& _rServiceName )
@@ -52,7 +53,7 @@ namespace connectivity
Sequence< OUString > SAL_CALL ParameterSubstitution::getSupportedServiceNames( )
{
- return { "com.sun.star.sdb.ParameterSubstitution" };
+ return { u"com.sun.star.sdb.ParameterSubstitution"_ustr };
}
diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx
index 21f5e638a651..51c75a44dc1c 100644
--- a/connectivity/source/commontools/RowFunctionParser.cxx
+++ b/connectivity/source/commontools/RowFunctionParser.cxx
@@ -38,6 +38,7 @@
#endif
#include <algorithm>
#include <stack>
+#include <utility>
namespace connectivity
{
@@ -56,8 +57,8 @@ class ConstantValueExpression : public ExpressionNode
public:
- explicit ConstantValueExpression( ORowSetValueDecoratorRef const & rValue ) :
- maValue( rValue )
+ explicit ConstantValueExpression(ORowSetValueDecoratorRef aValue)
+ : maValue(std::move(aValue))
{
}
virtual ORowSetValueDecoratorRef evaluate(const ODatabaseMetaDataResultSet::ORow& /*_aRow*/ ) const override
@@ -81,10 +82,10 @@ class BinaryFunctionExpression : public ExpressionNode
public:
- BinaryFunctionExpression( const ExpressionFunct eFunct, const std::shared_ptr<ExpressionNode>& rFirstArg, const std::shared_ptr<ExpressionNode>& rSecondArg ) :
+ BinaryFunctionExpression( const ExpressionFunct eFunct, std::shared_ptr<ExpressionNode> xFirstArg, std::shared_ptr<ExpressionNode> xSecondArg ) :
meFunct( eFunct ),
- mpFirstArg( rFirstArg ),
- mpSecondArg( rSecondArg )
+ mpFirstArg(std::move( xFirstArg )),
+ mpSecondArg(std::move( xSecondArg ))
{
}
virtual ORowSetValueDecoratorRef evaluate(const ODatabaseMetaDataResultSet::ORow& _aRow ) const override
@@ -93,13 +94,13 @@ public:
switch(meFunct)
{
case ExpressionFunct::Equation:
- aRet = new ORowSetValueDecorator( mpFirstArg->evaluate(_aRow )->getValue() == mpSecondArg->evaluate(_aRow )->getValue() );
+ aRet = new ORowSetValueDecorator( ORowSetValue(mpFirstArg->evaluate(_aRow )->getValue() == mpSecondArg->evaluate(_aRow )->getValue()) );
break;
case ExpressionFunct::And:
- aRet = new ORowSetValueDecorator( mpFirstArg->evaluate(_aRow )->getValue().getBool() && mpSecondArg->evaluate(_aRow )->getValue().getBool() );
+ aRet = new ORowSetValueDecorator( ORowSetValue(mpFirstArg->evaluate(_aRow )->getValue().getBool() && mpSecondArg->evaluate(_aRow )->getValue().getBool()) );
break;
case ExpressionFunct::Or:
- aRet = new ORowSetValueDecorator( mpFirstArg->evaluate(_aRow )->getValue().getBool() || mpSecondArg->evaluate(_aRow )->getValue().getBool() );
+ aRet = new ORowSetValueDecorator( ORowSetValue(mpFirstArg->evaluate(_aRow )->getValue().getBool() || mpSecondArg->evaluate(_aRow )->getValue().getBool()) );
break;
default:
break;
@@ -148,14 +149,14 @@ class ConstantFunctor
public:
- explicit ConstantFunctor( const ParserContextSharedPtr& rContext ) :
- mpContext( rContext )
+ explicit ConstantFunctor( ParserContextSharedPtr xContext ) :
+ mpContext(std::move( xContext ))
{
}
void operator()( StringIteratorT rFirst,StringIteratorT rSecond) const
{
OUString sVal( rFirst, rSecond - rFirst, RTL_TEXTENCODING_UTF8 );
- mpContext->maOperandStack.push( std::make_shared<ConstantValueExpression>( new ORowSetValueDecorator( sVal ) ) );
+ mpContext->maOperandStack.push(std::make_shared<ConstantValueExpression>(ORowSetValueDecoratorRef(new ORowSetValueDecorator(sVal))));
}
};
@@ -166,13 +167,13 @@ class IntConstantFunctor
ParserContextSharedPtr mpContext;
public:
- explicit IntConstantFunctor( const ParserContextSharedPtr& rContext ) :
- mpContext( rContext )
+ explicit IntConstantFunctor( ParserContextSharedPtr xContext ) :
+ mpContext(std::move( xContext ))
{
}
void operator()( sal_Int32 n ) const
{
- mpContext->maOperandStack.push( std::make_shared<ConstantValueExpression>( new ORowSetValueDecorator( n ) ) );
+ mpContext->maOperandStack.push(std::make_shared<ConstantValueExpression>(ORowSetValueDecoratorRef(new ORowSetValueDecorator(n))));
}
};
@@ -190,9 +191,9 @@ class BinaryFunctionFunctor
public:
- BinaryFunctionFunctor( const ExpressionFunct eFunct, const ParserContextSharedPtr& rContext ) :
+ BinaryFunctionFunctor( const ExpressionFunct eFunct, ParserContextSharedPtr xContext ) :
meFunct( eFunct ),
- mpContext( rContext )
+ mpContext(std::move( xContext ))
{
}
@@ -223,8 +224,8 @@ class UnaryFunctionExpression : public ExpressionNode
std::shared_ptr<ExpressionNode> mpArg;
public:
- explicit UnaryFunctionExpression( const std::shared_ptr<ExpressionNode>& rArg ) :
- mpArg( rArg )
+ explicit UnaryFunctionExpression( std::shared_ptr<ExpressionNode> xArg ) :
+ mpArg(std::move( xArg ))
{
}
virtual ORowSetValueDecoratorRef evaluate(const ODatabaseMetaDataResultSet::ORow& _aRow ) const override
@@ -242,8 +243,8 @@ class UnaryFunctionFunctor
public:
- explicit UnaryFunctionFunctor(const ParserContextSharedPtr& rContext)
- : mpContext(rContext)
+ explicit UnaryFunctionFunctor(ParserContextSharedPtr xContext)
+ : mpContext(std::move(xContext))
{
}
void operator()( StringIteratorT, StringIteratorT ) const
@@ -290,8 +291,8 @@ public:
@param rParserContext
Contains context info for the parser
*/
- explicit ExpressionGrammar( const ParserContextSharedPtr& rParserContext ) :
- mpParserContext( rParserContext )
+ explicit ExpressionGrammar( ParserContextSharedPtr xParserContext ) :
+ mpParserContext(std::move( xParserContext ))
{
}
@@ -403,15 +404,15 @@ std::shared_ptr<ExpressionNode> const & FunctionParser::parseFunction( const OUS
// TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_*
// gives better conversion robustness here (we might want to map space
// etc. to ASCII space here)
- const OString& rAsciiFunction(
+ const OString aAsciiFunction(
OUStringToOString( _sFunction, RTL_TEXTENCODING_ASCII_US ) );
- StringIteratorT aStart( rAsciiFunction.getStr() );
- StringIteratorT aEnd( rAsciiFunction.getStr()+rAsciiFunction.getLength() );
+ StringIteratorT aStart( aAsciiFunction.getStr() );
+ StringIteratorT aEnd( aAsciiFunction.getStr()+aAsciiFunction.getLength() );
// static parser context, because the actual
// Spirit parser is also a static object
- ParserContextSharedPtr pContext = getParserContext();
+ const ParserContextSharedPtr& pContext = getParserContext();
ExpressionGrammar aExpressionGrammer( pContext );
diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx
index 8671df0b042f..b29715c9b472 100644
--- a/connectivity/source/commontools/TColumnsHelper.cxx
+++ b/connectivity/source/commontools/TColumnsHelper.cxx
@@ -34,10 +34,8 @@ using namespace connectivity;
using namespace dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
namespace connectivity
{
@@ -45,7 +43,7 @@ namespace connectivity
{
public:
explicit OColumnsHelperImpl(bool _bCase)
- : m_aColumnInfo(_bCase)
+ : m_aColumnInfo(UStringMixLess(_bCase))
{
}
ColumnInformationMap m_aColumnInfo;
@@ -66,10 +64,9 @@ OColumnsHelper::~OColumnsHelper()
{
}
-
-sdbcx::ObjectType OColumnsHelper::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OColumnsHelper::createObject(const OUString& _rName)
{
- OSL_ENSURE(m_pTable,"NO Table set. Error!");
+ assert(m_pTable && "NO Table set. Error!");
Reference<XConnection> xConnection = m_pTable->getConnection();
if ( !m_pImpl )
@@ -95,7 +92,7 @@ sdbcx::ObjectType OColumnsHelper::createObject(const OUString& _rName)
nDataType = aFind->second.second;
} // if ( aFind != m_pImpl->m_aColumnInfo.end() )
- sdbcx::ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
const ColumnDesc* pColDesc = m_pTable->getColumnDescription(_rName);
if ( pColDesc )
{
@@ -111,7 +108,7 @@ sdbcx::ObjectType OColumnsHelper::createObject(const OUString& _rName)
m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)) >>= aCatalog;
m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema;
m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= aTable;
- connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName,
+ rtl::Reference<connectivity::sdbcx::OColumn> pRet = new connectivity::sdbcx::OColumn(_rName,
pColDesc->aField6,
pColDesc->sField13,
pColDesc->sField12,
@@ -144,7 +141,6 @@ sdbcx::ObjectType OColumnsHelper::createObject(const OUString& _rName)
return xRet;
}
-
void OColumnsHelper::impl_refresh()
{
if ( m_pTable )
@@ -160,7 +156,7 @@ Reference< XPropertySet > OColumnsHelper::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OColumnsHelper::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OColumnsHelper::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
::osl::MutexGuard aGuard(m_rMutex);
OSL_ENSURE(m_pTable,"OColumnsHelper::appendByDescriptor: Table is null!");
diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx
index 134aa5960115..c730946a56b7 100644
--- a/connectivity/source/commontools/TConnection.cxx
+++ b/connectivity/source/commontools/TConnection.cxx
@@ -18,7 +18,6 @@
*/
#include <TConnection.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
@@ -27,7 +26,6 @@ using namespace connectivity;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::beans;
using namespace ::osl;
@@ -57,16 +55,13 @@ void OMetaConnection::disposing()
//XUnoTunnel
sal_Int64 SAL_CALL OMetaConnection::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{
- return (isUnoTunnelId<OMetaConnection>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : sal_Int64(0);
+ return comphelper::getSomethingImpl(rId, this);
}
-Sequence< sal_Int8 > OMetaConnection::getUnoTunnelId()
+const Sequence< sal_Int8 > & OMetaConnection::getUnoTunnelId()
{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
}
::dbtools::OPropertyMap& OMetaConnection::getPropMap()
@@ -75,7 +70,7 @@ Sequence< sal_Int8 > OMetaConnection::getUnoTunnelId()
return s_aPropertyNameMap;
}
-void OMetaConnection::throwGenericSQLException(const char* pErrorResourceId, const Reference< XInterface>& _xContext )
+void OMetaConnection::throwGenericSQLException(TranslateId pErrorResourceId, const Reference< XInterface>& _xContext )
{
OUString sErrorMessage;
if (pErrorResourceId)
diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
index e5823278095e..3ad805e7d3ab 100644
--- a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
+++ b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
+
#include <TDatabaseMetaDataBase.hxx>
#include <RowFunctionParser.hxx>
@@ -91,7 +95,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( )
Reference< XRow > xRow(xRet,UNO_QUERY);
::comphelper::SequenceAsHashMap aMap(m_aConnectionInfo);
Sequence< Any > aTypeInfoSettings;
- aTypeInfoSettings = aMap.getUnpackedValueOrDefault("TypeInfoSettings",aTypeInfoSettings);
+ aTypeInfoSettings = aMap.getUnpackedValueOrDefault(u"TypeInfoSettings"_ustr,aTypeInfoSettings);
if ( xRow.is() )
{
@@ -118,12 +122,10 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( )
std::vector<std::shared_ptr<ExpressionNode>> aConditions;
if ( aTypeInfoSettings.getLength() > 1 && ((aTypeInfoSettings.getLength() % 2) == 0) )
{
- const Any* pIter = aTypeInfoSettings.getConstArray();
- const Any* pEnd = pIter + aTypeInfoSettings.getLength();
try
{
- for(;pIter != pEnd;++pIter)
- aConditions.push_back(FunctionParser::parseFunction(::comphelper::getString(*pIter)));
+ for (auto& any : aTypeInfoSettings)
+ aConditions.push_back(FunctionParser::parseFunction(::comphelper::getString(any)));
}
catch(ParseError&)
{
@@ -139,11 +141,11 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( )
::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
const sal_Int32* pType = pTypes;
- for (sal_Int32 i = 1; i <= sal_Int32(SAL_N_ELEMENTS(pTypes)); ++i,++pType)
+ for (std::size_t i = 1; i <= std::size(pTypes); ++i,++pType)
{
ORowSetValue aValue;
aValue.fill(i,*pType,xRow);
- aRow.push_back(new ORowSetValueDecorator(aValue));
+ aRow.push_back(new ORowSetValueDecorator(std::move(aValue)));
}
std::vector<std::shared_ptr<ExpressionNode>>::iterator aIter = aConditions.begin();
@@ -160,13 +162,12 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( )
}
aTypeInfoRows.push_back(aRow);
}
- m_aTypeInfoRows = aTypeInfoRows;
+ m_aTypeInfoRows = std::move(aTypeInfoRows);
}
}
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRet = pResult;
- pResult->setRows(m_aTypeInfoRows);
- return xRet;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
+ pResult->setRows(std::vector(m_aTypeInfoRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getExportedKeys(
diff --git a/connectivity/source/commontools/TIndex.cxx b/connectivity/source/commontools/TIndex.cxx
index f7f891308e40..32112bcdbe17 100644
--- a/connectivity/source/commontools/TIndex.cxx
+++ b/connectivity/source/commontools/TIndex.cxx
@@ -27,10 +27,7 @@
using namespace connectivity;
using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OIndexHelper::OIndexHelper( OTableHelper* _pTable) : connectivity::sdbcx::OIndex(true)
, m_pTable(_pTable)
diff --git a/connectivity/source/commontools/TIndexColumns.cxx b/connectivity/source/commontools/TIndexColumns.cxx
index bbb5ca706f20..4bf9115440b5 100644
--- a/connectivity/source/commontools/TIndexColumns.cxx
+++ b/connectivity/source/commontools/TIndexColumns.cxx
@@ -30,8 +30,6 @@ using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OIndexColumns::OIndexColumns( OIndexHelper* _pIndex,
::osl::Mutex& _rMutex,
@@ -41,7 +39,7 @@ OIndexColumns::OIndexColumns( OIndexHelper* _pIndex,
{
}
-sdbcx::ObjectType OIndexColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OIndexColumns::createObject(const OUString& _rName)
{
::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
OUString aCatalog, aSchema, aTable;
@@ -67,34 +65,33 @@ sdbcx::ObjectType OIndexColumns::createObject(const OUString& _rName)
xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getColumns(
Catalog, aSchema, aTable, _rName);
- sdbcx::ObjectType xRet;
- if ( xResult.is() )
+ if ( !xResult.is() )
+ return nullptr;
+
+ rtl::Reference< OIndexColumn > xRet;
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while( xResult->next() )
{
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while( xResult->next() )
+ if ( xRow->getString(4) == _rName )
{
- if ( xRow->getString(4) == _rName )
- {
- sal_Int32 nDataType = xRow->getInt(5);
- OUString aTypeName(xRow->getString(6));
- sal_Int32 nSize = xRow->getInt(7);
- sal_Int32 nDec = xRow->getInt(9);
- sal_Int32 nNull = xRow->getInt(11);
- OUString aColumnDef(xRow->getString(13));
+ sal_Int32 nDataType = xRow->getInt(5);
+ OUString aTypeName(xRow->getString(6));
+ sal_Int32 nSize = xRow->getInt(7);
+ sal_Int32 nDec = xRow->getInt(9);
+ sal_Int32 nNull = xRow->getInt(11);
+ OUString aColumnDef(xRow->getString(13));
- OIndexColumn* pRet = new OIndexColumn(bAsc,
- _rName,
- aTypeName,
- aColumnDef,
- nNull,
- nSize,
- nDec,
- nDataType,
- true,
- aCatalog, aSchema, aTable);
- xRet = pRet;
- break;
- }
+ xRet = new OIndexColumn(bAsc,
+ _rName,
+ aTypeName,
+ aColumnDef,
+ nNull,
+ nSize,
+ nDec,
+ nDataType,
+ true,
+ aCatalog, aSchema, aTable);
+ break;
}
}
diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx
index 5a8c7c29a0f4..5973806f1257 100644
--- a/connectivity/source/commontools/TIndexes.cxx
+++ b/connectivity/source/commontools/TIndexes.cxx
@@ -37,7 +37,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace cppu;
@@ -51,13 +50,13 @@ OIndexesHelper::OIndexesHelper(OTableHelper* _pTable,
}
-sdbcx::ObjectType OIndexesHelper::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OIndexesHelper::createObject(const OUString& _rName)
{
Reference< XConnection> xConnection = m_pTable->getConnection();
if ( !xConnection.is() )
return nullptr;
- sdbcx::ObjectType xRet;
+ rtl::Reference< OIndexHelper > xRet;
OUString aName,aQualifier;
sal_Int32 nLen = _rName.indexOf('.');
if ( nLen != -1 )
@@ -101,10 +100,9 @@ sdbcx::ObjectType OIndexesHelper::createObject(const OUString& _rName)
catch(const Exception&)
{
}
- OIndexHelper* pRet = new OIndexHelper(m_pTable,aName,aQualifier,bUnique,
+ xRet = new OIndexHelper(m_pTable,aName,aQualifier,bUnique,
bPrimarKeyIndex,
nClustered == IndexType::CLUSTERED);
- xRet = pRet;
break;
}
}
@@ -124,7 +122,7 @@ Reference< XPropertySet > OIndexesHelper::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OIndexesHelper::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OIndexesHelper::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
Reference< XConnection> xConnection = m_pTable->getConnection();
if ( !xConnection.is() )
@@ -153,10 +151,10 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const OUString& _rForName, const
OUString aComposedName = dbtools::composeTableName(m_pTable->getMetaData(),aCatalog,aSchema,aTable, true, ::dbtools::EComposeRule::InIndexDefinitions);
if (!_rForName.isEmpty() )
{
- aSql.append( ::dbtools::quoteName( aQuote, _rForName ) );
- aSql.append(" ON ");
- aSql.append(aComposedName);
- aSql.append(" ( ");
+ aSql.append( ::dbtools::quoteName( aQuote, _rForName )
+ + " ON "
+ + aComposedName
+ + " ( ");
Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
@@ -193,8 +191,8 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const OUString& _rForName, const
xColumns->getByIndex(0) >>= xColProp;
- aSql.append(".");
- aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))));
+ aSql.append("."
+ + ::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))));
}
Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
@@ -228,7 +226,7 @@ void OIndexesHelper::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementNam
aSchema = _sElementName.copy(0,nLen);
aName = _sElementName.copy(nLen+1);
- OUString aSql( "DROP INDEX " );
+ OUString aSql( u"DROP INDEX "_ustr );
OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::EComposeRule::InIndexDefinitions, true );
OUString sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), OUString(), aSchema, aName, true, ::dbtools::EComposeRule::InIndexDefinitions );
diff --git a/connectivity/source/commontools/TKey.cxx b/connectivity/source/commontools/TKey.cxx
index 1341291abcf3..3a16cf86a5a0 100644
--- a/connectivity/source/commontools/TKey.cxx
+++ b/connectivity/source/commontools/TKey.cxx
@@ -26,10 +26,7 @@
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OTableKeyHelper::OTableKeyHelper(OTableHelper* _pTable) : connectivity::sdbcx::OKey(true)
,m_pTable(_pTable)
diff --git a/connectivity/source/commontools/TKeyColumns.cxx b/connectivity/source/commontools/TKeyColumns.cxx
index acbfc54bf000..341e130df134 100644
--- a/connectivity/source/commontools/TKeyColumns.cxx
+++ b/connectivity/source/commontools/TKeyColumns.cxx
@@ -31,8 +31,6 @@ using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OKeyColumnsHelper::OKeyColumnsHelper( OTableKeyHelper* _pKey,
@@ -43,7 +41,7 @@ OKeyColumnsHelper::OKeyColumnsHelper( OTableKeyHelper* _pKey,
{
}
-sdbcx::ObjectType OKeyColumnsHelper::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OKeyColumnsHelper::createObject(const OUString& _rName)
{
::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
OUString aCatalog, aSchema, aTable;
@@ -72,49 +70,46 @@ sdbcx::ObjectType OKeyColumnsHelper::createObject(const OUString& _rName)
}
}
- sdbcx::ObjectType xRet;
-
// now describe the column _rName and set his related column
xResult = m_pKey->getTable()->getMetaData()->getColumns(Catalog, aSchema, aTable, _rName);
- if ( xResult.is() )
+ if ( !xResult.is() )
+ return nullptr;
+
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ if ( !xResult->next() )
+ return nullptr;
+
+ if ( xRow->getString(4) != _rName )
+ return nullptr;
+
+ sal_Int32 nDataType = xRow->getInt(5);
+ OUString aTypeName(xRow->getString(6));
+ sal_Int32 nSize = xRow->getInt(7);
+ sal_Int32 nDec = xRow->getInt(9);
+ sal_Int32 nNull = xRow->getInt(11);
+ OUString sColumnDef;
+ try
{
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if ( xResult->next() )
- {
- if ( xRow->getString(4) == _rName )
- {
- sal_Int32 nDataType = xRow->getInt(5);
- OUString aTypeName(xRow->getString(6));
- sal_Int32 nSize = xRow->getInt(7);
- sal_Int32 nDec = xRow->getInt(9);
- sal_Int32 nNull = xRow->getInt(11);
- OUString sColumnDef;
- try
- {
- sColumnDef = xRow->getString(13);
- }
- catch(const SQLException&)
- {
- // sometimes we get an error when asking for this param
- }
-
- OKeyColumn* pRet = new OKeyColumn(aRefColumnName,
- _rName,
- aTypeName,
- sColumnDef,
- nNull,
- nSize,
- nDec,
- nDataType,
- isCaseSensitive(),
- aCatalog,
- aSchema,
- aTable);
- xRet = pRet;
- }
- }
+ sColumnDef = xRow->getString(13);
}
+ catch(const SQLException&)
+ {
+ // sometimes we get an error when asking for this param
+ }
+
+ rtl::Reference<OKeyColumn> xRet = new OKeyColumn(aRefColumnName,
+ _rName,
+ aTypeName,
+ sColumnDef,
+ nNull,
+ nSize,
+ nDec,
+ nDataType,
+ isCaseSensitive(),
+ aCatalog,
+ aSchema,
+ aTable);
return xRet;
}
diff --git a/connectivity/source/commontools/TKeys.cxx b/connectivity/source/commontools/TKeys.cxx
index 4c223624dc3d..26389277c580 100644
--- a/connectivity/source/commontools/TKeys.cxx
+++ b/connectivity/source/commontools/TKeys.cxx
@@ -40,7 +40,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OKeysHelper::OKeysHelper( OTableHelper* _pTable,
@@ -51,20 +50,18 @@ OKeysHelper::OKeysHelper( OTableHelper* _pTable,
{
}
-sdbcx::ObjectType OKeysHelper::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OKeysHelper::createObject(const OUString& _rName)
{
- sdbcx::ObjectType xRet;
+ rtl::Reference< OTableKeyHelper > xRet;
if(!_rName.isEmpty())
{
- OTableKeyHelper* pRet = new OTableKeyHelper(m_pTable,_rName,m_pTable->getKeyProperties(_rName));
- xRet = pRet;
+ xRet = new OTableKeyHelper(m_pTable,_rName,m_pTable->getKeyProperties(_rName));
}
if(!xRet.is()) // we have a primary key with a system name
{
- OTableKeyHelper* pRet = new OTableKeyHelper(m_pTable,_rName,m_pTable->getKeyProperties(_rName));
- xRet = pRet;
+ xRet = new OTableKeyHelper(m_pTable,_rName,m_pTable->getKeyProperties(_rName));
}
return xRet;
@@ -108,7 +105,9 @@ static OUString getKeyRuleString(bool _bUpdate,sal_Int32 _nKeyRule)
return sRet;
}
-void OKeysHelper::cloneDescriptorColumns( const sdbcx::ObjectType& _rSourceDescriptor, const sdbcx::ObjectType& _rDestDescriptor )
+void OKeysHelper::cloneDescriptorColumns(
+ const css::uno::Reference< css::beans::XPropertySet >& _rSourceDescriptor,
+ const css::uno::Reference< css::beans::XPropertySet >& _rDestDescriptor )
{
Reference< XColumnsSupplier > xColSupp( _rSourceDescriptor, UNO_QUERY_THROW );
Reference< XIndexAccess > xSourceCols( xColSupp->getColumns(), UNO_QUERY_THROW );
@@ -125,7 +124,7 @@ void OKeysHelper::cloneDescriptorColumns( const sdbcx::ObjectType& _rSourceDescr
}
// XAppend
-sdbcx::ObjectType OKeysHelper::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OKeysHelper::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
Reference< XConnection> xConnection = m_pTable->getConnection();
if ( !xConnection.is() )
@@ -157,12 +156,11 @@ sdbcx::ObjectType OKeysHelper::appendObject( const OUString& _rForName, const Re
{
// if we're here, we belong to a table which is not new, i.e. already exists in the database.
// In this case, really append the new index.
- OUStringBuffer aSql;
- aSql.append("ALTER TABLE ");
+ OUStringBuffer aSql("ALTER TABLE ");
OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( );
- aSql.append(composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::EComposeRule::InTableDefinitions, true ));
- aSql.append(" ADD ");
+ aSql.append(composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::EComposeRule::InTableDefinitions, true )
+ + " ADD ");
if ( nKeyType == KeyType::PRIMARY )
{
@@ -190,9 +188,9 @@ sdbcx::ObjectType OKeysHelper::appendObject( const OUString& _rForName, const Re
if ( nKeyType == KeyType::FOREIGN )
{
- aSql.append(" REFERENCES ");
- aSql.append(::dbtools::quoteTableName(m_pTable->getConnection()->getMetaData(),sReferencedName,::dbtools::EComposeRule::InTableDefinitions));
- aSql.append(" (");
+ aSql.append(" REFERENCES "
+ + ::dbtools::quoteTableName(m_pTable->getConnection()->getMetaData(),sReferencedName,::dbtools::EComposeRule::InTableDefinitions)
+ + " (");
for(sal_Int32 i=0;i<xColumns->getCount();++i)
{
@@ -202,9 +200,9 @@ sdbcx::ObjectType OKeysHelper::appendObject( const OUString& _rForName, const Re
aSql.append(::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_RELATEDCOLUMN)))));
}
- aSql.append(")");
- aSql.append(getKeyRuleString(true ,nUpdateRule));
- aSql.append(getKeyRuleString(false ,nDeleteRule));
+ aSql.append(")"
+ + getKeyRuleString(true ,nUpdateRule)
+ + getKeyRuleString(false ,nDeleteRule));
}
Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
@@ -238,7 +236,7 @@ sdbcx::ObjectType OKeysHelper::appendObject( const OUString& _rForName, const Re
OUString sName = xRow->getString(nColumn);
if ( !m_pElements->exists(sName) ) // this name wasn't inserted yet so it must be the new one
{
- descriptor->setPropertyValue( rPropMap.getNameByIndex( PROPERTY_ID_NAME ), makeAny( sName ) );
+ descriptor->setPropertyValue( rPropMap.getNameByIndex( PROPERTY_ID_NAME ), Any( sName ) );
sNewName = sName;
break;
}
@@ -257,7 +255,7 @@ sdbcx::ObjectType OKeysHelper::appendObject( const OUString& _rForName, const Re
OUString OKeysHelper::getDropForeignKey() const
{
- return " DROP CONSTRAINT ";
+ return u" DROP CONSTRAINT "_ustr;
}
// XDrop
@@ -267,17 +265,16 @@ void OKeysHelper::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
if ( !xConnection.is() || m_pTable->isNew() )
return;
- Reference<XPropertySet> xKey(getObject(_nPos),UNO_QUERY);
+ Reference<XPropertySet> xKey(getObject(_nPos));
if ( m_pTable->getKeyService().is() )
{
m_pTable->getKeyService()->dropKey(m_pTable,xKey);
}
else
{
- OUStringBuffer aSql;
- aSql.append("ALTER TABLE ");
-
- aSql.append( composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::EComposeRule::InTableDefinitions, true ));
+ OUStringBuffer aSql(
+ "ALTER TABLE "
+ + composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::EComposeRule::InTableDefinitions, true ));
sal_Int32 nKeyType = KeyType::PRIMARY;
if ( xKey.is() )
diff --git a/connectivity/source/commontools/TPrivilegesResultSet.cxx b/connectivity/source/commontools/TPrivilegesResultSet.cxx
index de255d3cb8c1..0003cedbcdbf 100644
--- a/connectivity/source/commontools/TPrivilegesResultSet.cxx
+++ b/connectivity/source/commontools/TPrivilegesResultSet.cxx
@@ -21,9 +21,7 @@
using namespace connectivity;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
@@ -38,11 +36,8 @@ OResultSetPrivileges::OResultSetPrivileges( const Reference< XDatabaseMetaData>&
osl_atomic_increment( &m_refCount );
{
OUString sUserWorkingFor;
- Sequence< OUString > sTableTypes(3);
// we want all catalogues, all schemas, all tables
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else...
+ Sequence< OUString > sTableTypes {u"VIEW"_ustr, u"TABLE"_ustr, u"%"_ustr}; // this last one is just to be sure to include anything else...
try
{
m_xTables = _rxMeta->getTables(catalog,schemaPattern,tableNamePattern,sTableTypes);
@@ -58,7 +53,7 @@ OResultSetPrivileges::OResultSetPrivileges( const Reference< XDatabaseMetaData>&
ODatabaseMetaDataResultSet::ORow aRow(8);
aRow[5] = new ORowSetValueDecorator(sUserWorkingFor);
aRow[6] = ODatabaseMetaDataResultSet::getSelectValue();
- aRow[7] = new ORowSetValueDecorator(OUString("YES"));
+ aRow[7] = new ORowSetValueDecorator(u"YES"_ustr);
aRows.push_back(aRow);
aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
aRows.push_back(aRow);
@@ -74,10 +69,10 @@ OResultSetPrivileges::OResultSetPrivileges( const Reference< XDatabaseMetaData>&
aRows.push_back(aRow);
aRow[6] = ODatabaseMetaDataResultSet::getDropValue();
aRows.push_back(aRow);
- aRow[6] = new ORowSetValueDecorator(OUString("REFERENCE"));
+ aRow[6] = new ORowSetValueDecorator(u"REFERENCE"_ustr);
aRows.push_back(aRow);
- setRows(aRows);
+ setRows(std::move(aRows));
}
osl_atomic_decrement( &m_refCount );
}
@@ -107,17 +102,17 @@ const ORowSetValue& OResultSetPrivileges::getValue(sal_Int32 columnIndex)
return ODatabaseMetaDataResultSet::getValue(columnIndex);
}
-void SAL_CALL OResultSetPrivileges::disposing()
+void OResultSetPrivileges::disposing(std::unique_lock<std::mutex>& rGuard)
{
- ODatabaseMetaDataResultSet::disposing();
+ ODatabaseMetaDataResultSet::disposing(rGuard);
m_xTables.clear();
m_xRow.clear();
}
sal_Bool SAL_CALL OResultSetPrivileges::next( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
+ std::unique_lock aGuard( m_aMutex );
+ throwIfDisposed(aGuard);
bool bReturn = false;
if ( m_xTables.is() )
@@ -129,7 +124,7 @@ sal_Bool SAL_CALL OResultSetPrivileges::next( )
return false;
}
- bReturn = ODatabaseMetaDataResultSet::next();
+ bReturn = ODatabaseMetaDataResultSet::next(aGuard);
if ( !bReturn )
{
m_bBOF = false;
diff --git a/connectivity/source/commontools/TSortIndex.cxx b/connectivity/source/commontools/TSortIndex.cxx
index 6b94216a3719..44a883dc86c4 100644
--- a/connectivity/source/commontools/TSortIndex.cxx
+++ b/connectivity/source/commontools/TSortIndex.cxx
@@ -94,10 +94,10 @@ struct TKeyValueFunc
return pKeySet;
}
-OSortIndex::OSortIndex( const std::vector<OKeyType>& _aKeyType,
- const std::vector<TAscendingOrder>& _aAscending)
- :m_aKeyType(_aKeyType)
- ,m_aAscending(_aAscending)
+OSortIndex::OSortIndex( std::vector<OKeyType>&& _aKeyType,
+ std::vector<TAscendingOrder>&& _aAscending)
+ :m_aKeyType(std::move(_aKeyType))
+ ,m_aAscending(std::move(_aAscending))
,m_bFrozen(false)
{
}
diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx
index 03724d669704..0eb0c1e70260 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -132,10 +132,10 @@ namespace connectivity
Reference<XMultiServiceFactory> xFac(_xConnection,UNO_QUERY);
if ( xFac.is() )
{
- m_xRename.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,"TableRenameServiceName")),UNO_QUERY);
- m_xAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,"TableAlterationServiceName")),UNO_QUERY);
- m_xKeyAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,"KeyAlterationServiceName")),UNO_QUERY);
- m_xIndexAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,"IndexAlterationServiceName")),UNO_QUERY);
+ m_xRename.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,u"TableRenameServiceName"_ustr)),UNO_QUERY);
+ m_xAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,u"TableAlterationServiceName"_ustr)),UNO_QUERY);
+ m_xKeyAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,u"KeyAlterationServiceName"_ustr)),UNO_QUERY);
+ m_xIndexAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,u"IndexAlterationServiceName"_ustr)),UNO_QUERY);
}
}
catch(const Exception&)
@@ -181,7 +181,7 @@ void SAL_CALL OTableHelper::disposing()
::osl::MutexGuard aGuard(m_aMutex);
if ( m_pImpl->m_xTablePropertyListener.is() )
{
- m_pTables->removeContainerListener(m_pImpl->m_xTablePropertyListener.get());
+ m_pTables->removeContainerListener(m_pImpl->m_xTablePropertyListener);
m_pImpl->m_xTablePropertyListener->clear();
m_pImpl->m_xTablePropertyListener.clear();
}
@@ -200,20 +200,25 @@ namespace
void lcl_collectColumnDescs_throw( const Reference< XResultSet >& _rxResult, std::vector< ColumnDesc >& _out_rColumns )
{
Reference< XRow > xRow( _rxResult, UNO_QUERY_THROW );
- OUString sName;
- OrdinalPosition nOrdinalPosition( 0 );
while ( _rxResult->next() )
{
- sName = xRow->getString( 4 ); // COLUMN_NAME
- sal_Int32 nField5 = xRow->getInt(5);
+ // tdf#162227: ODBC SQLGetData requires that data must be retrieved in increasing
+ // column number order, unless the driver supports SQL_GD_ANY_ORDER extension (see
+ // https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function).
+ // We can't emplace_back(getString(4), getInt(5), ..., getString(12), getInt(17)),
+ // because MSVC would reorder calls into getInt(17) -> getString(12) -> ..., and then
+ // MS SQL Server ODBC driver will give error on access of column 12 after column 17.
+ OUString sName = xRow->getString(4); // COLUMN_NAME
+ sal_Int32 nField5 = xRow->getInt(5);
OUString aField6 = xRow->getString(6);
- sal_Int32 nField7 = xRow->getInt(7)
- , nField9 = xRow->getInt(9)
- , nField11= xRow->getInt(11);
- OUString sField12 = xRow->getString(12)
- ,sField13 = xRow->getString(13);
- nOrdinalPosition = xRow->getInt( 17 ); // ORDINAL_POSITION
- _out_rColumns.push_back( ColumnDesc( sName,nField5,aField6,nField7,nField9,nField11,sField12,sField13, nOrdinalPosition ) );
+ sal_Int32 nField7 = xRow->getInt(7);
+ sal_Int32 nField9 = xRow->getInt(9);
+ sal_Int32 nField11 = xRow->getInt(11);
+ OUString sField12 = xRow->getString(12);
+ OUString sField13 = xRow->getString(13);
+ OrdinalPosition nOrdinalPosition = xRow->getInt(17); // ORDINAL_POSITION
+ _out_rColumns.emplace_back(sName, nField5, aField6, nField7, nField9, nField11,
+ sField12, sField13, nOrdinalPosition);
}
}
@@ -269,7 +274,7 @@ void OTableHelper::refreshColumns()
aCatalog,
m_SchemaName,
m_Name,
- "%"
+ u"%"_ustr
) );
// collect the column names, together with their ordinal position
@@ -296,7 +301,7 @@ void OTableHelper::refreshColumns()
if(m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = createColumns(aVector);
+ m_xColumns.reset(createColumns(aVector));
}
const ColumnDesc* OTableHelper::getColumnDescription(const OUString& _sName) const
@@ -387,7 +392,7 @@ void OTableHelper::refreshForeignKeys(::std::vector< OUString>& _rNames)
{
if ( !m_pImpl->m_xTablePropertyListener.is() )
m_pImpl->m_xTablePropertyListener = new OTableContainerListener(this);
- m_pTables->addContainerListener(m_pImpl->m_xTablePropertyListener.get());
+ m_pTables->addContainerListener(m_pImpl->m_xTablePropertyListener);
m_pImpl->m_xTablePropertyListener->add(sReferencedName);
} // if ( m_pTables->hasByName(sReferencedName) )
sOldFKName = sFkName;
@@ -413,10 +418,10 @@ void OTableHelper::refreshKeys()
{
refreshPrimaryKeys(aNames);
refreshForeignKeys(aNames);
- m_xKeys = createKeys(aNames);
+ m_xKeys.reset(createKeys(aNames));
} // if(!isNew())
else if (!m_xKeys )
- m_xKeys = createKeys(aNames);
+ m_xKeys.reset(createKeys(aNames));
/*if(m_pKeys)
m_pKeys->reFill(aVector);
else*/
@@ -460,12 +465,12 @@ void OTableHelper::refreshIndexes()
if(m_xIndexes)
m_xIndexes->reFill(aVector);
else
- m_xIndexes = createIndexes(aVector);
+ m_xIndexes.reset(createIndexes(aVector));
}
OUString OTableHelper::getRenameStart() const
{
- OUString sSql("RENAME ");
+ OUString sSql(u"RENAME "_ustr);
if ( m_Type == "VIEW" )
sSql += " VIEW ";
else
@@ -549,6 +554,11 @@ OUString SAL_CALL OTableHelper::getName()
return sComposedName;
}
+const OUString & OTableHelper::getTableName()
+{
+ return m_Name;
+}
+
std::shared_ptr<sdbcx::KeyProperties> OTableHelper::getKeyProperties(const OUString& _sName) const
{
std::shared_ptr<sdbcx::KeyProperties> pKeyProps;
diff --git a/connectivity/source/commontools/conncleanup.cxx b/connectivity/source/commontools/conncleanup.cxx
index 210c618d6a60..7b703f093c80 100644
--- a/connectivity/source/commontools/conncleanup.cxx
+++ b/connectivity/source/commontools/conncleanup.cxx
@@ -23,7 +23,7 @@
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbtools
@@ -35,7 +35,7 @@ namespace dbtools
using namespace css::sdbc;
using namespace css::lang;
- constexpr OUStringLiteral ACTIVE_CONNECTION_PROPERTY_NAME = u"ActiveConnection";
+ constexpr OUString ACTIVE_CONNECTION_PROPERTY_NAME = u"ActiveConnection"_ustr;
OAutoConnectionDisposer::OAutoConnectionDisposer(const Reference< XRowSet >& _rxRowSet, const Reference< XConnection >& _rxConnection)
:m_xRowSet( _rxRowSet )
@@ -50,7 +50,7 @@ namespace dbtools
try
{
- xProps->setPropertyValue( ACTIVE_CONNECTION_PROPERTY_NAME, makeAny( _rxConnection ) );
+ xProps->setPropertyValue( ACTIVE_CONNECTION_PROPERTY_NAME, Any( _rxConnection ) );
m_xOriginalConnection = _rxConnection;
startPropertyListening( xProps );
}
@@ -78,7 +78,7 @@ namespace dbtools
void OAutoConnectionDisposer::stopPropertyListening( const Reference< XPropertySet >& _rxEventSource )
{
// prevent deletion of ourself while we're herein
- Reference< XInterface > xKeepAlive(static_cast< XWeak* >(this));
+ Reference< XInterface > xKeepAlive(getXWeak());
try
{ // remove ourself as property change listener
diff --git a/connectivity/source/commontools/dbcharset.cxx b/connectivity/source/commontools/dbcharset.cxx
index ebe45c028207..381afa606e08 100644
--- a/connectivity/source/commontools/dbcharset.cxx
+++ b/connectivity/source/commontools/dbcharset.cxx
@@ -18,6 +18,7 @@
*/
#include <connectivity/dbcharset.hxx>
+#include <utility>
#include <osl/diagnose.h>
#include <rtl/tencinfo.h>
@@ -92,15 +93,15 @@ namespace dbtools
}
- OCharsetMap::CharsetIterator OCharsetMap::findIanaName(const OUString& _rIanaName) const
+ OCharsetMap::CharsetIterator OCharsetMap::findIanaName(std::u16string_view _rIanaName) const
{
ensureConstructed( );
rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW;
- if ( !_rIanaName.isEmpty() )
+ if ( !_rIanaName.empty() )
{
// byte string conversion
- OString sMimeByteString( _rIanaName.getStr(), _rIanaName.getLength(), RTL_TEXTENCODING_ASCII_US );
+ OString sMimeByteString = OUStringToOString( _rIanaName, RTL_TEXTENCODING_ASCII_US );
// look up
eEncoding = rtl_getTextEncodingFromMimeCharset( sMimeByteString.getStr() );
@@ -129,15 +130,15 @@ namespace dbtools
}
- CharsetIteratorDerefHelper:: CharsetIteratorDerefHelper(const rtl_TextEncoding _eEncoding, const OUString& _rIanaName )
+ CharsetIteratorDerefHelper:: CharsetIteratorDerefHelper(const rtl_TextEncoding _eEncoding, OUString _aIanaName )
:m_eEncoding( _eEncoding )
- ,m_aIanaName( _rIanaName )
+ ,m_aIanaName(std::move( _aIanaName ))
{
}
- OCharsetMap::CharsetIterator::CharsetIterator(const OCharsetMap* _pContainer, OCharsetMap::TextEncBag::const_iterator const & _aPos )
+ OCharsetMap::CharsetIterator::CharsetIterator(const OCharsetMap* _pContainer, OCharsetMap::TextEncBag::const_iterator _aPos )
:m_pContainer( _pContainer )
- ,m_aPos( _aPos )
+ ,m_aPos(std::move( _aPos ))
{
OSL_ENSURE( m_pContainer, "OCharsetMap::CharsetIterator::CharsetIterator : invalid container!" );
}
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index dbe942a3fd01..4dd7d5b8e9f3 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -18,15 +18,16 @@
*/
#include <connectivity/dbconversion.hxx>
-#include <osl/diagnose.h>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <rtl/character.hxx>
-#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
+#include <sal/log.hxx>
#include <unotools/datetime.hxx>
+#include <comphelper/date.hxx>
+#include <o3tl/string_view.hxx>
#include <sstream>
#include <iomanip>
@@ -61,7 +62,6 @@ namespace dbtools
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
@@ -80,7 +80,7 @@ namespace dbtools
ostr << setw(4) << rDate.Year << "-"
<< setw(2) << rDate.Month << "-"
<< setw(2) << rDate.Day;
- return OUString::createFromAscii(ostr.str().c_str());
+ return OUString::createFromAscii(ostr.str());
}
OUString DBTypeConversion::toTimeStringS(const css::util::Time& rTime)
@@ -91,7 +91,7 @@ namespace dbtools
ostr << setw(2) << rTime.Hours << ":"
<< setw(2) << rTime.Minutes << ":"
<< setw(2) << rTime.Seconds;
- return OUString::createFromAscii(ostr.str().c_str());
+ return OUString::createFromAscii(ostr.str());
}
OUString DBTypeConversion::toTimeString(const css::util::Time& rTime)
@@ -103,18 +103,15 @@ namespace dbtools
<< setw(2) << rTime.Minutes << ":"
<< setw(2) << rTime.Seconds << "."
<< setw(9) << rTime.NanoSeconds;
- return OUString::createFromAscii(ostr.str().c_str());
+ return OUString::createFromAscii(ostr.str());
}
OUString DBTypeConversion::toDateTimeString(const css::util::DateTime& _rDateTime)
{
css::util::Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year);
- OUStringBuffer aTemp(toDateString(aDate));
- aTemp.append(" ");
css::util::Time const aTime(_rDateTime.NanoSeconds, _rDateTime.Seconds,
_rDateTime.Minutes, _rDateTime.Hours, _rDateTime.IsUTC);
- aTemp.append( toTimeString(aTime) );
- return aTemp.makeStringAndClear();
+ return toDateString(aDate) + " " + toTimeString(aTime);
}
css::util::Date DBTypeConversion::toDate(const sal_Int32 _nVal)
@@ -151,93 +148,25 @@ namespace dbtools
nHour * (minInHour * secInMin * nanoSecInSec);
}
-
- const sal_Int32 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,
- 31, 31, 30, 31, 30, 31 };
-
-
- static bool implIsLeapYear(sal_Int32 _nYear)
- {
- return ( ((_nYear % 4) == 0)
- && ((_nYear % 100) != 0)
- )
-
- || ((_nYear % 400) == 0)
- ;
- }
-
-
- static sal_Int32 implDaysInMonth(sal_Int32 _nMonth, sal_Int32 _nYear)
- {
- OSL_ENSURE(_nMonth > 0 && _nMonth < 13,"Month as invalid value!");
- if (_nMonth != 2)
- return aDaysInMonth[_nMonth-1];
- else
- {
- if (implIsLeapYear(_nYear))
- return aDaysInMonth[_nMonth-1] + 1;
- else
- return aDaysInMonth[_nMonth-1];
- }
- }
-
-
static sal_Int32 implRelativeToAbsoluteNull(const css::util::Date& _rDate)
{
- sal_Int32 nDays = 0;
-
- // ripped this code from the implementation of tools::Date
- sal_Int32 nNormalizedYear = _rDate.Year - 1;
- nDays = nNormalizedYear * 365;
- // leap years
- nDays += (nNormalizedYear / 4) - (nNormalizedYear / 100) + (nNormalizedYear / 400);
-
- for (sal_Int32 i = 1; i < _rDate.Month; ++i)
- nDays += implDaysInMonth(i, _rDate.Year);
-
- nDays += _rDate.Day;
- return nDays;
- }
-
- static void implBuildFromRelative( const sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth, sal_Int16& rYear)
- {
- sal_Int32 nTempDays;
- sal_Int32 i = 0;
- bool bCalc;
-
- do
+ if (_rDate.Day == 0 && _rDate.Month == 0 && _rDate.Year == 0)
{
- nTempDays = nDays;
- rYear = static_cast<sal_uInt16>((nTempDays / 365) - i);
- nTempDays -= (rYear-1) * 365;
- nTempDays -= ((rYear-1) / 4) - ((rYear-1) / 100) + ((rYear-1) / 400);
- bCalc = false;
- if ( nTempDays < 1 )
- {
- i++;
- bCalc = true;
- }
- else
- {
- if ( nTempDays > 365 )
- {
- if ( (nTempDays != 366) || !implIsLeapYear( rYear ) )
- {
- i--;
- bCalc = true;
- }
- }
- }
+ // 0000-00-00 is *NOT* a valid date and passing it to the date
+ // conversion even when normalizing rightly asserts. Whatever we
+ // return here, it will be wrong. The old before commit
+ // 52ff16771ac160d27fd7beb78a4cfba22ad84f06 wrong implementation
+ // calculated -365 for that, effectively that would be a date of
+ // -0001-01-01 now but it was likely assumed that would be
+ // 0000-00-01 or even 0000-00-00 instead. Try if we get away with 0
+ // for -0001-12-31, the same that
+ // comphelper::date::convertDateToDaysNormalizing()
+ // would return if comphelper::date::normalize() wouldn't ignore
+ // such "empty" date.
+
+ return 0;
}
- while ( bCalc );
-
- rMonth = 1;
- while ( nTempDays > implDaysInMonth( rMonth, rYear ) )
- {
- nTempDays -= implDaysInMonth( rMonth, rYear );
- rMonth++;
- }
- rDay = static_cast<sal_uInt16>(nTempDays);
+ return comphelper::date::convertDateToDaysNormalizing( _rDate.Day, _rDate.Month, _rDate.Year);
}
sal_Int32 DBTypeConversion::toDays(const css::util::Date& _rVal, const css::util::Date& _rNullDate)
@@ -273,7 +202,7 @@ namespace dbtools
static void addDays(const sal_Int32 nDays, css::util::Date& _rDate)
{
- sal_Int32 nTempDays = implRelativeToAbsoluteNull( _rDate );
+ sal_Int64 nTempDays = implRelativeToAbsoluteNull(_rDate);
nTempDays += nDays;
if ( nTempDays > maxDays )
@@ -283,7 +212,6 @@ namespace dbtools
_rDate.Year = 9999;
}
// TODO: can we replace that check by minDays? Would allow dates BCE
- // implBuildFromRelative probably needs to be updated for the "no year 0" question
else if ( nTempDays <= 0 )
{
_rDate.Day = 1;
@@ -291,12 +219,12 @@ namespace dbtools
_rDate.Year = 1;
}
else
- implBuildFromRelative( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year );
+ comphelper::date::convertDaysToDate( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year );
}
static void subDays(const sal_Int32 nDays, css::util::Date& _rDate )
{
- sal_Int32 nTempDays = implRelativeToAbsoluteNull( _rDate );
+ sal_Int64 nTempDays = implRelativeToAbsoluteNull(_rDate);
nTempDays -= nDays;
if ( nTempDays > maxDays )
@@ -306,7 +234,6 @@ namespace dbtools
_rDate.Year = 9999;
}
// TODO: can we replace that check by minDays? Would allow dates BCE
- // implBuildFromRelative probably needs to be updated for the "no year 0" question
else if ( nTempDays <= 0 )
{
_rDate.Day = 1;
@@ -314,7 +241,7 @@ namespace dbtools
_rDate.Year = 1;
}
else
- implBuildFromRelative( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year );
+ comphelper::date::convertDaysToDate( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year );
}
css::util::Date DBTypeConversion::toDate(const double dVal, const css::util::Date& _rNullDate)
@@ -332,13 +259,10 @@ namespace dbtools
css::util::Time DBTypeConversion::toTime(const double dVal, short nDigits)
{
- const sal_Int32 nDays = static_cast<sal_Int32>(dVal);
- sal_Int64 nNS;
- {
- double fSeconds((dVal - static_cast<double>(nDays)) * (fNanoSecondsPerDay / nanoSecInSec));
- fSeconds = ::rtl::math::round( fSeconds, nDigits );
- nNS = fSeconds * nanoSecInSec;
- }
+ const double nDays = std::trunc(dVal);
+ double fSeconds((dVal - nDays) * (fNanoSecondsPerDay / nanoSecInSec));
+ fSeconds = ::rtl::math::round(fSeconds, nDigits);
+ sal_Int64 nNS = fSeconds * nanoSecInSec;
sal_Int16 nSign;
if ( nNS < 0 )
@@ -380,6 +304,14 @@ namespace dbtools
css::util::DateTime DBTypeConversion::toDateTime(const double dVal, const css::util::Date& _rNullDate)
{
+ css::util::DateTime aRet;
+
+ if (!std::isfinite(dVal))
+ {
+ SAL_WARN("connectivity.commontools", "DateTime has invalid value: " << dVal);
+ return aRet;
+ }
+
css::util::Date aDate = toDate(dVal, _rNullDate);
// there is not enough precision in a double to have both a date
// and a time up to nanoseconds -> limit to microseconds to have
@@ -387,8 +319,6 @@ namespace dbtools
// 12:59:59.999999790
css::util::Time aTime = toTime(dVal, 6);
- css::util::DateTime aRet;
-
aRet.Day = aDate.Day;
aRet.Month = aDate.Month;
aRet.Year = aDate.Year;
@@ -402,7 +332,7 @@ namespace dbtools
return aRet;
}
- css::util::Date DBTypeConversion::toDate(const OUString& _sSQLString)
+ css::util::Date DBTypeConversion::toDate(std::u16string_view _sSQLString)
{
// get the token out of a string
static const sal_Unicode sDateSep = '-';
@@ -411,12 +341,12 @@ namespace dbtools
sal_uInt16 nYear = 0,
nMonth = 0,
nDay = 0;
- nYear = static_cast<sal_uInt16>(_sSQLString.getToken(0,sDateSep,nIndex).toInt32());
+ nYear = static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(_sSQLString, 0,sDateSep,nIndex)));
if(nIndex != -1)
{
- nMonth = static_cast<sal_uInt16>(_sSQLString.getToken(0,sDateSep,nIndex).toInt32());
+ nMonth = static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(_sSQLString, 0,sDateSep,nIndex)));
if(nIndex != -1)
- nDay = static_cast<sal_uInt16>(_sSQLString.getToken(0,sDateSep,nIndex).toInt32());
+ nDay = static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(_sSQLString, 0,sDateSep,nIndex)));
}
return css::util::Date(nDay,nMonth,nYear);
@@ -439,7 +369,7 @@ namespace dbtools
const sal_Unicode *const begin = p;
while (rtl::isAsciiWhiteSpace(*p)) { ++p; }
nSeparation += p - begin;
- aTime = toTime( _sSQLString.copy( nSeparation ) );
+ aTime = toTime( _sSQLString.subView( nSeparation ) );
}
return css::util::DateTime(aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
@@ -447,7 +377,7 @@ namespace dbtools
}
- css::util::Time DBTypeConversion::toTime(const OUString& _sSQLString)
+ css::util::Time DBTypeConversion::toTime(std::u16string_view _sSQLString)
{
css::util::Time aTime;
::utl::ISO8601parseTime(_sSQLString, aTime);
diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx
index 2efc4a6976b3..113a96ea57f1 100644
--- a/connectivity/source/commontools/dbexception.cxx
+++ b/connectivity/source/commontools/dbexception.cxx
@@ -27,7 +27,7 @@
#include <com/sun/star/sdb/SQLErrorEvent.hpp>
#include <strings.hrc>
#include <resource/sharedresources.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbtools
{
@@ -66,8 +66,7 @@ SQLExceptionInfo::SQLExceptionInfo(const css::sdb::SQLContext& _rError)
SQLExceptionInfo::SQLExceptionInfo( const OUString& _rSimpleErrorMessage )
{
- SQLException aError;
- aError.Message = _rSimpleErrorMessage;
+ SQLException aError(_rSimpleErrorMessage, {}, {}, 0, {});
m_aContent <<= aError;
implDetermineType();
}
@@ -177,63 +176,67 @@ SQLExceptionInfo::operator const css::sdb::SQLContext*() const
void SQLExceptionInfo::prepend( const OUString& _rErrorMessage )
{
- SQLException aException;
- aException.Message = _rErrorMessage;
- aException.ErrorCode = 0;
- aException.SQLState = "S1000";
- aException.NextException = m_aContent;
+ SQLException aException(_rErrorMessage, {}, u"S1000"_ustr, 0, m_aContent);
m_aContent <<= aException;
m_eType = TYPE::SQLException;
}
-
-void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, const OUString& _rSQLState, const sal_Int32 _nErrorCode )
+// create the to-be-appended exception
+Any SQLExceptionInfo::createException(TYPE eType, const OUString& rErrorMessage, const OUString& rSQLState, const sal_Int32 nErrorCode)
{
- // create the to-be-appended exception
Any aAppend;
- switch ( _eType )
+ switch (eType)
{
- case TYPE::SQLException: aAppend <<= SQLException(); break;
- case TYPE::SQLWarning: aAppend <<= SQLWarning(); break;
- case TYPE::SQLContext: aAppend <<= SQLContext(); break;
- default:
- TOOLS_WARN_EXCEPTION( "connectivity.commontools", "SQLExceptionInfo::append: invalid exception type: this will crash!" );
- break;
+ case TYPE::SQLException:
+ aAppend <<= SQLException(rErrorMessage, {}, rSQLState, nErrorCode, {});
+ break;
+ case TYPE::SQLWarning:
+ aAppend <<= SQLWarning(rErrorMessage, {}, rSQLState, nErrorCode, {});
+ break;
+ case TYPE::SQLContext:
+ aAppend <<= SQLContext(rErrorMessage, {}, rSQLState, nErrorCode, {}, {});
+ break;
+ default:
+ TOOLS_WARN_EXCEPTION("connectivity.commontools", "SQLExceptionInfo::createException: invalid exception type: this will crash!");
+ break;
}
- SQLException& pAppendException = const_cast<SQLException &>(*o3tl::forceAccess<SQLException>(aAppend));
- pAppendException.Message = _rErrorMessage;
- pAppendException.SQLState = _rSQLState;
- pAppendException.ErrorCode = _nErrorCode;
+ return aAppend;
+}
- // find the end of the current chain
- Any* pChainIterator = &m_aContent;
- SQLException* pLastException = nullptr;
- const Type& aSQLExceptionType( cppu::UnoType<SQLException>::get() );
- while ( pChainIterator )
+// find the end of the exception chain
+SQLException* SQLExceptionInfo::getLastException(SQLException* pLastException)
+{
+ SQLException* pException = pLastException;
+ while (pException)
{
- if ( !pChainIterator->hasValue() )
+ pException = const_cast<SQLException*>(o3tl::tryAccess<SQLException>(pException->NextException));
+ if (!pException)
break;
+ pLastException = pException;
+ }
+ return pLastException;
+}
- if ( !isAssignableFrom( aSQLExceptionType, pChainIterator->getValueType() ) )
- break;
+void SQLExceptionInfo::append( TYPE _eType, const OUString& _rErrorMessage, const OUString& _rSQLState, const sal_Int32 _nErrorCode )
+{
+ // create the to-be-appended exception
+ Any aAppend = createException(_eType, _rErrorMessage, _rSQLState, _nErrorCode);
- pLastException = const_cast< SQLException* >( o3tl::doAccess<SQLException>( *pChainIterator ) );
- pChainIterator = &pLastException->NextException;
- }
+ // find the end of the current chain
+ SQLException* pLastException = getLastException(const_cast<SQLException*>(o3tl::tryAccess<SQLException>(m_aContent)));
// append
- if ( pLastException )
- pLastException->NextException = aAppend;
+ if (pLastException)
+ pLastException->NextException = std::move(aAppend);
else
{
- m_aContent = aAppend;
+ m_aContent = std::move(aAppend);
m_eType = _eType;
}
}
-
void SQLExceptionInfo::doThrow()
{
if ( m_aContent.getValueTypeClass() == TypeClass_EXCEPTION )
@@ -461,17 +464,17 @@ OUString getStandardSQLState( StandardSQLState _eState )
{
switch ( _eState )
{
- case StandardSQLState::INVALID_DESCRIPTOR_INDEX: return "07009";
- case StandardSQLState::INVALID_CURSOR_STATE: return "24000";
- case StandardSQLState::COLUMN_NOT_FOUND: return "42S22";
- case StandardSQLState::GENERAL_ERROR: return "HY000";
- case StandardSQLState::INVALID_SQL_DATA_TYPE: return "HY004";
- case StandardSQLState::FUNCTION_SEQUENCE_ERROR: return "HY010";
- case StandardSQLState::INVALID_CURSOR_POSITION: return "HY109";
- case StandardSQLState::FEATURE_NOT_IMPLEMENTED: return "HYC00";
- case StandardSQLState::FUNCTION_NOT_SUPPORTED: return "IM001";
- case StandardSQLState::CONNECTION_DOES_NOT_EXIST: return "08003";
- default: return "HY001"; // General Error
+ case StandardSQLState::INVALID_DESCRIPTOR_INDEX: return u"07009"_ustr;
+ case StandardSQLState::INVALID_CURSOR_STATE: return u"24000"_ustr;
+ case StandardSQLState::COLUMN_NOT_FOUND: return u"42S22"_ustr;
+ case StandardSQLState::GENERAL_ERROR: return u"HY000"_ustr;
+ case StandardSQLState::INVALID_SQL_DATA_TYPE: return u"HY004"_ustr;
+ case StandardSQLState::FUNCTION_SEQUENCE_ERROR: return u"HY010"_ustr;
+ case StandardSQLState::INVALID_CURSOR_POSITION: return u"HY109"_ustr;
+ case StandardSQLState::FEATURE_NOT_IMPLEMENTED: return u"HYC00"_ustr;
+ case StandardSQLState::FUNCTION_NOT_SUPPORTED: return u"IM001"_ustr;
+ case StandardSQLState::CONNECTION_DOES_NOT_EXIST: return u"08003"_ustr;
+ default: return u"HY001"_ustr; // General Error
}
}
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index f8afdcda692c..c269b9ca6c0d 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -33,7 +33,7 @@
#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
#include <com/sun/star/sdbc/DriverManager.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/processfactory.hxx>
#include <sal/log.hxx>
@@ -75,11 +75,7 @@ namespace dbtools
::std::optional< OUString > sCachedCatalogSeparator;
DatabaseMetaData_Impl()
- :xConnection()
- ,xConnectionMetaData()
- ,aDriverConfig( ::comphelper::getProcessComponentContext() )
- ,sCachedIdentifierQuoteString()
- ,sCachedCatalogSeparator()
+ : aDriverConfig( ::comphelper::getProcessComponentContext() )
{
}
};
@@ -111,7 +107,7 @@ namespace dbtools
}
- bool lcl_getDriverSetting( const char* _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting )
+ bool lcl_getDriverSetting( const OUString& _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting )
{
lcl_checkConnected( _metaData );
const ::comphelper::NamedValueCollection& rDriverMetaData = _metaData.aDriverConfig.getMetaData( _metaData.xConnectionMetaData->getURL() );
@@ -122,7 +118,7 @@ namespace dbtools
}
- bool lcl_getConnectionSetting( const char* _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting )
+ bool lcl_getConnectionSetting(const OUString& _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting )
{
try
{
@@ -131,16 +127,15 @@ namespace dbtools
{
Reference< XPropertySet > xDataSource( xConnectionAsChild->getParent(), UNO_QUERY_THROW );
Reference< XPropertySet > xDataSourceSettings(
- xDataSource->getPropertyValue("Settings"),
+ xDataSource->getPropertyValue(u"Settings"_ustr),
UNO_QUERY_THROW );
- _out_setting = xDataSourceSettings->getPropertyValue( OUString::createFromAscii( _asciiName ) );
+ _out_setting = xDataSourceSettings->getPropertyValue( _asciiName );
}
else
{
Reference< XDatabaseMetaData2 > xExtendedMetaData( _metaData.xConnectionMetaData, UNO_QUERY_THROW );
- ::comphelper::NamedValueCollection aSettings( xExtendedMetaData->getConnectionInfo() );
- _out_setting = aSettings.get( _asciiName );
+ _out_setting = ::comphelper::NamedValueCollection::get( xExtendedMetaData->getConnectionInfo(), _asciiName );
return _out_setting.hasValue();
}
return true;
@@ -245,7 +240,7 @@ namespace dbtools
try
{
Any setting;
- if ( !( lcl_getConnectionSetting( "PrimaryKeySupport", *m_pImpl, setting ) )
+ if ( !( lcl_getConnectionSetting( u"PrimaryKeySupport"_ustr, *m_pImpl, setting ) )
|| !( setting >>= bDoesSupportPrimaryKeys )
)
bDoesSupportPrimaryKeys = m_pImpl->xConnectionMetaData->supportsCoreSQLGrammar()
@@ -277,7 +272,7 @@ namespace dbtools
bool restrict( false );
Any setting;
- if ( lcl_getConnectionSetting( "EnableSQL92Check", *m_pImpl, setting ) )
+ if ( lcl_getConnectionSetting( u"EnableSQL92Check"_ustr, *m_pImpl, setting ) )
if( ! (setting >>= restrict) )
SAL_WARN("connectivity.commontools", "restrictIdentifiersToSQL92: unable to assign EnableSQL92Check");
return restrict;
@@ -288,7 +283,7 @@ namespace dbtools
{
bool doGenerate( false );
Any setting;
- if ( lcl_getConnectionSetting( "GenerateASBeforeCorrelationName", *m_pImpl, setting ) )
+ if ( lcl_getConnectionSetting( u"GenerateASBeforeCorrelationName"_ustr, *m_pImpl, setting ) )
if( ! (setting >>= doGenerate) )
SAL_WARN("connectivity.commontools", "generateASBeforeCorrelationName: unable to assign GenerateASBeforeCorrelationName");
return doGenerate;
@@ -298,7 +293,7 @@ namespace dbtools
{
bool doGenerate( true );
Any setting;
- if ( lcl_getConnectionSetting( "EscapeDateTime", *m_pImpl, setting ) )
+ if ( lcl_getConnectionSetting( u"EscapeDateTime"_ustr, *m_pImpl, setting ) )
if( ! (setting >>= doGenerate) )
SAL_WARN("connectivity.commontools", "shouldEscapeDateTime: unable to assign EscapeDateTime");
return doGenerate;
@@ -308,7 +303,7 @@ namespace dbtools
{
bool doSubstitute( true );
Any setting;
- if ( lcl_getConnectionSetting( "ParameterNameSubstitution", *m_pImpl, setting ) )
+ if ( lcl_getConnectionSetting( u"ParameterNameSubstitution"_ustr, *m_pImpl, setting ) )
if( ! (setting >>= doSubstitute) )
SAL_WARN("connectivity.commontools", "shouldSubstituteParameterNames: unable to assign ParameterNameSubstitution");
return doSubstitute;
@@ -318,7 +313,7 @@ namespace dbtools
{
bool is( true );
Any setting;
- if ( lcl_getDriverSetting( "AutoIncrementIsPrimaryKey", *m_pImpl, setting ) )
+ if ( lcl_getDriverSetting( u"AutoIncrementIsPrimaryKey"_ustr, *m_pImpl, setting ) )
if( ! (setting >>= is) )
SAL_WARN("connectivity.commontools", "isAutoIncrementPrimaryKey: unable to assign AutoIncrementIsPrimaryKey");
return is;
@@ -328,7 +323,7 @@ namespace dbtools
{
sal_Int32 mode( BooleanComparisonMode::EQUAL_INTEGER );
Any setting;
- if ( lcl_getConnectionSetting( "BooleanComparisonMode", *m_pImpl, setting ) )
+ if ( lcl_getConnectionSetting( u"BooleanComparisonMode"_ustr, *m_pImpl, setting ) )
if( ! (setting >>= mode) )
SAL_WARN("connectivity.commontools", "getBooleanComparisonMode: unable to assign BooleanComparisonMode");
return mode;
@@ -366,7 +361,7 @@ namespace dbtools
{
bool doGenerate( true );
Any setting;
- if ( lcl_getConnectionSetting( "ColumnAliasInOrderBy", *m_pImpl, setting ) )
+ if ( lcl_getConnectionSetting( u"ColumnAliasInOrderBy"_ustr, *m_pImpl, setting ) )
if( ! (setting >>= doGenerate) )
SAL_WARN("connectivity.commontools", "supportsColumnAliasInOrderBy: unable to assign ColumnAliasInOrderBy");
return doGenerate;
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index cd9f2c9fc48f..f9d54236e4b4 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -58,7 +58,6 @@
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
-#include <com/sun/star/task/XInteractionRequest.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/util/NumberFormatsSupplier.hpp>
@@ -79,7 +78,7 @@
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/stream.hxx>
#include <cppuhelper/implbase.hxx>
#include <strings.hrc>
@@ -126,10 +125,10 @@ sal_Int32 getDefaultNumberFormat(const Reference< XPropertySet >& _xColumn,
try
{
// determine the datatype of the column
- _xColumn->getPropertyValue("Type") >>= nDataType;
+ _xColumn->getPropertyValue(u"Type"_ustr) >>= nDataType;
if (DataType::NUMERIC == nDataType || DataType::DECIMAL == nDataType)
- _xColumn->getPropertyValue("Scale") >>= nScale;
+ _xColumn->getPropertyValue(u"Scale"_ustr) >>= nScale;
}
catch (Exception&)
{
@@ -137,7 +136,7 @@ sal_Int32 getDefaultNumberFormat(const Reference< XPropertySet >& _xColumn,
}
return getDefaultNumberFormat(nDataType,
nScale,
- ::cppu::any2bool(_xColumn->getPropertyValue("IsCurrency")),
+ ::cppu::any2bool(_xColumn->getPropertyValue(u"IsCurrency"_ustr)),
_xTypes,
_rLocale);
}
@@ -279,9 +278,7 @@ static Reference< XConnection > getConnection_allowException(
Reference<XInitialization> xIni(xDataSource, UNO_QUERY);
if (xIni.is())
{
- Sequence< Any > aArgs(1);
- NamedValue aParam( "ParentWindow", makeAny(_rxParent) );
- aArgs[0] <<= aParam;
+ Sequence< Any > aArgs{ Any(NamedValue( u"ParentWindow"_ustr, Any(_rxParent) )) };
xIni->initialize(aArgs);
}
@@ -294,8 +291,8 @@ static Reference< XConnection > getConnection_allowException(
try
{
xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd;
- bPwdReq = ::cppu::any2bool(xProp->getPropertyValue("IsPasswordRequired"));
- xProp->getPropertyValue("User") >>= sUser;
+ bPwdReq = ::cppu::any2bool(xProp->getPropertyValue(u"IsPasswordRequired"_ustr));
+ xProp->getPropertyValue(u"User"_ustr) >>= sUser;
}
catch(Exception&)
{
@@ -319,9 +316,7 @@ static Reference< XConnection > getConnection_allowException(
if (xIni.is())
{
- Sequence< Any > aArgs(1);
- NamedValue aParam( "ParentWindow", makeAny(Reference<XWindow>()) );
- aArgs[0] <<= aParam;
+ Sequence< Any > aArgs{ Any(NamedValue( u"ParentWindow"_ustr, Any(Reference<XWindow>()) )) };
xIni->initialize(aArgs);
}
@@ -355,7 +350,7 @@ Reference< XConnection> getConnection(const Reference< XRowSet>& _rxRowSet)
Reference< XConnection> xReturn;
Reference< XPropertySet> xRowSetProps(_rxRowSet, UNO_QUERY);
if (xRowSetProps.is())
- xRowSetProps->getPropertyValue("ActiveConnection") >>= xReturn;
+ xRowSetProps->getPropertyValue(u"ActiveConnection"_ustr) >>= xReturn;
return xReturn;
}
@@ -375,7 +370,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
// 1. already connected?
Reference< XConnection > xExistingConn(
- xRowSetProps->getPropertyValue("ActiveConnection"),
+ xRowSetProps->getPropertyValue(u"ActiveConnection"_ustr),
UNO_QUERY );
if ( xExistingConn.is()
@@ -385,7 +380,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
|| ( xExistingConn = findConnection( _rxRowSet ) ).is()
)
{
- xRowSetProps->setPropertyValue("ActiveConnection", makeAny( xExistingConn ) );
+ xRowSetProps->setPropertyValue(u"ActiveConnection"_ustr, Any( xExistingConn ) );
// no auto disposer needed, since we did not create the connection
xConnection.reset( xExistingConn, SharedConnection::NoTakeOwnership );
@@ -394,11 +389,11 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
// build a connection with its current settings (4. data source name, or 5. URL)
- const OUString sUserProp( "User" );
+ static constexpr OUString sUserProp( u"User"_ustr );
OUString sDataSourceName;
- xRowSetProps->getPropertyValue("DataSourceName") >>= sDataSourceName;
+ xRowSetProps->getPropertyValue(u"DataSourceName"_ustr) >>= sDataSourceName;
OUString sURL;
- xRowSetProps->getPropertyValue("URL") >>= sURL;
+ xRowSetProps->getPropertyValue(u"URL"_ustr) >>= sURL;
Reference< XConnection > xPureConnection;
if (!sDataSourceName.isEmpty())
@@ -430,8 +425,8 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
if (!sUser.isEmpty())
{ // use user and pwd together with the url
auto aInfo(::comphelper::InitPropertySequence({
- { "user", makeAny(sUser) },
- { "password", makeAny(sPwd) }
+ { "user", Any(sUser) },
+ { "password", Any(sPwd) }
}));
xPureConnection = xDriverManager->getConnectionWithInfo( sURL, aInfo );
}
@@ -457,8 +452,8 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
}
else
xRowSetProps->setPropertyValue(
- "ActiveConnection",
- makeAny( xConnection.getTyped() )
+ u"ActiveConnection"_ustr,
+ Any( xConnection.getTyped() )
);
}
catch(Exception&)
@@ -658,14 +653,14 @@ Reference< XNameAccess > getFieldsByCommandDescriptor( const Reference< XConnect
if ( xComposerFac.is() )
{
- Reference< XSingleSelectQueryComposer > xComposer(xComposerFac->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"),UNO_QUERY);
+ Reference< XSingleSelectQueryComposer > xComposer(xComposerFac->createInstance(u"com.sun.star.sdb.SingleSelectQueryComposer"_ustr),UNO_QUERY);
if ( xComposer.is() )
{
xComposer->setQuery( sStatementToExecute );
// Now set the filter to a dummy restriction which will result in an empty
// result set.
- xComposer->setFilter( "0=1" );
+ xComposer->setFilter( u"0=1"_ustr );
sStatementToExecute = xComposer->getQuery( );
}
}
@@ -688,7 +683,7 @@ Reference< XNameAccess > getFieldsByCommandDescriptor( const Reference< XConnect
try
{
if ( xStatementProps.is() )
- xStatementProps->setPropertyValue( "MaxRows", makeAny( sal_Int32( 0 ) ) );
+ xStatementProps->setPropertyValue( u"MaxRows"_ustr, Any( sal_Int32( 0 ) ) );
}
catch( const Exception& )
{
@@ -748,7 +743,7 @@ SQLException prependErrorInfo( const SQLException& _rChainedException, const Ref
{
return SQLException( _rAdditionalError, _rxContext,
_eSQLState == StandardSQLState::ERROR_UNSPECIFIED ? OUString() : getStandardSQLState( _eSQLState ),
- 0, makeAny( _rChainedException ) );
+ 0, Any( _rChainedException ) );
}
namespace
@@ -820,13 +815,13 @@ static OUString impl_doComposeTableName( const Reference< XDatabaseMetaData >& _
OUStringBuffer aComposedName;
OUString sCatalogSep;
- bool bCatlogAtStart = true;
+ bool bCatalogAtStart = true;
if ( !_rCatalog.isEmpty() && aNameComps.bCatalogs )
{
sCatalogSep = _rxMetaData->getCatalogSeparator();
- bCatlogAtStart = _rxMetaData->isCatalogAtStart();
+ bCatalogAtStart = _rxMetaData->isCatalogAtStart();
- if ( bCatlogAtStart && !sCatalogSep.isEmpty())
+ if ( bCatalogAtStart && !sCatalogSep.isEmpty())
{
aComposedName.append( _bQuote ? quoteName( sQuoteString, _rCatalog ) : _rCatalog );
aComposedName.append( sCatalogSep );
@@ -835,14 +830,15 @@ static OUString impl_doComposeTableName( const Reference< XDatabaseMetaData >& _
if ( !_rSchema.isEmpty() && aNameComps.bSchemas )
{
- aComposedName.append( _bQuote ? quoteName( sQuoteString, _rSchema ) : _rSchema );
- aComposedName.append( "." );
+ aComposedName.append(
+ (_bQuote ? quoteName( sQuoteString, _rSchema ) : _rSchema )
+ + "." );
}
aComposedName.append( _bQuote ? quoteName( sQuoteString, _rName ) : _rName );
if ( !_rCatalog.isEmpty()
- && !bCatlogAtStart
+ && !bCatalogAtStart
&& !sCatalogSep.isEmpty()
&& aNameComps.bCatalogs
)
@@ -917,7 +913,7 @@ Reference< XNumberFormatsSupplier> getNumberFormats(
// ask the parent of the connection (should be a DatabaseAccess)
Reference< XNumberFormatsSupplier> xReturn;
Reference< XChild> xConnAsChild(_rxConn, UNO_QUERY);
- static constexpr OUStringLiteral sPropFormatsSupplier( u"NumberFormatsSupplier" );
+ static constexpr OUString sPropFormatsSupplier( u"NumberFormatsSupplier"_ustr );
if (xConnAsChild.is())
{
Reference< XPropertySet> xConnParentProps(xConnAsChild->getParent(), UNO_QUERY);
@@ -947,33 +943,30 @@ try
Reference< XPropertySetInfo> xNewInfo( xNewProps->getPropertySetInfo());
const Sequence< Property> aOldProperties = xOldInfo->getProperties();
- Sequence< Property> aNewProperties = xNewInfo->getProperties();
- int nNewLen = aNewProperties.getLength();
-
- Property* pNewProps = aNewProperties.getArray();
-
- static constexpr OUStringLiteral sPropFormatsSupplier(u"FormatsSupplier");
- static constexpr OUStringLiteral sPropCurrencySymbol(u"CurrencySymbol");
- static constexpr OUStringLiteral sPropDecimals(u"Decimals");
- static constexpr OUStringLiteral sPropEffectiveMin(u"EffectiveMin");
- static constexpr OUStringLiteral sPropEffectiveMax(u"EffectiveMax");
- static constexpr OUStringLiteral sPropEffectiveDefault(u"EffectiveDefault");
- static constexpr OUStringLiteral sPropDefaultText(u"DefaultText");
- static constexpr OUStringLiteral sPropDefaultDate(u"DefaultDate");
- static constexpr OUStringLiteral sPropDefaultTime(u"DefaultTime");
- static constexpr OUStringLiteral sPropValueMin(u"ValueMin");
- static constexpr OUStringLiteral sPropValueMax(u"ValueMax");
- static constexpr OUStringLiteral sPropDecimalAccuracy(u"DecimalAccuracy");
- static constexpr OUStringLiteral sPropClassId(u"ClassId");
- static constexpr OUStringLiteral sFormattedServiceName( u"com.sun.star.form.component.FormattedField" );
+ const Sequence< Property> aNewProperties = xNewInfo->getProperties();
+
+ static constexpr OUString sPropFormatsSupplier(u"FormatsSupplier"_ustr);
+ static constexpr OUString sPropCurrencySymbol(u"CurrencySymbol"_ustr);
+ static constexpr OUString sPropDecimals(u"Decimals"_ustr);
+ static constexpr OUString sPropEffectiveMin(u"EffectiveMin"_ustr);
+ static constexpr OUString sPropEffectiveMax(u"EffectiveMax"_ustr);
+ static constexpr OUString sPropEffectiveDefault(u"EffectiveDefault"_ustr);
+ static constexpr OUString sPropDefaultText(u"DefaultText"_ustr);
+ static constexpr OUString sPropDefaultDate(u"DefaultDate"_ustr);
+ static constexpr OUString sPropDefaultTime(u"DefaultTime"_ustr);
+ static constexpr OUString sPropValueMin(u"ValueMin"_ustr);
+ static constexpr OUString sPropValueMax(u"ValueMax"_ustr);
+ static constexpr OUString sPropDecimalAccuracy(u"DecimalAccuracy"_ustr);
+ static constexpr OUString sPropClassId(u"ClassId"_ustr);
+ static constexpr OUString sFormattedServiceName( u"com.sun.star.form.component.FormattedField"_ustr );
for (const Property& rOldProp : aOldProperties)
{
if ( rOldProp.Name != "DefaultControl" && rOldProp.Name != "LabelControl" )
{
// binary search
- Property* pResult = std::lower_bound(
- pNewProps, pNewProps + nNewLen, rOldProp, ::comphelper::PropertyCompareByName());
+ const Property* pResult = std::lower_bound(
+ aNewProperties.begin(), aNewProperties.end(), rOldProp, ::comphelper::PropertyCompareByName());
if ( ( pResult != aNewProperties.end() )
&& ( pResult->Name == rOldProp.Name )
@@ -1037,7 +1030,7 @@ try
{ // Unlike the ValueMin the EffectiveMin can be void
if (hasProperty(sPropValueMin, xNewProps))
{
- OSL_ENSURE(aEffectiveMin.getValueType().getTypeClass() == TypeClass_DOUBLE,
+ OSL_ENSURE(aEffectiveMin.getValueTypeClass() == TypeClass_DOUBLE,
"TransferFormComponentProperties : invalid property type !");
xNewProps->setPropertyValue(sPropValueMin, aEffectiveMin);
}
@@ -1047,7 +1040,7 @@ try
{ // analog
if (hasProperty(sPropValueMax, xNewProps))
{
- OSL_ENSURE(aEffectiveMax.getValueType().getTypeClass() == TypeClass_DOUBLE,
+ OSL_ENSURE(aEffectiveMax.getValueTypeClass() == TypeClass_DOUBLE,
"TransferFormComponentProperties : invalid property type !");
xNewProps->setPropertyValue(sPropValueMax, aEffectiveMax);
}
@@ -1057,8 +1050,8 @@ try
Any aEffectiveDefault( xOldProps->getPropertyValue(sPropEffectiveDefault) );
if (aEffectiveDefault.hasValue())
{
- bool bIsString = aEffectiveDefault.getValueType().getTypeClass() == TypeClass_STRING;
- OSL_ENSURE(bIsString || aEffectiveDefault.getValueType().getTypeClass() == TypeClass_DOUBLE,
+ bool bIsString = aEffectiveDefault.getValueTypeClass() == TypeClass_STRING;
+ OSL_ENSURE(bIsString || aEffectiveDefault.getValueTypeClass() == TypeClass_DOUBLE,
"TransferFormComponentProperties : invalid property type !");
// The Effective-Properties should always be void or string or double...
@@ -1066,13 +1059,13 @@ try
{ // (to convert an OUString into a date will not always succeed, because it might be bound to a text-column,
// but we can work with a double)
Date aDate = DBTypeConversion::toDate(getDouble(aEffectiveDefault));
- xNewProps->setPropertyValue(sPropDefaultDate, makeAny(aDate));
+ xNewProps->setPropertyValue(sPropDefaultDate, Any(aDate));
}
if (hasProperty(sPropDefaultTime, xNewProps) && !bIsString)
{ // Completely analogous to time
css::util::Time aTime = DBTypeConversion::toTime(getDouble(aEffectiveDefault));
- xNewProps->setPropertyValue(sPropDefaultTime, makeAny(aTime));
+ xNewProps->setPropertyValue(sPropDefaultTime, Any(aTime));
}
if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE), xNewProps) && !bIsString)
@@ -1142,7 +1135,7 @@ try
nKey = xFormats->addNew(sNewFormat, _rLocale);
}
- xNewProps->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FORMATKEY), makeAny(nKey));
+ xNewProps->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FORMATKEY), Any(nKey));
}
// min-/max-Value
@@ -1188,17 +1181,17 @@ catch(const Exception&)
bool canInsert(const Reference< XPropertySet>& _rxCursorSet)
{
- return (_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue("Privileges")) & Privilege::INSERT) != 0);
+ return (_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(u"Privileges"_ustr)) & Privilege::INSERT) != 0);
}
bool canUpdate(const Reference< XPropertySet>& _rxCursorSet)
{
- return (_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue("Privileges")) & Privilege::UPDATE) != 0);
+ return (_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(u"Privileges"_ustr)) & Privilege::UPDATE) != 0);
}
bool canDelete(const Reference< XPropertySet>& _rxCursorSet)
{
- return (_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue("Privileges")) & Privilege::DELETE) != 0);
+ return (_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(u"Privileges"_ustr)) & Privilege::DELETE) != 0);
}
Reference< XDataSource> findDataSource(const Reference< XInterface >& _xParent)
@@ -1233,21 +1226,21 @@ static Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const
OUString sCommand;
bool bEscapeProcessing = false;
- OSL_VERIFY( _rxRowSet->getPropertyValue("CommandType") >>= nCommandType );
- OSL_VERIFY( _rxRowSet->getPropertyValue("Command") >>= sCommand );
- OSL_VERIFY( _rxRowSet->getPropertyValue("EscapeProcessing") >>= bEscapeProcessing );
+ OSL_VERIFY( _rxRowSet->getPropertyValue(u"CommandType"_ustr) >>= nCommandType );
+ OSL_VERIFY( _rxRowSet->getPropertyValue(u"Command"_ustr) >>= sCommand );
+ OSL_VERIFY( _rxRowSet->getPropertyValue(u"EscapeProcessing"_ustr) >>= bEscapeProcessing );
StatementComposer aComposer( xConn, sCommand, nCommandType, bEscapeProcessing );
// append sort
- aComposer.setOrder( getString( _rxRowSet->getPropertyValue("Order") ) );
+ aComposer.setOrder( getString( _rxRowSet->getPropertyValue(u"Order"_ustr) ) );
// append filter
bool bApplyFilter = true;
- _rxRowSet->getPropertyValue("ApplyFilter") >>= bApplyFilter;
+ _rxRowSet->getPropertyValue(u"ApplyFilter"_ustr) >>= bApplyFilter;
if ( bApplyFilter )
{
- aComposer.setFilter( getString( _rxRowSet->getPropertyValue("Filter") ) );
- aComposer.setHavingClause( getString( _rxRowSet->getPropertyValue("HavingClause") ) );
+ aComposer.setFilter( getString( _rxRowSet->getPropertyValue(u"Filter"_ustr) ) );
+ aComposer.setHavingClause( getString( _rxRowSet->getPropertyValue(u"HavingClause"_ustr) ) );
}
aComposer.getQuery();
@@ -1303,8 +1296,8 @@ OUString composeTableName( const Reference< XDatabaseMetaData >& _rxMetaData,
OUString composeTableNameForSelect( const Reference< XConnection >& _rxConnection,
const OUString& _rCatalog, const OUString& _rSchema, const OUString& _rName )
{
- bool bUseCatalogInSelect = isDataSourcePropertyEnabled( _rxConnection, "UseCatalogInSelect", true );
- bool bUseSchemaInSelect = isDataSourcePropertyEnabled( _rxConnection, "UseSchemaInSelect", true );
+ bool bUseCatalogInSelect = isDataSourcePropertyEnabled( _rxConnection, u"UseCatalogInSelect"_ustr, true );
+ bool bUseSchemaInSelect = isDataSourcePropertyEnabled( _rxConnection, u"UseSchemaInSelect"_ustr, true );
return impl_doComposeTableName(
_rxConnection->getMetaData(),
@@ -1421,7 +1414,7 @@ void showError(const SQLExceptionInfo& _rInfo,
{
try
{
- Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create( _rxContext, "", _xParent, _rInfo.get() );
+ Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create( _rxContext, u""_ustr, _xParent, _rInfo.get() );
xErrorDialog->execute();
}
catch(const Exception&)
@@ -1610,10 +1603,8 @@ bool implSetObject( const Reference< XParameters >& _rxParameters,
break;
case TypeClass_INTERFACE:
- if (_rValue.getValueType() == cppu::UnoType<XInputStream>::get())
+ if (Reference<XInputStream> xStream; _rValue >>= xStream)
{
- Reference< XInputStream > xStream;
- _rValue >>= xStream;
_rxParameters->setBinaryStream(_nColumnIndex, xStream, xStream->available());
break;
}
@@ -1633,7 +1624,8 @@ namespace
std::vector<bool, std::allocator<bool> > m_aSet;
Reference<XIndexAccess> m_xSource;
public:
- OParameterWrapper(const std::vector<bool, std::allocator<bool> >& _aSet,const Reference<XIndexAccess>& _xSource) : m_aSet(_aSet),m_xSource(_xSource){}
+ OParameterWrapper(std::vector<bool, std::allocator<bool> >&& _aSet,const Reference<XIndexAccess>& _xSource)
+ : m_aSet(std::move(_aSet)), m_xSource(_xSource) {}
private:
// css::container::XElementAccess
virtual Type SAL_CALL getElementType() override
@@ -1713,21 +1705,20 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
}
// build an interaction request
// two continuations (Ok and Cancel)
- OInteractionAbort* pAbort = new OInteractionAbort;
- OParameterContinuation* pParams = new OParameterContinuation;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
+ rtl::Reference<OParameterContinuation> pParams = new OParameterContinuation;
// the request
ParametersRequest aRequest;
- Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(aNewParameterSet,xParamsAsIndicies);
+ Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(std::move(aNewParameterSet),xParamsAsIndicies);
aRequest.Parameters = xWrappedParameters;
aRequest.Connection = _xConnection;
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
pRequest->addContinuation(pAbort);
pRequest->addContinuation(pParams);
// execute the request
- _rxHandler->handle(xRequest);
+ _rxHandler->handle(pRequest);
if (!pParams->wasSelected())
{
@@ -1739,15 +1730,14 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
// now transfer the values from the continuation object to the parameter columns
Sequence< PropertyValue > aFinalValues = pParams->getValues();
- const PropertyValue* pFinalValues = aFinalValues.getConstArray();
- for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues)
+ for (sal_Int32 i = 0; i < aFinalValues.getLength(); ++i)
{
Reference< XPropertySet > xParamColumn(xWrappedParameters->getByIndex(i),UNO_QUERY);
if (xParamColumn.is())
{
OUString sName;
xParamColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
- OSL_ENSURE(sName == pFinalValues->Name, "::dbaui::askForParameters: inconsistent parameter names!");
+ OSL_ENSURE(sName == aFinalValues[i].Name, "::dbaui::askForParameters: inconsistent parameter names!");
// determine the field type and ...
sal_Int32 nParamType = 0;
@@ -1757,12 +1747,12 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE), xParamColumn))
xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
// (the index of the parameters is one-based)
- TParameterPositions::const_iterator aFind = aParameterNames.find(pFinalValues->Name);
+ TParameterPositions::const_iterator aFind = aParameterNames.find(aFinalValues[i].Name);
for(const auto& rItem : aFind->second)
{
if ( _aParametersSet.empty() || !_aParametersSet[rItem-1] )
{
- _xParameters->setObjectWithInfo(rItem, pFinalValues->Value, nParamType, nScale);
+ _xParameters->setObjectWithInfo(rItem, aFinalValues[i].Value, nParamType, nScale);
}
}
}
@@ -1799,7 +1789,7 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams,
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
- _xParams->setString(parameterIndex,_rValue);
+ _xParams->setString(parameterIndex,_rValue.getString());
break;
case DataType::CLOB:
{
@@ -1823,26 +1813,26 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams,
break;
case DataType::BIGINT:
if ( _rValue.isSigned() )
- _xParams->setLong(parameterIndex,_rValue);
+ _xParams->setLong(parameterIndex,_rValue.getLong());
else
- _xParams->setString(parameterIndex,_rValue);
+ _xParams->setString(parameterIndex,_rValue.getString());
break;
case DataType::FLOAT:
- _xParams->setFloat(parameterIndex,_rValue);
+ _xParams->setFloat(parameterIndex,_rValue.getFloat());
break;
case DataType::REAL:
case DataType::DOUBLE:
- _xParams->setDouble(parameterIndex,_rValue);
+ _xParams->setDouble(parameterIndex,_rValue.getDouble());
break;
case DataType::DATE:
- _xParams->setDate(parameterIndex,_rValue);
+ _xParams->setDate(parameterIndex,_rValue.getDate());
break;
case DataType::TIME:
- _xParams->setTime(parameterIndex,_rValue);
+ _xParams->setTime(parameterIndex,_rValue.getTime());
break;
case DataType::TIMESTAMP:
- _xParams->setTimestamp(parameterIndex,_rValue);
+ _xParams->setTimestamp(parameterIndex,_rValue.getDateTime());
break;
case DataType::BINARY:
case DataType::VARBINARY:
@@ -1875,25 +1865,25 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams,
break;
case DataType::BIT:
case DataType::BOOLEAN:
- _xParams->setBoolean(parameterIndex,static_cast<bool>(_rValue));
+ _xParams->setBoolean(parameterIndex,_rValue.getBool());
break;
case DataType::TINYINT:
if ( _rValue.isSigned() )
- _xParams->setByte(parameterIndex,_rValue);
+ _xParams->setByte(parameterIndex,_rValue.getInt8());
else
- _xParams->setShort(parameterIndex,_rValue);
+ _xParams->setShort(parameterIndex,_rValue.getInt16());
break;
case DataType::SMALLINT:
if ( _rValue.isSigned() )
- _xParams->setShort(parameterIndex,_rValue);
+ _xParams->setShort(parameterIndex,_rValue.getInt16());
else
- _xParams->setInt(parameterIndex,_rValue);
+ _xParams->setInt(parameterIndex,_rValue.getInt32());
break;
case DataType::INTEGER:
if ( _rValue.isSigned() )
- _xParams->setInt(parameterIndex,_rValue);
+ _xParams->setInt(parameterIndex,_rValue.getULong());
else
- _xParams->setLong(parameterIndex,_rValue);
+ _xParams->setLong(parameterIndex,_rValue.getLong());
break;
default:
{
@@ -1908,7 +1898,7 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams,
}
}
-void getBooleanComparisonPredicate( const OUString& _rExpression, const bool _bValue, const sal_Int32 _nBooleanComparisonMode,
+void getBooleanComparisonPredicate( std::u16string_view _rExpression, const bool _bValue, const sal_Int32 _nBooleanComparisonMode,
OUStringBuffer& _out_rSQLPredicate )
{
switch ( _nBooleanComparisonMode )
@@ -2024,8 +2014,8 @@ namespace dbase
case 0x65: eEncoding = RTL_TEXTENCODING_IBM_866; break; // Russian MS-DOS code page 866
case 0x66: eEncoding = RTL_TEXTENCODING_IBM_865; break; // Nordic MS-DOS code page 865
case 0x67: eEncoding = RTL_TEXTENCODING_IBM_861; break; // Icelandic MS-DOS
- //case 0x68: eEncoding = ; break; // Kamenicky (Czech) MS-DOS
- //case 0x69: eEncoding = ; break; // Mazovia (Polish) MS-DOS
+ case 0x68: eEncoding = RTL_TEXTENCODING_KAMENICKY; break; // Kamenicky (Czech) MS-DOS
+ case 0x69: eEncoding = RTL_TEXTENCODING_MAZOVIA; break; // Mazovia (Polish) MS-DOS
case 0x6A: eEncoding = RTL_TEXTENCODING_IBM_737; break; // Greek MS-DOS (437G)
case 0x6B: eEncoding = RTL_TEXTENCODING_IBM_857; break; // Turkish MS-DOS
case 0x6C: eEncoding = RTL_TEXTENCODING_IBM_863; break; // MS-DOS, Canada
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 01cdcc03aa76..1da346c2630b 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -45,7 +45,7 @@
#include <com/sun/star/container/XChild.hpp>
#include <comphelper/types.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <algorithm>
#include <string_view>
@@ -122,37 +122,45 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
{
sal_Int32 nIndex = sTypeName.indexOf(sAutoIncrementValue);
if (nIndex != -1)
- sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex,OUString());
+ sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex, u"");
}
if ( (nPrecision > 0 || nScale > 0) && bUseLiteral )
{
- sal_Int32 nParenPos = sTypeName.indexOf('(');
+ bool bTimed = (nDataType == DataType::TIME ||
+ nDataType == DataType::TIME_WITH_TIMEZONE ||
+ nDataType == DataType::TIMESTAMP ||
+ nDataType == DataType::TIMESTAMP_WITH_TIMEZONE);
+
+ sal_Int32 nParenPos = (nDataType == DataType::TIME_WITH_TIMEZONE ||
+ nDataType == DataType::TIMESTAMP_WITH_TIMEZONE) ?
+ sTypeName.indexOf(' ') :
+ sTypeName.indexOf('(');
+
if ( nParenPos == -1 )
- {
aSql.append(sTypeName);
- aSql.append("(");
- }
else
- {
- aSql.append(std::u16string_view(sTypeName).substr(0, ++nParenPos));
- }
+ aSql.append(sTypeName.subView(0, nParenPos));
+ aSql.append("(");
- if ( nPrecision > 0 && nDataType != DataType::TIMESTAMP )
+ if ( nPrecision > 0 && !bTimed )
{
aSql.append(nPrecision);
if ( (nScale > 0) || (!_sCreatePattern.empty() && sCreateParams.indexOf(_sCreatePattern) != -1) )
aSql.append(",");
}
- if ( (nScale > 0) || ( !_sCreatePattern.empty() && sCreateParams.indexOf(_sCreatePattern) != -1 ) || nDataType == DataType::TIMESTAMP )
+ if ( (nScale > 0) || ( !_sCreatePattern.empty() && sCreateParams.indexOf(_sCreatePattern) != -1 ) || bTimed )
aSql.append(nScale);
if ( nParenPos == -1 )
aSql.append(")");
else
{
- nParenPos = sTypeName.indexOf(')',nParenPos);
- aSql.append(std::u16string_view(sTypeName).substr(nParenPos));
+ if ( bTimed )
+ aSql.append(")");
+ else
+ nParenPos = sTypeName.indexOf(')',nParenPos);
+ aSql.append(sTypeName.subView(nParenPos));
}
}
else
@@ -161,10 +169,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
OUString aDefault = ::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)));
if ( !aDefault.isEmpty() )
{
- aSql.append(" DEFAULT ");
- aSql.append(sPrefix);
- aSql.append(aDefault);
- aSql.append(sPostfix);
+ aSql.append(" DEFAULT " + sPrefix + aDefault + sPostfix);
} // if ( aDefault.getLength() )
return aSql.makeStringAndClear();
@@ -180,7 +185,7 @@ OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,cons
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bIsAutoIncrement;
const OUString sQuoteString = xMetaData->getIdentifierQuoteString();
- OUStringBuffer aSql = ::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))));
+ OUStringBuffer aSql(::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))));
// check if the user enter a specific string to create autoincrement values
OUString sAutoIncrementValue;
@@ -188,17 +193,14 @@ OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,cons
if ( xPropInfo.is() && xPropInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION)) )
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION)) >>= sAutoIncrementValue;
- aSql.append(" ");
-
- aSql.append(createStandardTypePart(xColProp, _xConnection, _sCreatePattern));
+ aSql.append(" " + createStandardTypePart(xColProp, _xConnection, _sCreatePattern));
if(::comphelper::getINT32(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS)
aSql.append(" NOT NULL");
if ( bIsAutoIncrement && !sAutoIncrementValue.isEmpty())
{
- aSql.append(" ");
- aSql.append(sAutoIncrementValue);
+ aSql.append(" " + sAutoIncrementValue);
}
if ( _pHelper )
@@ -224,8 +226,7 @@ OUString createStandardCreateStatement(const Reference< XPropertySet >& descript
if ( sComposedName.isEmpty() )
::dbtools::throwFunctionSequenceException(_xConnection);
- aSql.append(sComposedName);
- aSql.append(" (");
+ aSql.append(sComposedName + " (");
// columns
Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
@@ -241,8 +242,9 @@ OUString createStandardCreateStatement(const Reference< XPropertySet >& descript
{
if ( (xColumns->getByIndex(i) >>= xColProp) && xColProp.is() )
{
- aSql.append(createStandardColumnPart(xColProp,_xConnection,_pHelper,_sCreatePattern));
- aSql.append(",");
+ aSql.append(
+ createStandardColumnPart(xColProp,_xConnection,_pHelper,_sCreatePattern)
+ + ",");
}
}
return aSql.makeStringAndClear();
@@ -261,8 +263,8 @@ namespace
for(sal_Int32 i=0;i<nColCount;++i)
{
if ( (_xColumns->getByIndex(i) >>= xColProp) && xColProp.is() )
- sSql.append( ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) )
- .append(",");
+ sSql.append( ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) +
+ ",");
}
if ( nColCount )
@@ -305,8 +307,7 @@ OUString createStandardKeyStatement(const Reference< XPropertySet >& descriptor,
if(!xColumns.is() || !xColumns->getCount())
::dbtools::throwFunctionSequenceException(_xConnection);
- aSql.append(" PRIMARY KEY ");
- aSql.append(generateColumnNames(xColumns,xMetaData));
+ aSql.append(" PRIMARY KEY " + generateColumnNames(xColumns,xMetaData));
}
else if(nKeyType == KeyType::UNIQUE)
{
@@ -315,8 +316,7 @@ OUString createStandardKeyStatement(const Reference< XPropertySet >& descriptor,
if(!xColumns.is() || !xColumns->getCount())
::dbtools::throwFunctionSequenceException(_xConnection);
- aSql.append(" UNIQUE ");
- aSql.append(generateColumnNames(xColumns,xMetaData));
+ aSql.append(" UNIQUE " + generateColumnNames(xColumns,xMetaData));
}
else if(nKeyType == KeyType::FOREIGN)
{
@@ -387,7 +387,7 @@ OUString createSqlCreateTableStatement( const Reference< XPropertySet >& descri
else
{
if ( aSql.endsWith(",") )
- aSql = aSql.replaceAt(aSql.getLength()-1, 1, ")");
+ aSql = aSql.replaceAt(aSql.getLength()-1, 1, u")");
else
aSql += ")";
}
@@ -408,101 +408,100 @@ namespace
bool _bIsCurrency,
sal_Int32 _nDataType)
{
- Reference<XPropertySet> xProp;
Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
Reference< XResultSet > xResult = xMetaData->getColumns(_aCatalog, _aSchema, _aTable, _rQueryName);
OUString sCatalog;
_aCatalog >>= sCatalog;
- if ( xResult.is() )
+ if ( !xResult.is() )
+ return nullptr;
+
+ rtl::Reference<connectivity::sdbcx::OColumn> xProp;
+ UStringMixEqual aMixCompare(_bCase);
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while( xResult->next() )
{
- UStringMixEqual aMixCompare(_bCase);
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while( xResult->next() )
+ if ( aMixCompare(xRow->getString(4),_rName) )
{
- if ( aMixCompare(xRow->getString(4),_rName) )
+ sal_Int32 nField5 = xRow->getInt(5);
+ OUString aField6 = xRow->getString(6);
+ sal_Int32 nField7 = xRow->getInt(7)
+ , nField9 = xRow->getInt(9)
+ , nField11= xRow->getInt(11);
+ OUString sField12 = xRow->getString(12),
+ sField13 = xRow->getString(13);
+ ::comphelper::disposeComponent(xRow);
+
+ bool bAutoIncrement = _bIsAutoIncrement
+ ,bIsCurrency = _bIsCurrency;
+ if ( _bQueryForInfo )
{
- sal_Int32 nField5 = xRow->getInt(5);
- OUString aField6 = xRow->getString(6);
- sal_Int32 nField7 = xRow->getInt(7)
- , nField9 = xRow->getInt(9)
- , nField11= xRow->getInt(11);
- OUString sField12 = xRow->getString(12),
- sField13 = xRow->getString(13);
- ::comphelper::disposeComponent(xRow);
-
- bool bAutoIncrement = _bIsAutoIncrement
- ,bIsCurrency = _bIsCurrency;
- if ( _bQueryForInfo )
+ const OUString sQuote = xMetaData->getIdentifierQuoteString();
+ OUString sQuotedName = ::dbtools::quoteName(sQuote,_rName);
+ OUString sComposedName = composeTableNameForSelect(_xConnection, getString( _aCatalog ), _aSchema, _aTable );
+
+ ColumnInformationMap aInfo((UStringMixLess(_bCase)));
+ collectColumnInformation(_xConnection,sComposedName,sQuotedName,aInfo);
+ ColumnInformationMap::const_iterator aIter = aInfo.begin();
+ if ( aIter != aInfo.end() )
{
- const OUString sQuote = xMetaData->getIdentifierQuoteString();
- OUString sQuotedName = ::dbtools::quoteName(sQuote,_rName);
- OUString sComposedName = composeTableNameForSelect(_xConnection, getString( _aCatalog ), _aSchema, _aTable );
-
- ColumnInformationMap aInfo(_bCase);
- collectColumnInformation(_xConnection,sComposedName,sQuotedName,aInfo);
- ColumnInformationMap::const_iterator aIter = aInfo.begin();
- if ( aIter != aInfo.end() )
- {
- bAutoIncrement = aIter->second.first.first;
- bIsCurrency = aIter->second.first.second;
- if ( DataType::OTHER == nField5 )
- nField5 = aIter->second.second;
- }
+ bAutoIncrement = aIter->second.first.first;
+ bIsCurrency = aIter->second.first.second;
+ if ( DataType::OTHER == nField5 )
+ nField5 = aIter->second.second;
}
- else if ( DataType::OTHER == nField5 )
- nField5 = _nDataType;
+ }
+ else if ( DataType::OTHER == nField5 )
+ nField5 = _nDataType;
- if ( nField11 != ColumnValue::NO_NULLS )
+ if ( nField11 != ColumnValue::NO_NULLS )
+ {
+ try
{
- try
+ if ( _xPrimaryKeyColumns.is() )
{
- if ( _xPrimaryKeyColumns.is() )
- {
- if ( _xPrimaryKeyColumns->hasByName(_rName) )
- nField11 = ColumnValue::NO_NULLS;
+ if ( _xPrimaryKeyColumns->hasByName(_rName) )
+ nField11 = ColumnValue::NO_NULLS;
- }
- else
+ }
+ else
+ {
+ Reference< XResultSet > xPKeys = xMetaData->getPrimaryKeys( _aCatalog, _aSchema, _aTable );
+ Reference< XRow > xPKeyRow( xPKeys, UNO_QUERY_THROW );
+ while( xPKeys->next() ) // there can be only one primary key
{
- Reference< XResultSet > xPKeys = xMetaData->getPrimaryKeys( _aCatalog, _aSchema, _aTable );
- Reference< XRow > xPKeyRow( xPKeys, UNO_QUERY_THROW );
- while( xPKeys->next() ) // there can be only one primary key
+ OUString sKeyColumn = xPKeyRow->getString(4);
+ if ( aMixCompare(_rName,sKeyColumn) )
{
- OUString sKeyColumn = xPKeyRow->getString(4);
- if ( aMixCompare(_rName,sKeyColumn) )
- {
- nField11 = ColumnValue::NO_NULLS;
- break;
- }
+ nField11 = ColumnValue::NO_NULLS;
+ break;
}
}
}
- catch(SQLException&)
- {
- TOOLS_WARN_EXCEPTION( "connectivity.commontools", "lcl_createSDBCXColumn" );
- }
}
-
- connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName,
- aField6,
- sField13,
- sField12,
- nField11,
- nField7,
- nField9,
- nField5,
- bAutoIncrement,
- false,
- bIsCurrency,
- _bCase,
- sCatalog,
- _aSchema,
- _aTable);
-
- xProp = pRet;
- break;
+ catch(SQLException&)
+ {
+ TOOLS_WARN_EXCEPTION( "connectivity.commontools", "lcl_createSDBCXColumn" );
+ }
}
+
+ xProp = new connectivity::sdbcx::OColumn(_rName,
+ aField6,
+ sField13,
+ sField12,
+ nField11,
+ nField7,
+ nField9,
+ nField5,
+ bAutoIncrement,
+ false,
+ bIsCurrency,
+ _bCase,
+ sCatalog,
+ _aSchema,
+ _aTable);
+
+ break;
}
}
@@ -551,7 +550,7 @@ Reference<XPropertySet> createSDBCXColumn(const Reference<XPropertySet>& _xTable
xProp = lcl_createSDBCXColumn(xPrimaryKeyColumns,_xConnection,aCatalog, aSchema, aTable, _rName,_rName,_bCase,_bQueryForInfo,_bIsAutoIncrement,_bIsCurrency,_nDataType);
if ( !xProp.is() )
{
- xProp = lcl_createSDBCXColumn(xPrimaryKeyColumns,_xConnection,aCatalog, aSchema, aTable, "%",_rName,_bCase,_bQueryForInfo,_bIsAutoIncrement,_bIsCurrency,_nDataType);
+ xProp = lcl_createSDBCXColumn(xPrimaryKeyColumns,_xConnection,aCatalog, aSchema, aTable, u"%"_ustr,_rName,_bCase,_bQueryForInfo,_bIsAutoIncrement,_bIsCurrency,_nDataType);
if ( !xProp.is() )
xProp = new connectivity::sdbcx::OColumn(_rName,
OUString(),OUString(),OUString(),
@@ -575,6 +574,11 @@ Reference<XPropertySet> createSDBCXColumn(const Reference<XPropertySet>& _xTable
bool getBooleanDataSourceSetting( const Reference< XConnection >& _rxConnection, const char* _pAsciiSettingName )
{
+ return getBooleanDataSourceSetting(_rxConnection, OUString::createFromAscii( _pAsciiSettingName ));
+}
+
+bool getBooleanDataSourceSetting( const Reference< XConnection >& _rxConnection, const OUString & rSettingName )
+{
bool bValue( false );
try
{
@@ -583,10 +587,10 @@ bool getBooleanDataSourceSetting( const Reference< XConnection >& _rxConnection,
if ( xDataSourceProperties.is() )
{
Reference< XPropertySet > xSettings(
- xDataSourceProperties->getPropertyValue("Settings"),
+ xDataSourceProperties->getPropertyValue(u"Settings"_ustr),
UNO_QUERY_THROW
);
- OSL_VERIFY( xSettings->getPropertyValue( OUString::createFromAscii( _pAsciiSettingName ) ) >>= bValue );
+ OSL_VERIFY( xSettings->getPropertyValue( rSettingName ) >>= bValue );
}
}
catch( const Exception& )
@@ -607,7 +611,7 @@ bool getDataSourceSetting( const Reference< XInterface >& _xChild, const OUStrin
return false;
const Reference< XPropertySet > xSettings(
- xDataSourceProperties->getPropertyValue("Settings"),
+ xDataSourceProperties->getPropertyValue(u"Settings"_ustr),
UNO_QUERY_THROW
);
@@ -621,13 +625,6 @@ bool getDataSourceSetting( const Reference< XInterface >& _xChild, const OUStrin
return bIsPresent;
}
-bool getDataSourceSetting( const Reference< XInterface >& _rxDataSource, const char* _pAsciiSettingsName,
- Any& /* [out] */ _rSettingsValue )
-{
- OUString sAsciiSettingsName = OUString::createFromAscii(_pAsciiSettingsName);
- return getDataSourceSetting( _rxDataSource, sAsciiSettingsName,_rSettingsValue );
-}
-
bool isDataSourcePropertyEnabled(const Reference<XInterface>& _xProp, const OUString& _sProperty, bool _bDefault)
{
bool bEnabled = _bDefault;
@@ -637,12 +634,12 @@ bool isDataSourcePropertyEnabled(const Reference<XInterface>& _xProp, const OUSt
if ( xProp.is() )
{
Sequence< PropertyValue > aInfo;
- xProp->getPropertyValue("Info") >>= aInfo;
- const PropertyValue* pValue =std::find_if(aInfo.begin(),
- aInfo.end(),
+ xProp->getPropertyValue(u"Info"_ustr) >>= aInfo;
+ const PropertyValue* pValue =std::find_if(std::cbegin(aInfo),
+ std::cend(aInfo),
[&_sProperty](const PropertyValue& lhs)
{ return lhs.Name == _sProperty; });
- if ( pValue != aInfo.end() )
+ if ( pValue != std::cend(aInfo) )
pValue->Value >>= bEnabled;
}
}
@@ -741,7 +738,7 @@ sal_Int32 getTablePrivileges(const Reference< XDatabaseMetaData>& _xMetaData,
// Some drivers put a table privilege as soon as any column has the privilege,
// some drivers only if all columns have the privilege.
// To unify the situation, collect column privileges here, too.
- Reference< XResultSet > xColumnPrivileges = _xMetaData->getColumnPrivileges(aVal, _sSchema, _sTable, "%");
+ Reference< XResultSet > xColumnPrivileges = _xMetaData->getColumnPrivileges(aVal, _sSchema, _sTable, u"%"_ustr);
Reference< XRow > xColumnCurrentRow(xColumnPrivileges, UNO_QUERY);
if ( xColumnCurrentRow.is() )
{
@@ -810,7 +807,7 @@ void collectColumnInformation(const Reference< XConnection>& _xConnection,
{
::utl::SharedUNOComponent< XStatement > xStmt( _xConnection->createStatement() );
Reference< XPropertySet > xStatementProps( xStmt, UNO_QUERY_THROW );
- xStatementProps->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ESCAPEPROCESSING ), makeAny( false ) );
+ xStatementProps->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ESCAPEPROCESSING ), Any( false ) );
Reference< XResultSet > xResult( xStmt->executeQuery( sSelect ), UNO_SET_THROW );
Reference< XResultSetMetaDataSupplier > xSuppMeta( xResult, UNO_QUERY_THROW );
Reference< XResultSetMetaData > xMeta( xSuppMeta->getMetaData(), UNO_SET_THROW );
@@ -839,22 +836,15 @@ bool isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Referenc
if ( xModel.is() )
{
- Sequence< PropertyValue > aArgs = xModel->getArgs();
- const PropertyValue* pIter = aArgs.getConstArray();
- const PropertyValue* pEnd = pIter + aArgs.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& arg : xModel->getArgs())
{
- if ( pIter->Name == "ComponentData" )
+ if (arg.Name == "ComponentData")
{
Sequence<PropertyValue> aDocumentContext;
- pIter->Value >>= aDocumentContext;
- const PropertyValue* pContextIter = aDocumentContext.getConstArray();
- const PropertyValue* pContextEnd = pContextIter + aDocumentContext.getLength();
- for(;pContextIter != pContextEnd;++pContextIter)
+ arg.Value >>= aDocumentContext;
+ for (auto& item : aDocumentContext)
{
- if ( pContextIter->Name == "ActiveConnection"
- && ( pContextIter->Value >>= _rxActualConnection )
- )
+ if (item.Name == "ActiveConnection" && (item.Value >>= _rxActualConnection))
{
bIsEmbedded = true;
break;
@@ -907,7 +897,7 @@ sal_Int32 DBTypeConversion::convertUnicodeString( const OUString& _rSource, OStr
throw SQLException(
sMessage,
nullptr,
- "22018",
+ u"22018"_ustr,
22018,
Any()
);
@@ -933,7 +923,7 @@ sal_Int32 DBTypeConversion::convertUnicodeStringToLength( const OUString& _rSour
throw SQLException(
sMessage,
nullptr,
- "22001",
+ u"22001"_ustr,
22001,
Any()
);
@@ -941,56 +931,42 @@ sal_Int32 DBTypeConversion::convertUnicodeStringToLength( const OUString& _rSour
return nLen;
}
-static OUString lcl_getReportEngines()
-{
- return "org.openoffice.Office.DataAccess/ReportEngines";
-}
-
-static OUString lcl_getDefaultReportEngine()
-{
- return "DefaultReportEngine";
-}
-
-static OUString lcl_getReportEngineNames()
-{
- return "ReportEngineNames";
-}
OUString getDefaultReportEngineServiceName(const Reference< XComponentContext >& _rxORB)
{
::utl::OConfigurationTreeRoot aReportEngines = ::utl::OConfigurationTreeRoot::createWithComponentContext(
- _rxORB, lcl_getReportEngines(), -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ _rxORB, u"org.openoffice.Office.DataAccess/ReportEngines"_ustr, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
if ( aReportEngines.isValid() )
{
OUString sDefaultReportEngineName;
- aReportEngines.getNodeValue(lcl_getDefaultReportEngine()) >>= sDefaultReportEngineName;
+ aReportEngines.getNodeValue(u"DefaultReportEngine"_ustr) >>= sDefaultReportEngineName;
if ( !sDefaultReportEngineName.isEmpty() )
{
- ::utl::OConfigurationNode aReportEngineNames = aReportEngines.openNode(lcl_getReportEngineNames());
+ ::utl::OConfigurationNode aReportEngineNames = aReportEngines.openNode(u"ReportEngineNames"_ustr);
if ( aReportEngineNames.isValid() )
{
::utl::OConfigurationNode aReportEngine = aReportEngineNames.openNode(sDefaultReportEngineName);
if ( aReportEngine.isValid() )
{
OUString sRet;
- aReportEngine.getNodeValue("ServiceName") >>= sRet;
+ aReportEngine.getNodeValue(u"ServiceName"_ustr) >>= sRet;
return sRet;
}
}
}
else
- return "org.libreoffice.report.pentaho.SOReportJobFactory";
+ return u"org.libreoffice.report.pentaho.SOReportJobFactory"_ustr;
}
else
- return "org.libreoffice.report.pentaho.SOReportJobFactory";
+ return u"org.libreoffice.report.pentaho.SOReportJobFactory"_ustr;
return OUString();
}
bool isAggregateColumn(const Reference< XSingleSelectQueryComposer > &_xParser, const Reference< XPropertySet > &_xField)
{
OUString sName;
- _xField->getPropertyValue("Name") >>= sName;
+ _xField->getPropertyValue(u"Name"_ustr) >>= sName;
Reference< XColumnsSupplier > xColumnsSupplier(_xParser, UNO_QUERY);
Reference< css::container::XNameAccess > xCols;
if (xColumnsSupplier.is())
@@ -1014,7 +990,7 @@ bool isAggregateColumn( const Reference< XPropertySet > &_xColumn )
{
bool bAgg(false);
- static constexpr OUStringLiteral sAgg = u"AggregateFunction";
+ static constexpr OUString sAgg = u"AggregateFunction"_ustr;
if ( _xColumn->getPropertySetInfo()->hasPropertyByName(sAgg) )
_xColumn->getPropertyValue(sAgg) >>= bAgg;
diff --git a/connectivity/source/commontools/filtermanager.cxx b/connectivity/source/commontools/filtermanager.cxx
index a6180dd00666..fa9fc7116d92 100644
--- a/connectivity/source/commontools/filtermanager.cxx
+++ b/connectivity/source/commontools/filtermanager.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
#include <TConnection.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <rtl/ustrbuf.hxx>
@@ -31,9 +31,6 @@ namespace dbtools
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace connectivity;
@@ -49,7 +46,7 @@ namespace dbtools
OSL_ENSURE( m_xComponentAggregate.is(), "FilterManager::initialize: invalid arguments!" );
if ( m_xComponentAggregate.is() )
- m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_APPLYFILTER), makeAny( true ) );
+ m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_APPLYFILTER), Any( true ) );
}
@@ -74,7 +71,7 @@ namespace dbtools
}
assert(false);
- static const OUString sErr("#FilterManager::getFilterComponent unknown component#");
+ static constexpr OUString sErr(u"#FilterManager::getFilterComponent unknown component#"_ustr);
return sErr;
}
@@ -108,14 +105,14 @@ namespace dbtools
[[fallthrough]];
case FilterComponent::LinkFilter:
if (propagate)
- m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FILTER), makeAny( getComposedFilter() ) );
+ m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FILTER), Any( getComposedFilter() ) );
break;
case FilterComponent::PublicHaving:
propagate = propagate && m_bApplyPublicFilter;
[[fallthrough]];
case FilterComponent::LinkHaving:
if (propagate)
- m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HAVINGCLAUSE), makeAny( getComposedHaving() ) );
+ m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HAVINGCLAUSE), Any( getComposedHaving() ) );
break;
}
}
@@ -140,9 +137,9 @@ namespace dbtools
{
// only where/if something changed
if (!getFilterComponent( FilterComponent::PublicFilter ).isEmpty())
- m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FILTER), makeAny( getComposedFilter() ) );
+ m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FILTER), Any( getComposedFilter() ) );
if (!getFilterComponent( FilterComponent::PublicHaving ).isEmpty())
- m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HAVINGCLAUSE), makeAny( getComposedHaving() ) );
+ m_xComponentAggregate->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HAVINGCLAUSE), Any( getComposedHaving() ) );
}
}
catch( const Exception& )
@@ -152,7 +149,7 @@ namespace dbtools
}
- void FilterManager::appendFilterComponent( OUStringBuffer& io_appendTo, const OUString& i_component )
+ void FilterManager::appendFilterComponent( OUStringBuffer& io_appendTo, std::u16string_view i_component )
{
if ( !io_appendTo.isEmpty() )
{
diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx
index de317c43b4ab..07c9418032e5 100644
--- a/connectivity/source/commontools/formattedcolumnvalue.cxx
+++ b/connectivity/source/commontools/formattedcolumnvalue.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/sdb/XColumn.hpp>
#include <com/sun/star/sdb/XColumnUpdate.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <comphelper/numbers.hxx>
@@ -76,14 +76,11 @@ namespace dbtools
Reference< XColumnUpdate > m_xColumnUpdate;
FormattedColumnValue_Data()
- :m_xFormatter()
- ,m_aNullDate( DBTypeConversion::getStandardDate() )
+ :m_aNullDate( DBTypeConversion::getStandardDate() )
,m_nFormatKey( 0 )
,m_nFieldType( DataType::OTHER )
,m_nKeyType( NumberFormat::UNDEFINED )
,m_bNumericField( false )
- ,m_xColumn()
- ,m_xColumnUpdate()
{
}
};
@@ -123,13 +120,15 @@ namespace dbtools
_rData.m_xColumnUpdate.set( _rxColumn, UNO_QUERY );
// determine the field type, and whether it's a numeric field
- OSL_VERIFY( _rxColumn->getPropertyValue("Type") >>= _rData.m_nFieldType );
+ OSL_VERIFY( _rxColumn->getPropertyValue(u"Type"_ustr) >>= _rData.m_nFieldType );
switch ( _rData.m_nFieldType )
{
case DataType::DATE:
case DataType::TIME:
+ case DataType::TIME_WITH_TIMEZONE:
case DataType::TIMESTAMP:
+ case DataType::TIMESTAMP_WITH_TIMEZONE:
case DataType::BIT:
case DataType::BOOLEAN:
case DataType::TINYINT:
@@ -150,7 +149,7 @@ namespace dbtools
// get the format key of our bound field
Reference< XPropertySetInfo > xPSI( _rxColumn->getPropertySetInfo(), UNO_SET_THROW );
bool bHaveFieldFormat = false;
- const OUString sFormatKeyProperty( "FormatKey" );
+ static constexpr OUString sFormatKeyProperty( u"FormatKey"_ustr );
if ( xPSI->hasPropertyByName( sFormatKeyProperty ) )
{
bHaveFieldFormat = ( _rxColumn->getPropertyValue( sFormatKeyProperty ) >>= _rData.m_nFormatKey );
@@ -158,7 +157,7 @@ namespace dbtools
if ( !bHaveFieldFormat )
{
// fall back to a format key as indicated by the field type
- Locale aSystemLocale( LanguageTag( MsLangId::getSystemLanguage() ).getLocale() );
+ Locale aSystemLocale( LanguageTag( MsLangId::getConfiguredSystemLanguage() ).getLocale() );
Reference< XNumberFormatTypes > xNumTypes( xNumberFormatsSupp->getNumberFormats(), UNO_QUERY_THROW );
_rData.m_nFormatKey = getDefaultNumberFormat( _rxColumn, xNumTypes, aSystemLocale );
}
@@ -166,7 +165,7 @@ namespace dbtools
// some more formatter settings
_rData.m_nKeyType = ::comphelper::getNumberFormatType( xNumberFormatsSupp->getNumberFormats(), _rData.m_nFormatKey );
Reference< XPropertySet > xFormatSettings( xNumberFormatsSupp->getNumberFormatSettings(), UNO_SET_THROW );
- OSL_VERIFY( xFormatSettings->getPropertyValue("NullDate") >>= _rData.m_aNullDate );
+ OSL_VERIFY( xFormatSettings->getPropertyValue(u"NullDate"_ustr) >>= _rData.m_aNullDate );
// remember the formatter
_rData.m_xFormatter = i_rNumberFormatter;
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index bd114ea19341..62710654e507 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -33,7 +33,7 @@
#include <connectivity/filtermanager.hxx>
#include <TConnection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <ParameterCont.hxx>
#include <o3tl/safeint.hxx>
@@ -46,7 +46,6 @@ namespace dbtools
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::form;
@@ -99,15 +98,13 @@ namespace dbtools
m_pOuterParameters->dispose();
m_pOuterParameters = nullptr;
m_nInnerCount = 0;
- ParameterInformation aEmptyInfo;
- m_aParameterInformation.swap( aEmptyInfo );
+ ParameterInformation().swap(m_aParameterInformation);
m_aMasterFields.clear();
m_aDetailFields.clear();
m_sIdentifierQuoteString.clear();
m_sSpecialCharacters.clear();
m_xConnectionMetadata.clear();
- std::vector< bool > aEmptyArray;
- m_aParametersVisited.swap( aEmptyArray );
+ std::vector< bool >().swap(m_aParametersVisited);
m_bUpToDate = false;
}
@@ -213,15 +210,15 @@ namespace dbtools
// <detail_column> = :<new_param_name>
{
OUString tblName;
- xDetailField->getPropertyValue("TableName") >>= tblName;
+ xDetailField->getPropertyValue(u"TableName"_ustr) >>= tblName;
if (!tblName.isEmpty())
sFilter = ::dbtools::quoteTableName( m_xConnectionMetadata, tblName, ::dbtools::EComposeRule::InDataManipulation ) + ".";
}
{
OUString colName;
- xDetailField->getPropertyValue("RealName") >>= colName;
+ xDetailField->getPropertyValue(u"RealName"_ustr) >>= colName;
bool isFunction(false);
- xDetailField->getPropertyValue("Function") >>= isFunction;
+ xDetailField->getPropertyValue(u"Function"_ustr) >>= isFunction;
if (isFunction)
sFilter += colName;
else
@@ -395,9 +392,7 @@ namespace dbtools
if ( !sAdditionalFilter.isEmpty() )
sAdditionalFilter.append(" AND ");
- sAdditionalFilter.append("( ");
- sAdditionalFilter.append(elem);
- sAdditionalFilter.append(" )");
+ sAdditionalFilter.append("( " + elem + " )");
}
// now set this filter at the filter manager
@@ -415,9 +410,7 @@ namespace dbtools
if ( !sAdditionalHaving.isEmpty() )
sAdditionalHaving.append(" AND ");
- sAdditionalHaving.append("( ");
- sAdditionalHaving.append(elem);
- sAdditionalHaving.append(" )");
+ sAdditionalHaving.append("( " + elem + " )");
}
// now set this having clause at the filter manager
@@ -482,7 +475,7 @@ namespace dbtools
// property, but the parameter listeners expect such a property. So we need an object "aggregating"
// xParam and supplying an additional property ("Value")
// (it's no real aggregation of course...)
- m_pOuterParameters->push_back( new param::ParameterWrapper( aParam.second.xComposerColumn, m_xInnerParamUpdate, aParam.second.aInnerIndexes ) );
+ m_pOuterParameters->push_back( new param::ParameterWrapper( aParam.second.xComposerColumn, m_xInnerParamUpdate, std::vector(aParam.second.aInnerIndexes) ) );
}
#if OSL_DEBUG_LEVEL > 0
@@ -645,15 +638,14 @@ namespace dbtools
OSL_ENSURE ( _rxCompletionHandler.is(), "ParameterManager::completeParameters: invalid interaction handler!" );
// two continuations (Ok and Cancel)
- OInteractionAbort* pAbort = new OInteractionAbort;
- OParameterContinuation* pParams = new OParameterContinuation;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
+ rtl::Reference<OParameterContinuation> pParams = new OParameterContinuation;
// the request
ParametersRequest aRequest;
aRequest.Parameters = m_pOuterParameters.get();
aRequest.Connection = _rxConnection;
- OInteractionRequest* pRequest = new OInteractionRequest( makeAny( aRequest ) );
- Reference< XInteractionRequest > xRequest( pRequest );
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest( Any( aRequest ) );
// some knittings
pRequest->addContinuation( pAbort );
@@ -662,7 +654,7 @@ namespace dbtools
// execute the request
try
{
- _rxCompletionHandler->handle( xRequest );
+ _rxCompletionHandler->handle( pRequest );
}
catch( const Exception& )
{
@@ -677,8 +669,7 @@ namespace dbtools
{
// transfer the values from the continuation object to the parameter columns
const Sequence< PropertyValue >& aFinalValues = pParams->getValues();
- const PropertyValue* pFinalValues = aFinalValues.getConstArray();
- for ( sal_Int32 i = 0; i < aFinalValues.getLength(); ++i, ++pFinalValues )
+ for (sal_Int32 i = 0; i < aFinalValues.getLength(); ++i)
{
Reference< XPropertySet > xParamColumn(aRequest.Parameters->getByIndex( i ),UNO_QUERY);
if ( xParamColumn.is() )
@@ -686,9 +677,9 @@ namespace dbtools
#ifdef DBG_UTIL
OUString sName;
xParamColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME) ) >>= sName;
- OSL_ENSURE( sName == pFinalValues->Name, "ParameterManager::completeParameters: inconsistent parameter names!" );
+ OSL_ENSURE( sName == aFinalValues[i].Name, "ParameterManager::completeParameters: inconsistent parameter names!" );
#endif
- xParamColumn->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), pFinalValues->Value );
+ xParamColumn->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), aFinalValues[i].Value );
// the property sets are wrapper classes, translating the Value property into a call to
// the appropriate XParameters interface
}
@@ -710,14 +701,14 @@ namespace dbtools
// TODO: shouldn't we subtract all the parameters which were already visited?
if ( nParamsLeft )
{
- ::comphelper::OInterfaceIteratorHelper2 aIter( m_aParameterListeners );
+ ::comphelper::OInterfaceIteratorHelper3 aIter( m_aParameterListeners );
Reference< XPropertySet > xProp = m_xComponent;
OSL_ENSURE(xProp.is(),"Some already released my component!");
- DatabaseParameterEvent aEvent( xProp.get(), m_pOuterParameters.get() );
+ DatabaseParameterEvent aEvent( xProp, m_pOuterParameters );
_rClearForNotifies.clear();
while ( aIter.hasMoreElements() && !bCanceled )
- bCanceled = !static_cast< XDatabaseParameterListener* >( aIter.next() )->approveParameter( aEvent );
+ bCanceled = !aIter.next()->approveParameter( aEvent );
_rClearForNotifies.reset();
}
@@ -959,144 +950,245 @@ namespace dbtools
m_aParametersVisited[ _nIndex - 1 ] = true;
}
-#define VISIT_PARAMETER( method ) \
- ::osl::MutexGuard aGuard( m_rMutex ); \
- OSL_ENSURE( m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!" ); \
- if ( !m_xInnerParamUpdate.is() ) \
- return; \
- m_xInnerParamUpdate->method; \
- externalParameterVisited( _nIndex ) \
-
-
void ParameterManager::setNull( sal_Int32 _nIndex, sal_Int32 sqlType )
{
- VISIT_PARAMETER( setNull( _nIndex, sqlType ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setNull(_nIndex, sqlType);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setObjectNull( sal_Int32 _nIndex, sal_Int32 sqlType, const OUString& typeName )
{
- VISIT_PARAMETER( setObjectNull( _nIndex, sqlType, typeName ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setObjectNull(_nIndex, sqlType, typeName);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setBoolean( sal_Int32 _nIndex, bool x )
{
- VISIT_PARAMETER( setBoolean( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setBoolean(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setByte( sal_Int32 _nIndex, sal_Int8 x )
{
- VISIT_PARAMETER( setByte( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setByte(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setShort( sal_Int32 _nIndex, sal_Int16 x )
{
- VISIT_PARAMETER( setShort( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setShort(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setInt( sal_Int32 _nIndex, sal_Int32 x )
{
- VISIT_PARAMETER( setInt( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setInt(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setLong( sal_Int32 _nIndex, sal_Int64 x )
{
- VISIT_PARAMETER( setLong( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setLong(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setFloat( sal_Int32 _nIndex, float x )
{
- VISIT_PARAMETER( setFloat( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setFloat(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setDouble( sal_Int32 _nIndex, double x )
{
- VISIT_PARAMETER( setDouble( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setDouble(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setString( sal_Int32 _nIndex, const OUString& x )
{
- VISIT_PARAMETER( setString( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setString(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setBytes( sal_Int32 _nIndex, const css::uno::Sequence< sal_Int8 >& x )
{
- VISIT_PARAMETER( setBytes( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setBytes(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setDate( sal_Int32 _nIndex, const css::util::Date& x )
{
- VISIT_PARAMETER( setDate( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setDate(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setTime( sal_Int32 _nIndex, const css::util::Time& x )
{
- VISIT_PARAMETER( setTime( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setTime(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setTimestamp( sal_Int32 _nIndex, const css::util::DateTime& x )
{
- VISIT_PARAMETER( setTimestamp( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setTimestamp(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setBinaryStream( sal_Int32 _nIndex, const css::uno::Reference< css::io::XInputStream>& x, sal_Int32 length )
{
- VISIT_PARAMETER( setBinaryStream( _nIndex, x, length ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setBinaryStream(_nIndex, x, length);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setCharacterStream( sal_Int32 _nIndex, const css::uno::Reference< css::io::XInputStream>& x, sal_Int32 length )
{
- VISIT_PARAMETER( setCharacterStream( _nIndex, x, length ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setCharacterStream(_nIndex, x, length);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setObject( sal_Int32 _nIndex, const css::uno::Any& x )
{
- VISIT_PARAMETER( setObject( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setObject(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setObjectWithInfo( sal_Int32 _nIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale )
{
- VISIT_PARAMETER( setObjectWithInfo( _nIndex, x, targetSqlType, scale ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setObjectWithInfo(_nIndex, x, targetSqlType, scale);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setRef( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XRef>& x )
{
- VISIT_PARAMETER( setRef( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setRef(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setBlob( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XBlob>& x )
{
- VISIT_PARAMETER( setBlob( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setBlob(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setClob( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XClob>& x )
{
- VISIT_PARAMETER( setClob( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setClob(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
void ParameterManager::setArray( sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XArray>& x )
{
- VISIT_PARAMETER( setArray( _nIndex, x ) );
+ ::osl::MutexGuard aGuard(m_rMutex);
+ OSL_ENSURE(m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!");
+ if (!m_xInnerParamUpdate.is())
+ return;
+ m_xInnerParamUpdate->setArray(_nIndex, x);
+ externalParameterVisited(_nIndex);
}
diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx
index ffe42419daa6..d213d6625602 100644
--- a/connectivity/source/commontools/paramwrapper.cxx
+++ b/connectivity/source/commontools/paramwrapper.cxx
@@ -28,7 +28,8 @@
#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
-#include <tools/diagnose_ex.h>
+#include <o3tl/safeint.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/enumhelper.hxx>
#define PROPERTY_ID_VALUE 1000
@@ -75,9 +76,9 @@ namespace dbtools::param
ParameterWrapper::ParameterWrapper( const Reference< XPropertySet >& _rxColumn,
- const Reference< XParameters >& _rxAllParameters, const std::vector< sal_Int32 >& _rIndexes )
+ const Reference< XParameters >& _rxAllParameters, std::vector< sal_Int32 >&& _rIndexes )
:PropertyBase( m_aBHelper )
- ,m_aIndexes( _rIndexes )
+ ,m_aIndexes( std::move(_rIndexes) )
,m_xDelegator( _rxColumn )
,m_xValueDestination( _rxAllParameters )
{
@@ -158,8 +159,8 @@ namespace dbtools::param
aProperties = m_xDelegatorPSI->getProperties();
sal_Int32 nProperties( aProperties.getLength() );
aProperties.realloc( nProperties + 1 );
- aProperties[ nProperties ] = Property(
- "Value",
+ aProperties.getArray()[ nProperties ] = Property(
+ u"Value"_ustr,
PROPERTY_ID_VALUE,
::cppu::UnoType< Any >::get(),
PropertyAttribute::TRANSIENT | PropertyAttribute::MAYBEVOID
@@ -195,11 +196,11 @@ namespace dbtools::param
{
// TODO : aParamType & nScale can be obtained within the constructor...
sal_Int32 nParamType = DataType::VARCHAR;
- OSL_VERIFY( m_xDelegator->getPropertyValue("Type") >>= nParamType );
+ OSL_VERIFY( m_xDelegator->getPropertyValue(u"Type"_ustr) >>= nParamType );
sal_Int32 nScale = 0;
- if ( m_xDelegatorPSI->hasPropertyByName("Scale") )
- OSL_VERIFY( m_xDelegator->getPropertyValue("Scale") >>= nScale );
+ if ( m_xDelegatorPSI->hasPropertyByName(u"Scale"_ustr) )
+ OSL_VERIFY( m_xDelegator->getPropertyValue(u"Scale"_ustr) >>= nScale );
if ( m_xValueDestination.is() )
{
@@ -214,11 +215,7 @@ namespace dbtools::param
}
catch( SQLException& e )
{
- WrappedTargetException aExceptionWrapper;
- aExceptionWrapper.Context = e.Context;
- aExceptionWrapper.Message = e.Message;
- aExceptionWrapper.TargetException <<= e;
- throw aExceptionWrapper;
+ throw WrappedTargetException(e.Message, e.Context, css::uno::Any(e));
}
}
else
@@ -257,13 +254,11 @@ namespace dbtools::param
}
ParameterWrapperContainer::ParameterWrapperContainer()
- :ParameterWrapperContainer_Base( m_aMutex )
{
}
ParameterWrapperContainer::ParameterWrapperContainer( const Reference< XSingleSelectQueryAnalyzer >& _rxComposer )
- :ParameterWrapperContainer_Base( m_aMutex )
{
Reference< XParametersSupplier > xSuppParams( _rxComposer, UNO_QUERY_THROW );
Reference< XIndexAccess > xParameters( xSuppParams->getParameters(), css::uno::UNO_SET_THROW );
@@ -283,7 +278,7 @@ namespace dbtools::param
Type SAL_CALL ParameterWrapperContainer::getElementType()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return cppu::UnoType<XPropertySet>::get();
}
@@ -291,7 +286,7 @@ namespace dbtools::param
sal_Bool SAL_CALL ParameterWrapperContainer::hasElements()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return !m_aParameters.empty();
}
@@ -299,7 +294,7 @@ namespace dbtools::param
sal_Int32 SAL_CALL ParameterWrapperContainer::getCount()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return m_aParameters.size();
}
@@ -307,19 +302,19 @@ namespace dbtools::param
Any SAL_CALL ParameterWrapperContainer::getByIndex( sal_Int32 _nIndex )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
- if ( ( _nIndex < 0 ) || ( _nIndex >= static_cast<sal_Int32>(m_aParameters.size()) ) )
+ if ( ( _nIndex < 0 ) || ( o3tl::make_unsigned(_nIndex) >= m_aParameters.size() ) )
throw IndexOutOfBoundsException();
- return makeAny( Reference< XPropertySet >( m_aParameters[ _nIndex ].get() ) );
+ return Any( Reference< XPropertySet >( m_aParameters[ _nIndex ] ) );
}
Reference< XEnumeration > ParameterWrapperContainer::createEnumeration()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
impl_checkDisposed_throw();
return new ::comphelper::OEnumerationByIndex( static_cast< XIndexAccess* >( this ) );
@@ -328,23 +323,19 @@ namespace dbtools::param
void ParameterWrapperContainer::impl_checkDisposed_throw()
{
- if ( rBHelper.bDisposed )
+ if ( m_bDisposed )
throw DisposedException( OUString(), *this );
}
- void SAL_CALL ParameterWrapperContainer::disposing()
+ void ParameterWrapperContainer::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- impl_checkDisposed_throw();
-
for (const auto& rxParam : m_aParameters)
{
rxParam->dispose();
}
- Parameters aEmpty;
- m_aParameters.swap( aEmpty );
+ Parameters().swap(m_aParameters);
}
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index f34ad6228532..b03bda56184a 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -30,7 +30,7 @@
#include <connectivity/sqlnode.hxx>
#include <connectivity/PColumn.hxx>
#include <comphelper/numbers.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <memory>
#include <string_view>
@@ -132,7 +132,7 @@ namespace dbtools
if ( !pReturn )
{ // is it a text field ?
sal_Int32 nType = DataType::OTHER;
- _rxField->getPropertyValue("Type") >>= nType;
+ _rxField->getPropertyValue(u"Type"_ustr) >>= nType;
if ( ( DataType::CHAR == nType )
|| ( DataType::VARCHAR == nType )
@@ -147,17 +147,7 @@ namespace dbtools
)
)
{
- static const char sSingleQuote[] = "'";
-
- sal_Int32 nIndex = -1;
- sal_Int32 nTemp = 0;
- while ( -1 != ( nIndex = sQuoted.indexOf( '\'',nTemp ) ) )
- {
- sQuoted = sQuoted.replaceAt( nIndex, 1, "''" );
- nTemp = nIndex+2;
- }
-
- sQuoted = sSingleQuote + sQuoted + sSingleQuote;
+ sQuoted = u"'" + sQuoted.replaceAll(u"'", u"''") + u"'";
}
pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, sQuoted, m_xFormatter, _rxField );
}
@@ -188,17 +178,17 @@ namespace dbtools
try
{
Reference< XPropertySetInfo > xPSI( _rxField->getPropertySetInfo() );
- if ( xPSI.is() && xPSI->hasPropertyByName("FormatKey") )
+ if ( xPSI.is() && xPSI->hasPropertyByName(u"FormatKey"_ustr) )
{
sal_Int32 nFormatKey = 0;
- _rxField->getPropertyValue("FormatKey") >>= nFormatKey;
+ _rxField->getPropertyValue(u"FormatKey"_ustr) >>= nFormatKey;
if ( nFormatKey && m_xFormatter.is() )
{
Locale aFormatLocale;
::comphelper::getNumberFormatProperty(
m_xFormatter,
nFormatKey,
- "Locale"
+ u"Locale"_ustr
) >>= aFormatLocale;
// valid locale
@@ -308,7 +298,7 @@ namespace dbtools
}
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- parse::OParseColumn* pColumn = new parse::OParseColumn( sField,
+ rtl::Reference<parse::OParseColumn> pColumn = new parse::OParseColumn( sField,
OUString(),
OUString(),
OUString(),
@@ -322,11 +312,10 @@ namespace dbtools
OUString(),
OUString(),
OUString());
- Reference<XPropertySet> xColumn = pColumn;
pColumn->setFunction(true);
pColumn->setRealName(sField);
- std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn );
+ std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, _rPredicateValue, pColumn );
if(pParseNode)
{
implParseNode(std::move(pParseNode), true) >>= sReturn;
diff --git a/connectivity/source/commontools/propertyids.cxx b/connectivity/source/commontools/propertyids.cxx
index 90c6beeede6a..cedd0f5f0614 100644
--- a/connectivity/source/commontools/propertyids.cxx
+++ b/connectivity/source/commontools/propertyids.cxx
@@ -95,6 +95,7 @@ namespace dbtools
const OUString& OPropertyMap::getNameByIndex(sal_Int32 _nIndex) const
{
std::map<sal_Int32, OUString>::const_iterator aIter = m_aPropertyMap.find(_nIndex);
+ assert(aIter != m_aPropertyMap.end());
return aIter->second;
}
}
diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx
index dee6f36f0b61..a4855e81d894 100644
--- a/connectivity/source/commontools/sqlerror.cxx
+++ b/connectivity/source/commontools/sqlerror.cxx
@@ -25,7 +25,6 @@
#include <com/sun/star/sdb/ErrorCondition.hpp>
#include <cppuhelper/exc_hlp.hxx>
-#include <rtl/ustrbuf.hxx>
#include <unotools/resmgr.hxx>
#include <osl/diagnose.h>
@@ -50,7 +49,7 @@ namespace connectivity
// versions of the public SQLError methods which are just delegated to this impl-class
static const OUString& getMessagePrefix();
- OUString getErrorMessage( const ErrorCondition _eCondition, const std::optional<OUString>& _rParamValue1, const std::optional<OUString>& _rParamValue2, const std::optional<OUString>& _rParamValue3 );
+ OUString getErrorMessage( const ErrorCondition _eCondition, const std::optional<OUString>& _rParamValue1, const std::optional<OUString>& _rParamValue2, const std::optional<OUString>& _rParamValue3 ) const;
static ErrorCode getErrorCode( const ErrorCondition _eCondition );
void raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const std::optional<OUString>& _rParamValue1, const std::optional<OUString>& _rParamValue2, const std::optional<OUString>& _rParamValue3 );
void raiseException( const ErrorCondition _eCondition, const std::optional<OUString>& _rParamValue1, const std::optional<OUString>& _rParamValue2, const std::optional<OUString>& _rParamValue3 );
@@ -59,8 +58,7 @@ namespace connectivity
private:
/// returns the basic error message associated with the given error condition, without any parameter replacements
- OUString
- impl_getErrorMessage( ErrorCondition _eCondition );
+ OUString impl_getErrorMessage( ErrorCondition _eCondition ) const;
/// returns the SQLState associated with the given error condition
static OUString
@@ -81,7 +79,7 @@ namespace connectivity
const OUString& SQLError_Impl::getMessagePrefix()
{
- static const OUString s_sMessagePrefix( "[OOoBase]" );
+ static constexpr OUString s_sMessagePrefix( u"[OOoBase]"_ustr );
return s_sMessagePrefix;
}
@@ -103,7 +101,7 @@ namespace connectivity
_rMessage = _rMessage.replaceAt( nIndex, nPlaceholderLen, *rParamValue );
}
- const char* lcl_getResourceErrorID(const ErrorCondition _eCondition)
+ TranslateId lcl_getResourceErrorID(const ErrorCondition _eCondition)
{
switch (_eCondition)
{
@@ -126,10 +124,10 @@ namespace connectivity
case css::sdb::ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED:
return STR_DATA_CANNOT_SELECT_UNFILTERED;
}
- return nullptr;
+ return {};
}
- OUString lcl_getResourceState(const ErrorCondition _eCondition)
+ const OUString & lcl_getResourceState(const ErrorCondition _eCondition)
{
switch (_eCondition)
{
@@ -138,11 +136,11 @@ namespace connectivity
case css::sdb::ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED:
return STR_DATA_CANNOT_SELECT_UNFILTERED_STATE;
}
- return OUString();
+ return EMPTY_OUSTRING;
}
}
- OUString SQLError_Impl::getErrorMessage( const ErrorCondition _eCondition, const std::optional<OUString>& _rParamValue1, const std::optional<OUString>& _rParamValue2, const std::optional<OUString>& _rParamValue3 )
+ OUString SQLError_Impl::getErrorMessage( const ErrorCondition _eCondition, const std::optional<OUString>& _rParamValue1, const std::optional<OUString>& _rParamValue2, const std::optional<OUString>& _rParamValue3 ) const
{
OUString sErrorMessage( impl_getErrorMessage( _eCondition ) );
@@ -220,22 +218,19 @@ namespace connectivity
);
}
- OUString SQLError_Impl::impl_getErrorMessage( ErrorCondition _eCondition )
+ OUString SQLError_Impl::impl_getErrorMessage( ErrorCondition _eCondition ) const
{
- OUStringBuffer aMessage;
-
OUString sResMessage(Translate::get(lcl_getResourceErrorID(_eCondition), m_aResources));
OSL_ENSURE( !sResMessage.isEmpty(), "SQLError_Impl::impl_getErrorMessage: illegal error condition, or invalid resource!" );
- aMessage.append( getMessagePrefix() ).append( " " ).append( sResMessage );
-
- return aMessage.makeStringAndClear();
+ return getMessagePrefix() + " " + sResMessage;
}
OUString SQLError_Impl::impl_getSQLState( ErrorCondition _eCondition )
{
+ static constexpr OUStringLiteral DEFAULT_STATE = u"S1000";
OUString sState = lcl_getResourceState(_eCondition);
if (sState.isEmpty())
- sState = OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "S1000" ) );
+ sState = DEFAULT_STATE;
return sState;
}
diff --git a/connectivity/source/commontools/statementcomposer.cxx b/connectivity/source/commontools/statementcomposer.cxx
index 01f20e9c1e3c..1ecaf36ea3bd 100644
--- a/connectivity/source/commontools/statementcomposer.cxx
+++ b/connectivity/source/commontools/statementcomposer.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/sdbc/XConnection.hpp>
#include <unotools/sharedunocomponent.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/property.hxx>
@@ -69,9 +69,6 @@ namespace dbtools
explicit StatementComposer_Data( const Reference< XConnection >& _rxConnection )
:xConnection( _rxConnection )
- ,sCommand()
- ,sFilter()
- ,sOrder()
,nCommandType( CommandType::COMMAND )
,bEscapeProcessing( true )
,bComposerDirty( true )
@@ -148,12 +145,12 @@ namespace dbtools
// a native query ?
bool bQueryEscapeProcessing = false;
- xQuery->getPropertyValue("EscapeProcessing") >>= bQueryEscapeProcessing;
+ xQuery->getPropertyValue(u"EscapeProcessing"_ustr) >>= bQueryEscapeProcessing;
if ( !bQueryEscapeProcessing )
break;
// the command used by the query
- xQuery->getPropertyValue("Command") >>= sStatement;
+ xQuery->getPropertyValue(u"Command"_ustr) >>= sStatement;
if ( sStatement.isEmpty() )
break;
@@ -161,7 +158,7 @@ namespace dbtools
Reference< XMultiServiceFactory > xFactory( _rData.xConnection, UNO_QUERY_THROW );
::utl::SharedUNOComponent< XSingleSelectQueryComposer > xComposer;
xComposer.set(
- xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"),
+ xFactory->createInstance(u"com.sun.star.sdb.SingleSelectQueryComposer"_ustr),
UNO_QUERY_THROW
);
@@ -169,7 +166,7 @@ namespace dbtools
xComposer->setElementaryQuery( sStatement );
// the sort order
- const OUString sPropOrder( "Order" );
+ static constexpr OUString sPropOrder( u"Order"_ustr );
if ( ::comphelper::hasProperty( sPropOrder, xQuery ) )
{
OUString sOrder;
@@ -179,7 +176,7 @@ namespace dbtools
// the filter
bool bApplyFilter = true;
- const OUString sPropApply( "ApplyFilter" );
+ static constexpr OUString sPropApply( u"ApplyFilter"_ustr );
if ( ::comphelper::hasProperty( sPropApply, xQuery ) )
{
OSL_VERIFY( xQuery->getPropertyValue( sPropApply ) >>= bApplyFilter );
@@ -188,9 +185,9 @@ namespace dbtools
if ( bApplyFilter )
{
OUString sFilter;
- OSL_VERIFY( xQuery->getPropertyValue("Filter") >>= sFilter );
+ OSL_VERIFY( xQuery->getPropertyValue(u"Filter"_ustr) >>= sFilter );
xComposer->setFilter( sFilter );
- OSL_VERIFY( xQuery->getPropertyValue("HavingClause") >>= sFilter );
+ OSL_VERIFY( xQuery->getPropertyValue(u"HavingClause"_ustr) >>= sFilter );
xComposer->setHavingClause( sFilter );
}
@@ -208,7 +205,7 @@ namespace dbtools
{
// create a composer
Reference< XMultiServiceFactory > xFactory( _rData.xConnection, UNO_QUERY_THROW );
- Reference< XSingleSelectQueryComposer > xComposer( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"),
+ Reference< XSingleSelectQueryComposer > xComposer( xFactory->createInstance(u"com.sun.star.sdb.SingleSelectQueryComposer"_ustr),
UNO_QUERY_THROW );
xComposer->setElementaryQuery( sStatement );
@@ -219,7 +216,7 @@ namespace dbtools
sStatement = xComposer->getQuery();
- _rData.xComposer = xComposer;
+ _rData.xComposer = std::move(xComposer);
_rData.bComposerDirty = false;
}
}
diff --git a/connectivity/source/commontools/warningscontainer.cxx b/connectivity/source/commontools/warningscontainer.cxx
index 733bf5b4a450..ba7825612519 100644
--- a/connectivity/source/commontools/warningscontainer.cxx
+++ b/connectivity/source/commontools/warningscontainer.cxx
@@ -61,19 +61,19 @@ namespace dbtools
void WarningsContainer::appendWarning(const SQLException& _rWarning)
{
- lcl_concatWarnings( m_aOwnWarnings, makeAny( _rWarning ) );
+ lcl_concatWarnings( m_aOwnWarnings, Any( _rWarning ) );
}
void WarningsContainer::appendWarning( const SQLContext& _rContext )
{
- lcl_concatWarnings( m_aOwnWarnings, makeAny( _rContext ));
+ lcl_concatWarnings( m_aOwnWarnings, Any( _rContext ));
}
void WarningsContainer::appendWarning(const SQLWarning& _rWarning)
{
- lcl_concatWarnings( m_aOwnWarnings, makeAny( _rWarning ) );
+ lcl_concatWarnings( m_aOwnWarnings, Any( _rWarning ) );
}
diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx
index 2917ce019700..91790a7159ec 100644
--- a/connectivity/source/cpool/ZConnectionPool.cxx
+++ b/connectivity/source/cpool/ZConnectionPool.cxx
@@ -24,6 +24,7 @@
#include "ZPoolCollection.hxx"
#include <connectivity/ConnectionWrapper.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <algorithm>
using namespace ::com::sun::star::uno;
@@ -31,17 +32,15 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::osl;
using namespace connectivity;
-#include <algorithm>
void SAL_CALL OPoolTimer::onShot()
{
m_pPool->invalidatePooledConnections();
}
-constexpr OUStringLiteral TIMEOUT_NODENAME = u"Timeout";
+constexpr OUString TIMEOUT_NODENAME = u"Timeout"_ustr;
OConnectionPool::OConnectionPool(const Reference< XDriver >& _xDriver,
const Reference< XInterface >& _xDriverNode,
@@ -129,7 +128,7 @@ struct TConnectionPoolFunctor
void OConnectionPool::clear(bool _bDispose)
{
- MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
if(m_xInvalidator->isTicking())
m_xInvalidator->stop();
@@ -153,7 +152,7 @@ void OConnectionPool::clear(bool _bDispose)
Reference< XConnection > OConnectionPool::getConnectionWithInfo( const OUString& _rURL, const Sequence< PropertyValue >& _rInfo )
{
- MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
Reference<XConnection> xConnection;
@@ -177,7 +176,7 @@ void SAL_CALL OConnectionPool::disposing( const css::lang::EventObject& Source )
Reference<XConnection> xConnection(Source.Source,UNO_QUERY);
if(xConnection.is())
{
- MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
TActiveConnectionMap::iterator aIter = m_aActiveConnections.find(xConnection);
OSL_ENSURE(aIter != m_aActiveConnections.end(),"OConnectionPool::disposing: Connection wasn't in pool");
if(aIter != m_aActiveConnections.end())
@@ -189,7 +188,7 @@ void SAL_CALL OConnectionPool::disposing( const css::lang::EventObject& Source )
}
else
{
- m_xDriverNode.clear();
+ m_xDriverNode.clear();
}
}
@@ -216,7 +215,7 @@ Reference< XConnection> OConnectionPool::createNewConnection(const OUString& _rU
aPack.nALiveCount = m_nALiveCount;
TActiveConnectionInfo aActiveInfo;
aActiveInfo.aPos = m_aPool.emplace(nId,aPack).first;
- aActiveInfo.xPooledConnection = xPooledConnection;
+ aActiveInfo.xPooledConnection = std::move(xPooledConnection);
m_aActiveConnections.emplace(xConnection,aActiveInfo);
if(m_xInvalidator->isExpired())
@@ -228,7 +227,7 @@ Reference< XConnection> OConnectionPool::createNewConnection(const OUString& _rU
void OConnectionPool::invalidatePooledConnections()
{
- MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
TConnectionMap::iterator aIter = m_aPool.begin();
for (; aIter != m_aPool.end(); )
{
@@ -272,8 +271,8 @@ Reference< XConnection> OConnectionPool::getPooledConnection(TConnectionMap::ite
TActiveConnectionInfo aActiveInfo;
aActiveInfo.aPos = _rIter;
- aActiveInfo.xPooledConnection = xPooledConnection;
- m_aActiveConnections[xConnection] = aActiveInfo;
+ aActiveInfo.xPooledConnection = std::move(xPooledConnection);
+ m_aActiveConnections[xConnection] = std::move(aActiveInfo);
}
return xConnection;
}
@@ -282,7 +281,7 @@ void SAL_CALL OConnectionPool::propertyChange( const PropertyChangeEvent& evt )
{
if(TIMEOUT_NODENAME == evt.PropertyName)
{
- evt.NewValue >>= m_nALiveCount;
+ OPoolCollection::getNodeValue(TIMEOUT_NODENAME, m_xDriverNode) >>= m_nALiveCount;
calculateTimeOuts();
}
}
diff --git a/connectivity/source/cpool/ZConnectionPool.hxx b/connectivity/source/cpool/ZConnectionPool.hxx
index e83d22849c0e..c5938f133f3c 100644
--- a/connectivity/source/cpool/ZConnectionPool.hxx
+++ b/connectivity/source/cpool/ZConnectionPool.hxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <map>
+#include <mutex>
#include <vector>
#include <com/sun/star/sdbc/XPooledConnection.hpp>
@@ -105,8 +106,8 @@ namespace connectivity
TConnectionMap m_aPool; // the pooled connections
TActiveConnectionMap m_aActiveConnections; // the currently active connections
- ::osl::Mutex m_aMutex;
- ::rtl::Reference<OPoolTimer> m_xInvalidator; // invalidates the conntection pool when shot
+ std::mutex m_aMutex;
+ ::rtl::Reference<OPoolTimer> m_xInvalidator; // invalidates the connection pool when shot
css::uno::Reference< css::sdbc::XDriver > m_xDriver; // the one and only driver for this connectionpool
css::uno::Reference< css::uno::XInterface > m_xDriverNode; // config node entry
diff --git a/connectivity/source/cpool/ZConnectionWrapper.cxx b/connectivity/source/cpool/ZConnectionWrapper.cxx
index dd4519859f21..685f70bcdc52 100644
--- a/connectivity/source/cpool/ZConnectionWrapper.cxx
+++ b/connectivity/source/cpool/ZConnectionWrapper.cxx
@@ -23,13 +23,11 @@ using namespace connectivity;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
OConnectionWeakWrapper::OConnectionWeakWrapper(Reference< XAggregation >& _xConnection)
- : OConnectionWeakWrapper_BASE(m_aMutex)
{
- setDelegation(_xConnection,m_refCount);
+ setDelegation(_xConnection);
OSL_ENSURE(m_xConnection.is(),"OConnectionWeakWrapper: Connection must be valid!");
}
@@ -43,7 +41,7 @@ OConnectionWeakWrapper::~OConnectionWeakWrapper()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(OConnectionWeakWrapper, "com.sun.star.sdbc.drivers.OConnectionWeakWrapper", "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(OConnectionWeakWrapper, u"com.sun.star.sdbc.drivers.OConnectionWeakWrapper"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
Reference< XStatement > SAL_CALL OConnectionWeakWrapper::createStatement( )
@@ -216,26 +214,5 @@ void SAL_CALL OConnectionWeakWrapper::close( )
dispose();
}
-void OConnectionWeakWrapper::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- OConnectionWeakWrapper_BASE::disposing();
- OConnectionWrapper::disposing();
-}
-
-// css::lang::XUnoTunnel
-IMPLEMENT_FORWARD_REFCOUNT( OConnectionWeakWrapper, OConnectionWeakWrapper_BASE )
-
-css::uno::Any SAL_CALL OConnectionWeakWrapper::queryInterface( const css::uno::Type& _rType )
-{
- css::uno::Any aReturn = OConnectionWeakWrapper_BASE::queryInterface( _rType );
- if ( !aReturn.hasValue() )
- aReturn = OConnectionWrapper::queryInterface( _rType );
- return aReturn;
-}
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2(OConnectionWeakWrapper,OConnectionWeakWrapper_BASE,OConnectionWrapper)
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/cpool/ZConnectionWrapper.hxx b/connectivity/source/cpool/ZConnectionWrapper.hxx
index e4b945fa9cfe..aec2087f37a4 100644
--- a/connectivity/source/cpool/ZConnectionWrapper.hxx
+++ b/connectivity/source/cpool/ZConnectionWrapper.hxx
@@ -32,23 +32,18 @@ namespace connectivity
// OConnectionWeakWrapper - wraps all methods to the real connection from the driver
// but when disposed it doesn't dispose the real connection
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XConnection > OConnectionWeakWrapper_BASE;
+ typedef ::cppu::ImplInheritanceHelper<OConnectionWrapper, css::sdbc::XConnection> OConnectionWeakWrapper_BASE;
- class OConnectionWeakWrapper : public ::cppu::BaseMutex
- , public OConnectionWeakWrapper_BASE
- , public OConnectionWrapper
+ class OConnectionWeakWrapper : public OConnectionWeakWrapper_BASE
{
protected:
// OComponentHelper
- virtual void SAL_CALL disposing() override;
virtual ~OConnectionWeakWrapper() override;
public:
explicit OConnectionWeakWrapper(css::uno::Reference< css::uno::XAggregation >& _xConnection);
// XServiceInfo
DECLARE_SERVICE_INFO();
- DECLARE_XTYPEPROVIDER()
- DECLARE_XINTERFACE( )
// XConnection
virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override;
diff --git a/connectivity/source/cpool/ZDriverWrapper.cxx b/connectivity/source/cpool/ZDriverWrapper.cxx
index 811f103bc9a6..9a1bdf971f97 100644
--- a/connectivity/source/cpool/ZDriverWrapper.cxx
+++ b/connectivity/source/cpool/ZDriverWrapper.cxx
@@ -48,7 +48,7 @@ namespace connectivity
OSL_ENSURE(m_xDriver.is(), "ODriverWrapper::ODriverWrapper: invalid aggregate (no XDriver)!");
// set ourself as delegator
- m_xDriverAggregate->setDelegator( static_cast< XWeak* >( this ) );
+ m_xDriverAggregate->setDelegator( getXWeak() );
}
osl_atomic_decrement( &m_refCount );
}
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
index 34d24b0be4f9..e6ef3182520d 100644
--- a/connectivity/source/cpool/ZPoolCollection.cxx
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <osl/diagnose.h>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -43,30 +43,11 @@ using namespace ::osl;
using namespace connectivity;
-static OUString getConnectionPoolNodeName()
-{
- return "org.openoffice.Office.DataAccess/ConnectionPool";
-}
-
-static OUString getEnablePoolingNodeName()
-{
- return "EnablePooling";
-}
-
-static OUString getDriverNameNodeName()
-{
- return "DriverName";
-}
-
-static OUString getDriverSettingsNodeName()
-{
- return "DriverSettings";
-}
-
-static OUString getEnableNodeName()
-{
- return "Enable";
-}
+constexpr OUString CONNECTIONPOOL_NODENAME = u"org.openoffice.Office.DataAccess/ConnectionPool"_ustr;
+constexpr OUString ENABLE_POOLING = u"EnablePooling"_ustr;
+constexpr OUString DRIVER_NAME = u"DriverName"_ustr;
+constexpr OUString DRIVER_SETTINGS = u"DriverSettings"_ustr;
+constexpr OUString ENABLE = u"Enable"_ustr;
OPoolCollection::OPoolCollection(const Reference< XComponentContext >& _rxContext)
@@ -76,10 +57,9 @@ OPoolCollection::OPoolCollection(const Reference< XComponentContext >& _rxContex
m_xManager = DriverManager::create( m_xContext );
m_xProxyFactory = ProxyFactory::create( m_xContext );
-
Reference<XPropertySet> xProp(getConfigPoolRoot(),UNO_QUERY);
if ( xProp.is() )
- xProp->addPropertyChangeListener(getEnablePoolingNodeName(),this);
+ xProp->addPropertyChangeListener(ENABLE_POOLING,this);
// attach as desktop listener to know when we have to release our pools
osl_atomic_increment( &m_refCount );
{
@@ -135,7 +115,7 @@ sal_Int32 SAL_CALL OPoolCollection::getLoginTimeout( )
OUString SAL_CALL OPoolCollection::getImplementationName( )
{
- return "com.sun.star.sdbc.OConnectionPool";
+ return u"com.sun.star.sdbc.OConnectionPool"_ustr;
}
sal_Bool SAL_CALL OPoolCollection::supportsService( const OUString& _rServiceName )
@@ -146,7 +126,7 @@ sal_Bool SAL_CALL OPoolCollection::supportsService( const OUString& _rServiceNam
Sequence< OUString > SAL_CALL OPoolCollection::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.ConnectionPool" };
+ return { u"com.sun.star.sdbc.ConnectionPool"_ustr };
}
Reference< XDriver > SAL_CALL OPoolCollection::getDriverByURL( const OUString& _rURL )
@@ -172,12 +152,12 @@ Reference< XDriver > SAL_CALL OPoolCollection::getDriverByURL( const OUString& _
}
if (xExistentProxy.is())
{
- xDriver = xExistentProxy;
+ xDriver = std::move(xExistentProxy);
}
else
{ // create a new proxy for the driver
// this allows us to control the connections created by it
- Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver.get());
+ Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver);
OSL_ENSURE(xDriverProxy.is(), "OConnectionPool::getDriverByURL: invalid proxy returned by the proxy factory!");
OConnectionPool* pConnectionPool = getConnectionPool(sImplName,xDriver,xDriverNode);
@@ -194,21 +174,18 @@ bool OPoolCollection::isDriverPoolingEnabled(std::u16string_view _sDriverImplNam
bool bEnabled = false;
Reference<XInterface> xConnectionPoolRoot = getConfigPoolRoot();
// then look for which of them settings are stored in the configuration
- Reference< XNameAccess > xDirectAccess(openNode(getDriverSettingsNodeName(),xConnectionPoolRoot),UNO_QUERY);
+ Reference< XNameAccess > xDirectAccess(openNode(DRIVER_SETTINGS,xConnectionPoolRoot),UNO_QUERY);
if(xDirectAccess.is())
{
- Sequence< OUString > aDriverKeys = xDirectAccess->getElementNames();
- const OUString* pDriverKeys = aDriverKeys.getConstArray();
- const OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
- for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ for (auto& driverKey : xDirectAccess->getElementNames())
{
// the name of the driver in this round
- if(_sDriverImplName == *pDriverKeys)
+ if (_sDriverImplName == driverKey)
{
- _rxDriverNode = openNode(*pDriverKeys,xDirectAccess);
+ _rxDriverNode = openNode(driverKey, xDirectAccess);
if(_rxDriverNode.is())
- getNodeValue(getEnableNodeName(),_rxDriverNode) >>= bEnabled;
+ getNodeValue(ENABLE,_rxDriverNode) >>= bEnabled;
break;
}
}
@@ -224,7 +201,7 @@ bool OPoolCollection::isPoolingEnabled()
// the global "enabled" flag
bool bEnabled = false;
if(xConnectionPoolRoot.is())
- getNodeValue(getEnablePoolingNodeName(),xConnectionPoolRoot) >>= bEnabled;
+ getNodeValue(ENABLE_POOLING,xConnectionPoolRoot) >>= bEnabled;
return bEnabled;
}
@@ -233,7 +210,7 @@ Reference<XInterface> const & OPoolCollection::getConfigPoolRoot()
if(!m_xConfigNode.is())
m_xConfigNode = createWithProvider(
css::configuration::theDefaultProvider::get(m_xContext),
- getConnectionPoolNodeName());
+ CONNECTIONPOOL_NODENAME);
return m_xConfigNode;
}
@@ -280,10 +257,10 @@ OConnectionPool* OPoolCollection::getConnectionPool(const OUString& _sImplName,
{
Reference<XPropertySet> xProp(_xDriverNode,UNO_QUERY);
if(xProp.is())
- xProp->addPropertyChangeListener(getEnableNodeName(),this);
- OConnectionPool* pConnectionPool = new OConnectionPool(_xDriver,_xDriverNode,m_xProxyFactory);
- aFind = m_aPools.emplace(_sImplName,pConnectionPool).first;
- pRet = aFind->second.get();
+ xProp->addPropertyChangeListener(ENABLE,this);
+ rtl::Reference<OConnectionPool> pConnectionPool = new OConnectionPool(_xDriver,_xDriverNode,m_xProxyFactory);
+ m_aPools.emplace(_sImplName,pConnectionPool);
+ pRet = pConnectionPool.get();
}
OSL_ENSURE(pRet, "Could not query DriverManager from ConnectionPool!");
@@ -295,11 +272,10 @@ Reference< XInterface > OPoolCollection::createWithProvider(const Reference< XMu
const OUString& _rPath)
{
OSL_ASSERT(_rxConfProvider.is());
- Sequence< Any > args(1);
- args[0] <<= NamedValue( "nodepath", makeAny(_rPath));
+ Sequence< Any > args{ Any(NamedValue( u"nodepath"_ustr, Any(_rPath))) };
Reference< XInterface > xInterface(
_rxConfProvider->createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationAccess",
+ u"com.sun.star.configuration.ConfigurationAccess"_ustr,
args));
OSL_ENSURE(
xInterface.is(),
@@ -307,7 +283,7 @@ Reference< XInterface > OPoolCollection::createWithProvider(const Reference< XMu
return xInterface;
}
-Reference<XInterface> OPoolCollection::openNode(const OUString& _rPath,const Reference<XInterface>& _xTreeNode) throw()
+Reference<XInterface> OPoolCollection::openNode(const OUString& _rPath,const Reference<XInterface>& _xTreeNode) noexcept
{
Reference< XHierarchicalNameAccess > xHierarchyAccess(_xTreeNode, UNO_QUERY);
Reference< XNameAccess > xDirectAccess(_xTreeNode, UNO_QUERY);
@@ -345,7 +321,7 @@ Reference<XInterface> OPoolCollection::openNode(const OUString& _rPath,const Ref
return xNode;
}
-Any OPoolCollection::getNodeValue(const OUString& _rPath,const Reference<XInterface>& _xTreeNode) throw()
+Any OPoolCollection::getNodeValue(const OUString& _rPath,const Reference<XInterface>& _xTreeNode) noexcept
{
Reference< XHierarchicalNameAccess > xHierarchyAccess(_xTreeNode, UNO_QUERY);
Reference< XNameAccess > xDirectAccess(_xTreeNode, UNO_QUERY);
@@ -372,9 +348,9 @@ void SAL_CALL OPoolCollection::queryTermination( const EventObject& /*Event*/ )
{
}
-void SAL_CALL OPoolCollection::notifyTermination( const EventObject& /*Event*/ )
+void SAL_CALL OPoolCollection::notifyTermination( const EventObject& Event )
{
- clearDesktop();
+ disposing(Event);
}
void SAL_CALL OPoolCollection::disposing( const EventObject& Source )
@@ -392,17 +368,21 @@ void SAL_CALL OPoolCollection::disposing( const EventObject& Source )
if(Source.Source == m_xConfigNode)
{
if ( xProp.is() )
- xProp->removePropertyChangeListener(getEnablePoolingNodeName(),this);
+ xProp->removePropertyChangeListener(ENABLE_POOLING,this);
m_xConfigNode.clear();
}
else if ( xProp.is() )
- xProp->removePropertyChangeListener(getEnableNodeName(),this);
+ xProp->removePropertyChangeListener(ENABLE,this);
}
catch(const Exception&)
{
TOOLS_WARN_EXCEPTION("connectivity.cpool", "");
}
}
+ m_xConfigNode.clear();
+ m_xProxyFactory.clear();
+ m_xManager.clear();
+ m_xContext.clear();
}
void SAL_CALL OPoolCollection::propertyChange( const css::beans::PropertyChangeEvent& evt )
@@ -426,7 +406,7 @@ void SAL_CALL OPoolCollection::propertyChange( const css::beans::PropertyChangeE
if(!bEnabled)
{
OUString sThisDriverName;
- getNodeValue(getDriverNameNodeName(),evt.Source) >>= sThisDriverName;
+ getNodeValue(DRIVER_NAME,evt.Source) >>= sThisDriverName;
// 1st release the driver
// look if we already have a proxy for this driver
MapDriver2DriverRef::iterator aLookup = m_aDriverProxies.begin();
diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx
index 3da18ab86ab2..3fdade8a9db6 100644
--- a/connectivity/source/cpool/ZPoolCollection.hxx
+++ b/connectivity/source/cpool/ZPoolCollection.hxx
@@ -85,7 +85,7 @@ namespace connectivity
static css::uno::Reference< css::uno::XInterface > createWithProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxConfProvider,
const OUString& _rPath);
static css::uno::Reference< css::uno::XInterface > openNode( const OUString& _rPath,
- const css::uno::Reference< css::uno::XInterface >& _xTreeNode) throw();
+ const css::uno::Reference< css::uno::XInterface >& _xTreeNode) noexcept;
bool isPoolingEnabled();
bool isDriverPoolingEnabled(std::u16string_view _sDriverImplName,
css::uno::Reference< css::uno::XInterface >& _rxDriverNode);
@@ -104,7 +104,7 @@ namespace connectivity
public:
static css::uno::Any getNodeValue( const OUString& _rPath,
- const css::uno::Reference< css::uno::XInterface>& _xTreeNode)throw();
+ const css::uno::Reference< css::uno::XInterface>& _xTreeNode)noexcept;
// XDriverManager
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( const OUString& url ) override;
diff --git a/connectivity/source/cpool/ZPooledConnection.cxx b/connectivity/source/cpool/ZPooledConnection.cxx
index 2d0b83707905..6cabc1ce2e29 100644
--- a/connectivity/source/cpool/ZPooledConnection.cxx
+++ b/connectivity/source/cpool/ZPooledConnection.cxx
@@ -59,13 +59,13 @@ Reference< XConnection > OPooledConnection::getConnection()
{
if(!m_xComponent.is() && m_xRealConnection.is())
{
- Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(m_xRealConnection.get());
+ Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(m_xRealConnection);
m_xComponent = new OConnectionWeakWrapper(xConProxy);
// register as event listener for the new connection
if (m_xComponent.is())
m_xComponent->addEventListener(this);
}
- return Reference< XConnection >(m_xComponent,UNO_QUERY);
+ return m_xComponent;
}
diff --git a/connectivity/source/cpool/ZPooledConnection.hxx b/connectivity/source/cpool/ZPooledConnection.hxx
index 79450ea081d3..0f5506f4f3b1 100644
--- a/connectivity/source/cpool/ZPooledConnection.hxx
+++ b/connectivity/source/cpool/ZPooledConnection.hxx
@@ -22,10 +22,11 @@
#include <com/sun/star/sdbc/XPooledConnection.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/reflection/XProxyFactory.hpp>
-
+#include <rtl/ref.hxx>
namespace connectivity
{
+ class OConnectionWeakWrapper;
// OPooledConnection -
// allows to pool a real connection
@@ -37,7 +38,7 @@ namespace connectivity
,public OPooledConnection_Base
{
css::uno::Reference< css::sdbc::XConnection > m_xRealConnection; // the connection from driver
- css::uno::Reference< css::lang::XComponent > m_xComponent; // the connection which wraps the real connection
+ rtl::Reference< OConnectionWeakWrapper > m_xComponent; // the connection which wraps the real connection
css::uno::Reference< css::reflection::XProxyFactory > m_xProxyFactory;
public:
// OComponentHelper
diff --git a/connectivity/source/drivers/ado/ACallableStatement.cxx b/connectivity/source/drivers/ado/ACallableStatement.cxx
index d572a8f99d9e..fae8b0f5394e 100644
--- a/connectivity/source/drivers/ado/ACallableStatement.cxx
+++ b/connectivity/source/drivers/ado/ACallableStatement.cxx
@@ -30,12 +30,6 @@ using namespace com::sun::star::container;
IMPLEMENT_SERVICE_INFO(OCallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement");
-#define GET_PARAM() \
- ADOParameter* pParam = nullptr; \
- m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam); \
- if(pParam) \
- pParam->get_Value(&m_aValue);
-
//************ Class: java.sql.CallableStatement
OCallableStatement::OCallableStatement( OConnection* _pConnection, const OUString& sql )
@@ -60,87 +54,117 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( )
sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getBool();
}
sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getInt8();
}
Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getByteSequence();
}
css::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getDate();
}
double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getDouble();
}
float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getFloat();
}
sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getInt32();
}
-
sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return static_cast<sal_Int64>(m_aValue.getCurrency().int64);
}
-
Any SAL_CALL OCallableStatement::getObject( sal_Int32 /*columnIndex*/, const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getObject", *this );
- return Any();
}
-
sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getInt16();
}
-
OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getString();
}
-
- css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex )
+css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getTime();
}
css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex )
{
- GET_PARAM()
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam);
+ if(pParam)
+ pParam->get_Value(&m_aValue);
return m_aValue.getDateTime();
}
@@ -172,52 +196,41 @@ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 paramet
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getBinaryStream", *this );
- return nullptr;
}
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getCharacterStream", *this );
- return nullptr;
}
-
Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getArray", *this );
- return nullptr;
}
-
Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getClob", *this );
- return nullptr;
}
Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getBlob", *this );
- return nullptr;
}
-
Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 /*columnIndex*/)
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRef", *this );
- return nullptr;
}
-
-void SAL_CALL OCallableStatement::acquire() throw()
+void SAL_CALL OCallableStatement::acquire() noexcept
{
OPreparedStatement::acquire();
}
-void SAL_CALL OCallableStatement::release() throw()
+void SAL_CALL OCallableStatement::release() noexcept
{
OPreparedStatement::release();
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index c73e2cb245af..8e4dd370a023 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -24,7 +24,6 @@
#include <ado/AColumn.hxx>
#include <ado/AConnection.hxx>
#include <ado/Awrapado.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <comphelper/extract.hxx>
#include <comphelper/servicehelper.hxx>
@@ -41,19 +40,7 @@ using namespace com::sun::star::sdbc;
void WpADOColumn::Create()
{
- _ADOColumn* pColumn = nullptr;
- HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOCOLUMN_25,
- nullptr,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOCOLUMN_25,
- reinterpret_cast<void**>(&pColumn) );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pColumn );
- pColumn->Release( );
- }
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOCOLUMN_25, nullptr, CLSCTX_INPROC_SERVER);
}
OAdoColumn::OAdoColumn(bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn)
@@ -62,7 +49,7 @@ OAdoColumn::OAdoColumn(bool _bCase,OConnection* _pConnection,_ADOColumn* _pColum
{
construct();
OSL_ENSURE(_pColumn,"Column can not be null!");
- m_aColumn = WpADOColumn(_pColumn);
+ m_aColumn.set(_pColumn);
// m_aColumn.put_ParentCatalog(_pConnection->getAdoCatalog()->getCatalog());
fillPropertyValues();
}
@@ -79,22 +66,6 @@ OAdoColumn::OAdoColumn(bool _bCase,OConnection* _pConnection)
}
-Sequence< sal_Int8 > OAdoColumn::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoColumn::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OAdoColumn>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : OColumn_ADO::getSomething(rId);
-}
-
void OAdoColumn::construct()
{
sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
@@ -170,7 +141,6 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
getBOOL(rValue));
break;
- case PROPERTY_ID_IM001:
case PROPERTY_ID_DESCRIPTION:
sAdoPropertyName = u"Description";
break;
diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx
index 0ade4a071c45..5e8cba1f8ac0 100644
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ b/connectivity/source/drivers/ado/AColumns.cxx
@@ -29,6 +29,7 @@
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
+#include <rtl/ref.hxx>
#include <algorithm>
#include <string_view>
#include <strings.hrc>
@@ -42,7 +43,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-sdbcx::ObjectType OColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OColumns::createObject(const OUString& _rName)
{
return new OAdoColumn(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
}
@@ -59,11 +60,11 @@ Reference< XPropertySet > OColumns::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OColumns::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
{
- OAdoColumn* pColumn = getUnoTunnelImplementation<OAdoColumn>( descriptor );
+ rtl::Reference<OAdoColumn> pColumn = dynamic_cast<OAdoColumn*>( descriptor.get() );
Reference< XPropertySet > xColumn;
- if ( pColumn == nullptr )
+ if ( !pColumn.is() )
{
// m_pConnection->throwGenericSQLException( STR_INVALID_COLUMN_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
pColumn = new OAdoColumn(isCaseSensitive(),m_pConnection);
@@ -73,15 +74,6 @@ sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPro
WpADOColumn aColumn = pColumn->getColumnImpl();
-#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nPrecision;
- sal_Int32 nScale;
- sal_Int32 nType;
- nPrecision = aColumn.get_Precision();
- nScale = aColumn.get_NumericScale();
- nType = ADOS::MapADOType2Jdbc(aColumn.get_Type());
-#endif
-
OUString sTypeName;
pColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)) >>= sTypeName;
@@ -117,7 +109,7 @@ sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPro
aAddedColumn.put_RelatedColumn(aColumn.get_RelatedColumn());
}
}
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
return new OAdoColumn(isCaseSensitive(),m_pConnection,pColumn->getColumnImpl());
}
@@ -126,7 +118,7 @@ sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPro
void OColumns::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
{
if(!m_aCollection.Delete(_sElementName))
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
}
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 6a26265c4d42..8fe1f3920c1e 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -19,6 +19,7 @@
#include <sal/config.h>
+#include <cstddef>
#include <string_view>
#include <ado/AConnection.hxx>
@@ -33,9 +34,10 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <connectivity/dbexception.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/file.hxx>
+#include <systools/win32/oleauto.hxx>
#include <strings.hrc>
using namespace dbtools;
@@ -52,44 +54,25 @@ IMPLEMENT_SERVICE_INFO(OConnection,"com.sun.star.sdbcx.AConnection","com.sun.sta
OConnection::OConnection(ODriver* _pDriver)
: m_xCatalog(nullptr),
m_pDriver(_pDriver),
- m_pAdoConnection(nullptr),
- m_pCatalog(nullptr),
m_nEngineType(0),
m_bClosed(false),
m_bAutocommit(true)
{
osl_atomic_increment( &m_refCount );
- IClassFactory2* pIUnknown = nullptr;
- HRESULT hr;
- hr = CoGetClassObject( ADOS::CLSID_ADOCONNECTION_21,
- CLSCTX_INPROC_SERVER,
- nullptr,
- IID_IClassFactory2,
- reinterpret_cast<void**>(&pIUnknown) );
-
- if( !FAILED( hr ) )
+ sal::systools::COMReference<IClassFactory2> pIUnknown;
+ if (!FAILED(pIUnknown.CoGetClassObject(ADOS::CLSID_ADOCONNECTION_21, CLSCTX_INPROC_SERVER)))
{
- ADOConnection *pCon = nullptr;
- IUnknown *pOuter = nullptr;
- hr = pIUnknown->CreateInstanceLic( pOuter,
+ HRESULT hr = pIUnknown->CreateInstanceLic(nullptr,
nullptr,
ADOS::IID_ADOCONNECTION_21,
- ADOS::GetKeyStr().asBSTR(),
- reinterpret_cast<void**>(&pCon));
+ ADOS::GetKeyStr(),
+ reinterpret_cast<void**>(&m_aAdoConnection));
if( !FAILED( hr ) )
{
- OSL_ENSURE( pCon, "OConnection::OConnection: invalid ADO object!" );
-
- m_pAdoConnection = new WpADOConnection( pCon );
- // CreateInstanceLic returned an object which was already acquired
- pCon->Release( );
-
+ OSL_ENSURE(m_aAdoConnection, "OConnection::OConnection: invalid ADO object!");
}
-
- // Class Factory is no longer needed
- pIUnknown->Release();
}
osl_atomic_decrement( &m_refCount );
@@ -99,47 +82,45 @@ OConnection::~OConnection()
{
}
-void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& info)
+void OConnection::construct(std::u16string_view url,const Sequence< PropertyValue >& info)
{
osl_atomic_increment( &m_refCount );
setConnectionInfo(info);
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- OUString aDSN(url.copy(nLen+1)),aUID,aPWD;
- if ( aDSN.startsWith("access:") )
- aDSN = aDSN.copy(7);
+ std::size_t nLen = url.find(':');
+ nLen = url.find(':',nLen == std::u16string_view::npos ? 0 : nLen+1);
+ std::u16string_view aDSN(url.substr(nLen == std::u16string_view::npos ? 0 : nLen+1));
+ OUString aUID,aPWD;
+ o3tl::starts_with(aDSN, u"access:", &aDSN);
sal_Int32 nTimeout = 20;
- const PropertyValue *pIter = info.getConstArray();
- const PropertyValue *pEnd = pIter + info.getLength();
- for(;pIter != pEnd;++pIter)
+ for (const auto& propval : info)
{
- if(pIter->Name == "Timeout")
- pIter->Value >>= nTimeout;
- else if(pIter->Name == "user")
- pIter->Value >>= aUID;
- else if(pIter->Name == "password")
- pIter->Value >>= aPWD;
+ if (propval.Name == "Timeout")
+ propval.Value >>= nTimeout;
+ else if (propval.Name == "user")
+ propval.Value >>= aUID;
+ else if (propval.Name == "password")
+ propval.Value >>= aPWD;
}
try
{
- if(m_pAdoConnection)
+ if(m_aAdoConnection)
{
- if(m_pAdoConnection->Open(aDSN,aUID,aPWD,adConnectUnspecified))
- m_pAdoConnection->PutCommandTimeout(nTimeout);
+ if(m_aAdoConnection.Open(aDSN,aUID,aPWD,adConnectUnspecified))
+ m_aAdoConnection.PutCommandTimeout(nTimeout);
else
- ADOS::ThrowException(*m_pAdoConnection,*this);
- if(m_pAdoConnection->get_State() != adStateOpen)
+ ADOS::ThrowException(m_aAdoConnection,*this);
+ if(m_aAdoConnection.get_State() != adStateOpen)
throwGenericSQLException( STR_NO_CONNECTION,*this );
- WpADOProperties aProps = m_pAdoConnection->get_Properties();
+ WpADOProperties aProps = m_aAdoConnection.get_Properties();
if(aProps.IsValid())
{
- OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true);
+ OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true);
OLEVariant aVar(
- OTools::getValue(aProps, std::u16string_view(u"Jet OLEDB:Engine Type")));
+ OTools::getValue(aProps, std::u16string_view(u"ACE OLEDB:Engine Type")));
if(!aVar.isNull() && !aVar.isEmpty())
m_nEngineType = aVar.getInt32();
}
@@ -163,10 +144,9 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OStatement* pStmt = new OStatement(this);
- Reference< XStatement > xStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return pStmt;
+ Reference< XStatement > xStmt = new OStatement(this);
+ m_aStatements.push_back(WeakReferenceHelper(xStmt));
+ return xStmt;
}
Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const OUString& sql )
@@ -175,9 +155,8 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const OU
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OPreparedStatement* pStmt = new OPreparedStatement(this, sql);
- Reference< XPreparedStatement > xPStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
+ Reference< XPreparedStatement > xPStmt = new OPreparedStatement(this, sql);
+ m_aStatements.push_back(WeakReferenceHelper(xPStmt));
return xPStmt;
}
@@ -187,9 +166,8 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const OUStrin
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OCallableStatement* pStmt = new OCallableStatement(this, sql);
- Reference< XPreparedStatement > xPStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
+ Reference< XPreparedStatement > xPStmt = new OCallableStatement(this, sql);
+ m_aStatements.push_back(WeakReferenceHelper(xPStmt));
return xPStmt;
}
@@ -200,13 +178,13 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& _sql )
OUString sql = _sql;
- WpADOProperties aProps = m_pAdoConnection->get_Properties();
+ WpADOProperties aProps = m_aAdoConnection.get_Properties();
if(aProps.IsValid())
{
- OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true);
+ OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true);
WpADOCommand aCommand;
aCommand.Create();
- aCommand.put_ActiveConnection(static_cast<IDispatch*>(*m_pAdoConnection));
+ aCommand.put_ActiveConnection(static_cast<IDispatch*>(m_aAdoConnection));
aCommand.put_CommandText(sql);
sql = aCommand.get_CommandText();
}
@@ -222,9 +200,9 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit )
m_bAutocommit = autoCommit;
if(!autoCommit)
- m_pAdoConnection->BeginTrans();
+ m_aAdoConnection.BeginTrans();
else
- m_pAdoConnection->RollbackTrans();
+ m_aAdoConnection.RollbackTrans();
}
sal_Bool SAL_CALL OConnection::getAutoCommit( )
@@ -242,7 +220,7 @@ void SAL_CALL OConnection::commit( )
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- m_pAdoConnection->CommitTrans();
+ m_aAdoConnection.CommitTrans();
}
void SAL_CALL OConnection::rollback( )
@@ -251,14 +229,14 @@ void SAL_CALL OConnection::rollback( )
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- m_pAdoConnection->RollbackTrans();
+ m_aAdoConnection.RollbackTrans();
}
sal_Bool SAL_CALL OConnection::isClosed( )
{
::osl::MutexGuard aGuard( m_aMutex );
- return OConnection_BASE::rBHelper.bDisposed && !m_pAdoConnection->get_State();
+ return OConnection_BASE::rBHelper.bDisposed && !m_aAdoConnection.get_State();
}
Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( )
@@ -283,8 +261,8 @@ void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly )
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- m_pAdoConnection->put_Mode(readOnly ? adModeRead : adModeReadWrite);
- ADOS::ThrowException(*m_pAdoConnection,*this);
+ m_aAdoConnection.put_Mode(readOnly ? adModeRead : adModeReadWrite);
+ ADOS::ThrowException(m_aAdoConnection,*this);
}
sal_Bool SAL_CALL OConnection::isReadOnly( )
@@ -293,7 +271,7 @@ sal_Bool SAL_CALL OConnection::isReadOnly( )
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- return m_pAdoConnection->get_Mode() == adModeRead;
+ return m_aAdoConnection.get_Mode() == adModeRead;
}
void SAL_CALL OConnection::setCatalog( const OUString& catalog )
@@ -301,8 +279,8 @@ void SAL_CALL OConnection::setCatalog( const OUString& catalog )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- m_pAdoConnection->PutDefaultDatabase(catalog);
- ADOS::ThrowException(*m_pAdoConnection,*this);
+ m_aAdoConnection.PutDefaultDatabase(catalog);
+ ADOS::ThrowException(m_aAdoConnection,*this);
}
OUString SAL_CALL OConnection::getCatalog( )
@@ -310,7 +288,7 @@ OUString SAL_CALL OConnection::getCatalog( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- return m_pAdoConnection->GetDefaultDatabase();
+ return m_aAdoConnection.GetDefaultDatabase();
}
void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level )
@@ -341,8 +319,8 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level )
OSL_FAIL("OConnection::setTransactionIsolation invalid level");
return;
}
- m_pAdoConnection->put_IsolationLevel(eIso);
- ADOS::ThrowException(*m_pAdoConnection,*this);
+ m_aAdoConnection.put_IsolationLevel(eIso);
+ ADOS::ThrowException(m_aAdoConnection,*this);
}
sal_Int32 SAL_CALL OConnection::getTransactionIsolation( )
@@ -352,7 +330,7 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation( )
sal_Int32 nRet = 0;
- switch(m_pAdoConnection->get_IsolationLevel())
+ switch(m_aAdoConnection.get_IsolationLevel())
{
case adXactUnspecified:
nRet = TransactionIsolation::NONE;
@@ -372,7 +350,7 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation( )
default:
OSL_FAIL("OConnection::setTransactionIsolation invalid level");
}
- ADOS::ThrowException(*m_pAdoConnection,*this);
+ ADOS::ThrowException(m_aAdoConnection,*this);
return nRet;
}
@@ -415,7 +393,7 @@ void OConnection::buildTypeInfo()
{
::osl::MutexGuard aGuard( m_aMutex );
- ADORecordset *pRecordset = m_pAdoConnection->getTypeInfo();
+ ADORecordset *pRecordset = m_aAdoConnection.getTypeInfo();
if ( pRecordset )
{
pRecordset->AddRef();
@@ -477,34 +455,29 @@ void OConnection::disposing()
m_bClosed = true;
m_xMetaData = css::uno::WeakReference< css::sdbc::XDatabaseMetaData>();
- m_xCatalog = css::uno::WeakReference< css::sdbcx::XTablesSupplier>();
+ m_xCatalog.clear();
m_pDriver = nullptr;
- m_pAdoConnection->Close();
+ m_aAdoConnection.Close();
for (auto& rEntry : m_aTypeInfo)
delete rEntry.second;
m_aTypeInfo.clear();
- delete m_pAdoConnection;
- m_pAdoConnection = nullptr;
+ m_aAdoConnection.clear();
}
sal_Int64 SAL_CALL OConnection::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{
- return isUnoTunnelId<OConnection>(rId)
- ?
- reinterpret_cast< sal_Int64 >( this )
- :
- OConnection_BASE::getSomething(rId);
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<OConnection_BASE>{});
}
Sequence< sal_Int8 > OConnection::getUnoTunnelId()
{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
}
const OExtendedTypeInfo* OConnection::getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
index 8e46761e8c27..fc4244e4965b 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
@@ -28,6 +28,7 @@
#include <FDatabaseMetaDataResultSet.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
+#include <rtl/ref.hxx>
using namespace ::comphelper;
@@ -41,15 +42,15 @@ using namespace com::sun::star::sdbc;
ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
: ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
- ,m_pADOConnection(_pCon->getConnection())
+ ,m_rADOConnection(_pCon->getConnection())
,m_pConnection(_pCon)
{
}
sal_Int32 ODatabaseMetaData::getInt32Property(const OUString& _aProperty)
{
- connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
- // ADOS::ThrowException(*m_pADOConnection,*this);
+ connectivity::ado::WpADOProperties aProps(m_rADOConnection.get_Properties());
+ // ADOS::ThrowException(m_rADOConnection,*this);
OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
ADO_PROP(_aProperty);
sal_Int32 nValue(0);
@@ -61,8 +62,8 @@ sal_Int32 ODatabaseMetaData::getInt32Property(const OUString& _aProperty)
bool ODatabaseMetaData::getBoolProperty(const OUString& _aProperty)
{
- connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
- ADOS::ThrowException(*m_pADOConnection,*this);
+ connectivity::ado::WpADOProperties aProps(m_rADOConnection.get_Properties());
+ ADOS::ThrowException(m_rADOConnection,*this);
OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
ADO_PROP(_aProperty);
return !aVar.isNull() && !aVar.isEmpty() && aVar.getBool();
@@ -70,8 +71,8 @@ bool ODatabaseMetaData::getBoolProperty(const OUString& _aProperty)
OUString ODatabaseMetaData::getStringProperty(const OUString& _aProperty)
{
- connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
- ADOS::ThrowException(*m_pADOConnection,*this);
+ connectivity::ado::WpADOProperties aProps(m_rADOConnection.get_Properties());
+ ADOS::ThrowException(m_rADOConnection,*this);
OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
ADO_PROP(_aProperty);
@@ -84,12 +85,11 @@ OUString ODatabaseMetaData::getStringProperty(const OUString& _aProperty)
Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
{
- ADORecordset *pRecordset = m_pADOConnection->getTypeInfo();
+ ADORecordset *pRecordset = m_rADOConnection.getTypeInfo();
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setTypeInfoMap(ADOS::isJetEngine(m_pConnection->getEngineType()));
- Reference< XResultSet > xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( )
@@ -98,16 +98,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( )
vtEmpty.setNoArg();
ADORecordset *pRecordset = nullptr;
- m_pADOConnection->OpenSchema(adSchemaCatalogs,vtEmpty,vtEmpty,&pRecordset);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
+ m_rADOConnection.OpenSchema(adSchemaCatalogs,vtEmpty,vtEmpty,&pRecordset);
+ ADOS::ThrowException(m_rADOConnection,*this);
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setCatalogsMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
@@ -121,78 +118,63 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( )
vtEmpty.setNoArg();
ADORecordset *pRecordset = nullptr;
- m_pADOConnection->OpenSchema(adSchemaSchemata,vtEmpty,vtEmpty,&pRecordset);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
+ m_rADOConnection.OpenSchema(adSchemaSchemata,vtEmpty,vtEmpty,&pRecordset);
+ ADOS::ThrowException(m_rADOConnection,*this);
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setSchemasMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
const Any& catalog, const OUString& schema, const OUString& table,
const OUString& columnNamePattern )
{
- ADORecordset *pRecordset = m_pADOConnection->getColumnPrivileges(catalog,schema,table,columnNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
+ ADORecordset *pRecordset = m_rADOConnection.getColumnPrivileges(catalog,schema,table,columnNamePattern);
+ ADOS::ThrowException(m_rADOConnection,*this);
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setColumnPrivilegesMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern,
const OUString& columnNamePattern )
{
- ADORecordset *pRecordset = m_pADOConnection->getColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
+ ADORecordset *pRecordset = m_rADOConnection.getColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern);
+ ADOS::ThrowException(m_rADOConnection,*this);
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setColumnsMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
const Any& catalog, const OUString& schemaPattern,
const OUString& tableNamePattern, const Sequence< OUString >& types )
{
- ADORecordset *pRecordset = m_pADOConnection->getTables(catalog,schemaPattern,tableNamePattern,types);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
+ ADORecordset *pRecordset = m_rADOConnection.getTables(catalog,schemaPattern,tableNamePattern,types);
+ ADOS::ThrowException(m_rADOConnection,*this);
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setTablesMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
const Any& catalog, const OUString& schemaPattern,
const OUString& procedureNamePattern, const OUString& columnNamePattern )
{
- ADORecordset *pRecordset = m_pADOConnection->getProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADORecordset *pRecordset = m_rADOConnection.getProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern);
+ ADOS::ThrowException(m_rADOConnection,*this);
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setProcedureColumnsMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
@@ -200,16 +182,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
const OUString& procedureNamePattern )
{
// Create elements used in the array
- ADORecordset *pRecordset = m_pADOConnection->getProcedures(catalog,schemaPattern,procedureNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADORecordset *pRecordset = m_rADOConnection.getProcedures(catalog,schemaPattern,procedureNamePattern);
+ ADOS::ThrowException(m_rADOConnection,*this);
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setProceduresMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( )
@@ -275,61 +254,50 @@ sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
const Any& catalog, const OUString& schema, const OUString& table )
{
- ADORecordset *pRecordset = m_pADOConnection->getExportedKeys(catalog,schema,table);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADORecordset *pRecordset = m_rADOConnection.getExportedKeys(catalog,schema,table);
+ ADOS::ThrowException(m_rADOConnection,*this);
- Reference< XResultSet > xRef;
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setCrossReferenceMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
const Any& catalog, const OUString& schema, const OUString& table )
{
- ADORecordset *pRecordset = m_pADOConnection->getImportedKeys(catalog,schema,table);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
+ ADORecordset *pRecordset = m_rADOConnection.getImportedKeys(catalog,schema,table);
+ ADOS::ThrowException(m_rADOConnection,*this);
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setCrossReferenceMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
const Any& catalog, const OUString& schema, const OUString& table )
{
- ADORecordset *pRecordset = m_pADOConnection->getPrimaryKeys(catalog,schema,table);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADORecordset *pRecordset = m_rADOConnection.getPrimaryKeys(catalog,schema,table);
+ ADOS::ThrowException(m_rADOConnection,*this);
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setPrimaryKeysMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
const Any& catalog, const OUString& schema, const OUString& table,
sal_Bool unique, sal_Bool approximate )
{
- ADORecordset *pRecordset = m_pADOConnection->getIndexInfo(catalog,schema,table,unique,approximate);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADORecordset *pRecordset = m_rADOConnection.getIndexInfo(catalog,schema,table,unique,approximate);
+ ADOS::ThrowException(m_rADOConnection,*this);
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setIndexInfoMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
@@ -340,16 +308,16 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
{ // the jet provider doesn't support this method
// Create elements used in the array
- ADORecordset *pRecordset = m_pADOConnection->getTablePrivileges(catalog,schemaPattern,tableNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADORecordset *pRecordset = m_rADOConnection.getTablePrivileges(catalog,schemaPattern,tableNamePattern);
+ ADOS::ThrowException(m_rADOConnection,*this);
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setTablePrivilegesMap();
xRef = pResult;
}
else
{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTablePrivileges);
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTablePrivileges);
xRef = pResult;
::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
@@ -379,7 +347,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
aRows.push_back(aRow);
aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
aRows.push_back(aRow);
- pResult->setRows(aRows);
+ pResult->setRows(std::move(aRows));
}
return xRef;
@@ -390,16 +358,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
const OUString& primaryTable, const Any& foreignCatalog,
const OUString& foreignSchema, const OUString& foreignTable )
{
- ADORecordset *pRecordset = m_pADOConnection->getCrossReference(primaryCatalog,primarySchema,primaryTable,foreignCatalog,foreignSchema,foreignTable);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADORecordset *pRecordset = m_rADOConnection.getCrossReference(primaryCatalog,primarySchema,primaryTable,foreignCatalog,foreignSchema,foreignTable);
+ ADOS::ThrowException(m_rADOConnection,*this);
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(pRecordset);
pResult->setCrossReferenceMap();
- xRef = pResult;
- return xRef;
+ return pResult;
}
sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( )
@@ -825,7 +790,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( )
OUString SAL_CALL ODatabaseMetaData::getURL( )
{
- return "sdbc:ado:"+ m_pADOConnection->GetConnectionString();
+ return "sdbc:ado:"+ m_rADOConnection.GetConnectionString();
}
OUString SAL_CALL ODatabaseMetaData::getUserName( )
@@ -871,7 +836,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( )
sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( )
{
sal_Int32 nRet = TransactionIsolation::NONE;
- switch(m_pADOConnection->get_IsolationLevel())
+ switch(m_rADOConnection.get_IsolationLevel())
{
case adXactReadCommitted:
nRet = TransactionIsolation::READ_COMMITTED;
@@ -898,22 +863,20 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( )
OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( )
{
- ADORecordset *pRecordset = nullptr;
+ WpADORecordset aRecordset;
OLEVariant vtEmpty;
vtEmpty.setNoArg();
- m_pADOConnection->OpenSchema(adSchemaDBInfoKeywords,vtEmpty,vtEmpty,&pRecordset);
- OSL_ENSURE(pRecordset,"getSQLKeywords: no resultset!");
- ADOS::ThrowException(*m_pADOConnection,*this);
- if ( pRecordset )
+ m_rADOConnection.OpenSchema(adSchemaDBInfoKeywords,vtEmpty,vtEmpty,&aRecordset);
+ OSL_ENSURE(aRecordset,"getSQLKeywords: no resultset!");
+ ADOS::ThrowException(m_rADOConnection,*this);
+ if ( aRecordset )
{
- WpADORecordset aRecordset(pRecordset);
-
aRecordset.MoveFirst();
OLEVariant aValue;
OUString aRet;
while(!aRecordset.IsAtEOF())
{
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
+ WpOLEAppendCollection<ADOFields, WpADOField> aFields(aRecordset.GetFields());
WpADOField aField(aFields.GetItem(0));
aField.get_Value(aValue);
aRet += aValue.getString() + ",";
@@ -933,8 +896,7 @@ OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( )
OUString SAL_CALL ODatabaseMetaData::getStringFunctions( )
{
- OUString aValue;
- return aValue.copy(0,aValue.lastIndexOf(','));
+ return OUString();
}
OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( )
@@ -944,8 +906,7 @@ OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( )
OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( )
{
- OUString aValue;
- return aValue.copy(0,aValue.lastIndexOf(','));
+ return OUString();
}
OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( )
@@ -1066,8 +1027,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( )
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XDatabaseMetaData::getUDTs", *this );
- return Reference< XResultSet >();
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
index 8972a4f2dee1..01a07ab96bf6 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
@@ -29,6 +29,9 @@
#include <ado/AIndex.hxx>
#include <ado/AKey.hxx>
#include <ado/ATable.hxx>
+
+#include <systools/win32/oleauto.hxx>
+
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ProcedureResult.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
@@ -48,24 +51,22 @@ using namespace ::com::sun::star::uno;
void ODatabaseMetaData::fillLiterals()
{
- ADORecordset *pRecordset = nullptr;
+ WpADORecordset aRecordset;
OLEVariant vtEmpty;
vtEmpty.setNoArg();
- m_pADOConnection->OpenSchema(adSchemaDBInfoLiterals,vtEmpty,vtEmpty,&pRecordset);
+ m_rADOConnection.OpenSchema(adSchemaDBInfoLiterals,vtEmpty,vtEmpty,&aRecordset);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADOS::ThrowException(m_rADOConnection,*this);
- OSL_ENSURE(pRecordset,"fillLiterals: no resultset!");
- if ( pRecordset )
+ OSL_ENSURE(aRecordset,"fillLiterals: no resultset!");
+ if ( aRecordset )
{
- WpADORecordset aRecordset(pRecordset);
-
aRecordset.MoveFirst();
OLEVariant aValue;
LiteralInfo aInfo;
while(!aRecordset.IsAtEOF())
{
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
+ WpOLEAppendCollection<ADOFields, WpADOField> aFields(aRecordset.GetFields());
WpADOField aField(aFields.GetItem(1));
aInfo.pwszLiteralValue = aField.get_Value().getString();
aField = aFields.GetItem(5);
@@ -387,19 +388,7 @@ RightsEnum OAdoGroup::Map2Right(sal_Int32 _eNum)
void WpADOIndex::Create()
{
- _ADOIndex* pIndex = nullptr;
- HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOINDEX_25,
- nullptr,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOINDEX_25,
- reinterpret_cast<void**>(&pIndex) );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pIndex );
- pIndex->Release();
- }
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOINDEX_25, nullptr, CLSCTX_INPROC_SERVER);
}
void OAdoIndex::fillPropertyValues()
@@ -415,19 +404,7 @@ void OAdoIndex::fillPropertyValues()
void WpADOKey::Create()
{
- _ADOKey* pKey = nullptr;
- HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOKEY_25,
- nullptr,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOKEY_25,
- reinterpret_cast<void**>(&pKey) );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pKey );
- pKey->Release();
- }
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOKEY_25, nullptr, CLSCTX_INPROC_SERVER);
}
void OAdoKey::fillPropertyValues()
@@ -524,29 +501,16 @@ KeyTypeEnum OAdoKey::Map2KeyRule(sal_Int32 _eNum)
void WpADOTable::Create()
{
- _ADOTable* pTable = nullptr;
- HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOTABLE_25,
- nullptr,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOTABLE_25,
- reinterpret_cast<void**>(&pTable) );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pTable );
- pTable->Release();
- }
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOTABLE_25, nullptr, CLSCTX_INPROC_SERVER);
}
OUString WpADOCatalog::GetObjectOwner(std::u16string_view _rName, ObjectTypeEnum _eNum)
{
OLEVariant _rVar;
_rVar.setNoArg();
- OLEString aBSTR;
- OLEString sStr1(_rName);
- pInterface->GetObjectOwner(sStr1.asBSTR(),_eNum,_rVar,aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->GetObjectOwner(sal::systools::BStr(_rName), _eNum, _rVar, &aBSTR);
+ return OUString(aBSTR);
}
void OAdoTable::fillPropertyValues()
@@ -571,19 +535,7 @@ void OAdoTable::fillPropertyValues()
void WpADOUser::Create()
{
- _ADOUser* pUser = nullptr;
- HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOUSER_25,
- nullptr,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOUSER_25,
- reinterpret_cast<void**>(&pUser) );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pUser );
- pUser->Release();
- }
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOUSER_25, nullptr, CLSCTX_INPROC_SERVER);
}
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
index a12f6e1fd6c4..4234d15282ff 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
@@ -34,7 +34,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/seqstream.hxx>
#include <connectivity/dbexception.hxx>
-
+#include <rtl/ref.hxx>
#include <oledb.h>
@@ -53,7 +53,6 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet
:ODatabaseMetaDataResultSet_BASE(m_aMutex)
,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper)
,m_pRecordSet(_pRecordSet)
- ,m_aStatement(nullptr)
,m_nRowPos(0)
,m_bWasNull(false)
,m_bEOF(false)
@@ -88,7 +87,6 @@ void ODatabaseMetaDataResultSet::disposing()
::osl::MutexGuard aGuard(m_aMutex);
if(m_pRecordSet)
m_pRecordSet->Close();
- m_aStatement = nullptr;
m_xMetaData.clear();
}
@@ -100,11 +98,8 @@ Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType )
css::uno::Sequence< css::uno::Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( )
{
- ::cppu::OTypeCollection aTypes( cppu::UnoType<css::beans::XMultiPropertySet>::get(),
- cppu::UnoType<css::beans::XFastPropertySet>::get(),
- cppu::UnoType<css::beans::XPropertySet>::get());
-
- return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes());
+ return comphelper::concatSequences(cppu::OPropertySetHelper::getTypes(),
+ ODatabaseMetaDataResultSet_BASE::getTypes());
}
void ODatabaseMetaDataResultSet::checkRecordSet()
@@ -113,7 +108,6 @@ void ODatabaseMetaDataResultSet::checkRecordSet()
throwFunctionSequenceException(*this);
}
-
sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& columnName )
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -131,9 +125,8 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& colum
}
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
- return 0; // Never reached
}
+
#define BLOCK_SIZE 256
Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 columnIndex )
@@ -182,10 +175,8 @@ Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinar
Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getCharacterStream", *this );
- return nullptr;
}
-
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -262,21 +253,16 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex )
return m_aValue.getInt32();
}
-
sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( )
{
::dbtools::throwFeatureNotImplementedSQLException( "XResultSet::getRow", *this );
- return 0;
}
-
sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getLong", *this );
- return sal_Int64(0);
}
-
Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( )
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -294,30 +280,23 @@ Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData
Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRow", *this );
- return nullptr;
}
-
Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRow", *this );
- return nullptr;
}
Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRow", *this );
- return nullptr;
}
-
Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRow", *this );
- return nullptr;
}
-
Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -528,7 +507,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( )
Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( )
{
- return m_aStatement.get();
+ return nullptr;
}
@@ -691,21 +670,41 @@ void ODatabaseMetaDataResultSet::setFetchSize(sal_Int32 _par0)
::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const
{
- Sequence< css::beans::Property > aProps(5);
- css::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ }
+ }
+ };
}
::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper()
@@ -780,7 +779,6 @@ void ODatabaseMetaDataResultSet::getFastPropertyValue(
void ODatabaseMetaDataResultSet::setProceduresMap()
{
-
for(sal_Int32 i=1;i<4;i++)
m_aColMapping.push_back(i);
m_aColMapping.push_back(5);
@@ -789,13 +787,15 @@ void ODatabaseMetaDataResultSet::setProceduresMap()
m_aColMapping.push_back(6);
m_aColMapping.push_back(4);
- ::std::map<sal_Int32,sal_Int32> aMap;
- aMap[DB_PT_UNKNOWN] = ProcedureResult::UNKNOWN;
- aMap[DB_PT_PROCEDURE] = ProcedureResult::NONE;
- aMap[DB_PT_FUNCTION] = ProcedureResult::RETURN;
+ ::std::map<sal_Int32,sal_Int32> aMap
+ {
+ {DB_PT_UNKNOWN, ProcedureResult::UNKNOWN},
+ {DB_PT_PROCEDURE, ProcedureResult::NONE},
+ {DB_PT_FUNCTION, ProcedureResult::RETURN}
+ };
m_aValueRange[4] = aMap;
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setProceduresMap();
m_xMetaData = pMetaData;
}
@@ -825,7 +825,7 @@ void ODatabaseMetaDataResultSet::setColumnPrivilegesMap()
m_aColMapping.push_back(9);
m_aColMapping.push_back(10);
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setColumnPrivilegesMap();
m_xMetaData = pMetaData;
}
@@ -854,55 +854,56 @@ void ODatabaseMetaDataResultSet::setColumnsMap()
m_aColMapping.push_back(7);
m_aColMapping.push_back(11);
- ::std::map<sal_Int32,sal_Int32> aMap;
- aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
- aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
- aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
- aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
- aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
- aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
- aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
- aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
- aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
- aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
- aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
- aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
- aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
- aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
- aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
- aMap[adError] = ADOS::MapADOType2Jdbc(adError);
- aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
- aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
- aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
- aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
- aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
- aMap[adDate] = ADOS::MapADOType2Jdbc(adDate);
- aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
- aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
- aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
- aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
- aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
- aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
- aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
- aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
- aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
- aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
- aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
- aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
- aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
- aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
- aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
- aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
- aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
-
+ ::std::map<sal_Int32,sal_Int32> aMap {
+ {adEmpty, ADOS::MapADOType2Jdbc(adEmpty)},
+ {adTinyInt, ADOS::MapADOType2Jdbc(adTinyInt)},
+ {adSmallInt, ADOS::MapADOType2Jdbc(adSmallInt)},
+ {adInteger, ADOS::MapADOType2Jdbc(adInteger)},
+ {adBigInt, ADOS::MapADOType2Jdbc(adBigInt)},
+ {adUnsignedTinyInt, ADOS::MapADOType2Jdbc(adUnsignedTinyInt)},
+ {adUnsignedSmallInt, ADOS::MapADOType2Jdbc(adUnsignedSmallInt)},
+ {adUnsignedInt, ADOS::MapADOType2Jdbc(adUnsignedInt)},
+ {adUnsignedBigInt, ADOS::MapADOType2Jdbc(adUnsignedBigInt)},
+ {adSingle, ADOS::MapADOType2Jdbc(adSingle)},
+ {adDouble, ADOS::MapADOType2Jdbc(adDouble)},
+ {adCurrency, ADOS::MapADOType2Jdbc(adCurrency)},
+ {adDecimal, ADOS::MapADOType2Jdbc(adDecimal)},
+ {adNumeric, ADOS::MapADOType2Jdbc(adNumeric)},
+ {adBoolean, ADOS::MapADOType2Jdbc(adBoolean)},
+ {adError, ADOS::MapADOType2Jdbc(adError)},
+ {adUserDefined, ADOS::MapADOType2Jdbc(adUserDefined)},
+ {adVariant, ADOS::MapADOType2Jdbc(adVariant)},
+ {adIDispatch, ADOS::MapADOType2Jdbc(adIDispatch)},
+ {adIUnknown, ADOS::MapADOType2Jdbc(adIUnknown)},
+ {adGUID, ADOS::MapADOType2Jdbc(adGUID)},
+ {adDate, ADOS::MapADOType2Jdbc(adDate)},
+ {adDBDate, ADOS::MapADOType2Jdbc(adDBDate)},
+ {adDBTime, ADOS::MapADOType2Jdbc(adDBTime)},
+ {adDBTimeStamp, ADOS::MapADOType2Jdbc(adDBTimeStamp)},
+ {adBSTR, ADOS::MapADOType2Jdbc(adBSTR)},
+ {adChar, ADOS::MapADOType2Jdbc(adChar)},
+ {adVarChar, ADOS::MapADOType2Jdbc(adVarChar)},
+ {adLongVarChar, ADOS::MapADOType2Jdbc(adLongVarChar)},
+ {adWChar, ADOS::MapADOType2Jdbc(adWChar)},
+ {adVarWChar, ADOS::MapADOType2Jdbc(adVarWChar)},
+ {adLongVarWChar, ADOS::MapADOType2Jdbc(adLongVarWChar)},
+ {adBinary, ADOS::MapADOType2Jdbc(adBinary)},
+ {adVarBinary, ADOS::MapADOType2Jdbc(adVarBinary)},
+ {adLongVarBinary, ADOS::MapADOType2Jdbc(adLongVarBinary)},
+ {adChapter, ADOS::MapADOType2Jdbc(adChapter)},
+ {adFileTime, ADOS::MapADOType2Jdbc(adFileTime)},
+ {adPropVariant, ADOS::MapADOType2Jdbc(adPropVariant)},
+ {adVarNumeric, ADOS::MapADOType2Jdbc(adVarNumeric)}
+ };
m_aValueRange[12] = aMap;
- std::map< sal_Int32,OUString> aMap2;
- aMap2[0] = "YES";
- aMap2[1] = "NO";
+ std::map< sal_Int32,OUString> aMap2 {
+ {0, "YES"},
+ {1, "NO"}
+ };
m_aIntValueRange[18] = aMap2;
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setColumnsMap();
m_xMetaData = pMetaData;
}
@@ -914,7 +915,7 @@ void ODatabaseMetaDataResultSet::setTablesMap()
m_aColMapping.push_back(i);
m_aColMapping.push_back(6);
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setTablesMap();
m_xMetaData = pMetaData;
}
@@ -934,54 +935,56 @@ void ODatabaseMetaDataResultSet::setProcedureColumnsMap()
m_aColMapping.push_back(9);
m_aColMapping.push_back(14);
- ::std::map<sal_Int32,sal_Int32> aMap;
- aMap[DBTYPE_EMPTY] = DataType::SQLNULL;
- aMap[DBTYPE_NULL] = DataType::SQLNULL;
- aMap[DBTYPE_I2] = DataType::SMALLINT;
- aMap[DBTYPE_I4] = DataType::INTEGER;
- aMap[DBTYPE_R4] = DataType::FLOAT;
- aMap[DBTYPE_R8] = DataType::DOUBLE;
- aMap[DBTYPE_CY] = DataType::BIGINT;
- aMap[DBTYPE_DATE] = DataType::DATE;
- aMap[DBTYPE_BSTR] = DataType::VARCHAR;
- aMap[DBTYPE_IDISPATCH] = DataType::OBJECT;
- aMap[DBTYPE_ERROR] = DataType::OTHER;
- aMap[DBTYPE_BOOL] = DataType::BIT;
- aMap[DBTYPE_VARIANT] = DataType::STRUCT;
- aMap[DBTYPE_IUNKNOWN] = DataType::OTHER;
- aMap[DBTYPE_DECIMAL] = DataType::DECIMAL;
- aMap[DBTYPE_UI1] = DataType::TINYINT;
- aMap[DBTYPE_ARRAY] = DataType::ARRAY;
- aMap[DBTYPE_BYREF] = DataType::REF;
- aMap[DBTYPE_I1] = DataType::CHAR;
- aMap[DBTYPE_UI2] = DataType::SMALLINT;
- aMap[DBTYPE_UI4] = DataType::INTEGER;
-
- // aMap[The] = ;
- // aMap[in] = ;
- aMap[DBTYPE_I8] = DataType::BIGINT;
- aMap[DBTYPE_UI8] = DataType::BIGINT;
- aMap[DBTYPE_GUID] = DataType::OTHER;
- aMap[DBTYPE_VECTOR] = DataType::OTHER;
- aMap[DBTYPE_FILETIME] = DataType::OTHER;
- aMap[DBTYPE_RESERVED] = DataType::OTHER;
-
- // aMap[The] = ;
- aMap[DBTYPE_BYTES] = DataType::VARBINARY;
- aMap[DBTYPE_STR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_NUMERIC] = DataType::NUMERIC;
- aMap[DBTYPE_UDT] = DataType::OTHER;
- aMap[DBTYPE_DBDATE] = DataType::DATE;
- aMap[DBTYPE_DBTIME] = DataType::TIME;
- aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP;
- aMap[DBTYPE_HCHAPTER] = DataType::OTHER;
- aMap[DBTYPE_PROPVARIANT] = DataType::OTHER;
- aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC;
+ ::std::map<sal_Int32,sal_Int32> aMap
+ {
+ {DBTYPE_EMPTY, DataType::SQLNULL},
+ {DBTYPE_NULL, DataType::SQLNULL},
+ {DBTYPE_I2, DataType::SMALLINT},
+ {DBTYPE_I4, DataType::INTEGER},
+ {DBTYPE_R4, DataType::FLOAT},
+ {DBTYPE_R8, DataType::DOUBLE},
+ {DBTYPE_CY, DataType::BIGINT},
+ {DBTYPE_DATE, DataType::DATE},
+ {DBTYPE_BSTR, DataType::VARCHAR},
+ {DBTYPE_IDISPATCH, DataType::OBJECT},
+ {DBTYPE_ERROR, DataType::OTHER},
+ {DBTYPE_BOOL, DataType::BIT},
+ {DBTYPE_VARIANT, DataType::STRUCT},
+ {DBTYPE_IUNKNOWN, DataType::OTHER},
+ {DBTYPE_DECIMAL, DataType::DECIMAL},
+ {DBTYPE_UI1, DataType::TINYINT},
+ {DBTYPE_ARRAY, DataType::ARRAY},
+ {DBTYPE_BYREF, DataType::REF},
+ {DBTYPE_I1, DataType::CHAR},
+ {DBTYPE_UI2, DataType::SMALLINT},
+ {DBTYPE_UI4, DataType::INTEGER},
+
+ // aMap[The] = ;
+ // aMap[in] = ;
+ {DBTYPE_I8, DataType::BIGINT},
+ {DBTYPE_UI8, DataType::BIGINT},
+ {DBTYPE_GUID, DataType::OTHER},
+ {DBTYPE_VECTOR, DataType::OTHER},
+ {DBTYPE_FILETIME, DataType::OTHER},
+ {DBTYPE_RESERVED, DataType::OTHER},
+
+ // aMap[The] = ;
+ {DBTYPE_BYTES, DataType::VARBINARY},
+ {DBTYPE_STR, DataType::LONGVARCHAR},
+ {DBTYPE_WSTR, DataType::LONGVARCHAR},
+ {DBTYPE_NUMERIC, DataType::NUMERIC},
+ {DBTYPE_UDT, DataType::OTHER},
+ {DBTYPE_DBDATE, DataType::DATE},
+ {DBTYPE_DBTIME, DataType::TIME},
+ {DBTYPE_DBTIMESTAMP, DataType::TIMESTAMP},
+ {DBTYPE_HCHAPTER, DataType::OTHER},
+ {DBTYPE_PROPVARIANT, DataType::OTHER},
+ {DBTYPE_VARNUMERIC, DataType::NUMERIC}
+ };
m_aValueRange[10] = aMap;
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setProcedureColumnsMap();
m_xMetaData = pMetaData;
}
@@ -995,7 +998,7 @@ void ODatabaseMetaDataResultSet::setPrimaryKeysMap()
m_aColMapping.push_back(7);
m_aColMapping.push_back(8);
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setProcedureColumnsMap();
m_xMetaData = pMetaData;
}
@@ -1017,27 +1020,33 @@ void ODatabaseMetaDataResultSet::setIndexInfoMap()
m_aColMapping.push_back(23);
m_aColMapping.push_back(24);
- ::std::map<sal_Int32,sal_Int32> aMap;
- aMap[DBPROPVAL_IT_HASH] = IndexType::HASHED;
- aMap[DBPROPVAL_IT_CONTENT] = IndexType::OTHER;
- aMap[DBPROPVAL_IT_OTHER] = IndexType::OTHER;
- aMap[DBPROPVAL_IT_BTREE] = IndexType::OTHER;
+ ::std::map<sal_Int32,sal_Int32> aMap
+ {
+ { DBPROPVAL_IT_HASH, IndexType::HASHED },
+ { DBPROPVAL_IT_CONTENT, IndexType::OTHER },
+ { DBPROPVAL_IT_OTHER, IndexType::OTHER },
+ { DBPROPVAL_IT_BTREE, IndexType::OTHER }
+ };
m_aValueRange[10] = aMap;
- ::std::map<sal_Int32,sal_Int32> aMap2;
- aMap[0] = 1;
- aMap[1] = 0;
+ ::std::map<sal_Int32,sal_Int32> aMap2
+ {
+ { 0, 1 },
+ { 1, 0 }
+ };
m_aValueRange[8] = aMap2;
- std::map< sal_Int32,OUString> aMap3;
- aMap3[0] = "";
- aMap3[DB_COLLATION_ASC] = "A";
- aMap3[DB_COLLATION_DESC] = "D";
+ std::map< sal_Int32,OUString> aMap3
+ {
+ { 0, "" },
+ { DB_COLLATION_ASC, "A" },
+ { DB_COLLATION_DESC, "D" }
+ };
m_aIntValueRange[21] = aMap3;
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setIndexInfoMap();
m_xMetaData = pMetaData;
}
@@ -1053,13 +1062,15 @@ void ODatabaseMetaDataResultSet::setTablePrivilegesMap()
m_aColMapping.push_back(6);
m_aColMapping.push_back(7);
- std::map< sal_Int32,OUString> aMap;
- aMap[0] = "YES";
- aMap[1] = "NO";
+ std::map< sal_Int32,OUString> aMap
+ {
+ { 0, "YES" },
+ { 1, "NO" }
+ };
m_aIntValueRange[7] = aMap;
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setTablePrivilegesMap();
m_xMetaData = pMetaData;
}
@@ -1080,17 +1091,19 @@ void ODatabaseMetaDataResultSet::setCrossReferenceMap()
m_aColMapping.push_back(16);
m_aColMapping.push_back(18);
- std::map< OUString,sal_Int32> aMap;
- aMap[ OUString("CASCADE")] = KeyRule::CASCADE;
- aMap[ OUString("RESTRICT")] = KeyRule::RESTRICT;
- aMap[ OUString("SET NULL")] = KeyRule::SET_NULL;
- aMap[ OUString("SET DEFAULT")] = KeyRule::SET_DEFAULT;
- aMap[ OUString("NO ACTION")] = KeyRule::NO_ACTION;
+ std::map< OUString,sal_Int32> aMap
+ {
+ { "CASCADE", KeyRule::CASCADE },
+ { "RESTRICT", KeyRule::RESTRICT },
+ { "SET NULL", KeyRule::SET_NULL },
+ { "SET DEFAULT", KeyRule::SET_DEFAULT },
+ { "NO ACTION", KeyRule::NO_ACTION }
+ };
m_aStrValueRange[14] = aMap;
m_aStrValueRange[15] = aMap;
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setCrossReferenceMap();
m_xMetaData = pMetaData;
}
@@ -1101,84 +1114,89 @@ void ODatabaseMetaDataResultSet::setTypeInfoMap(bool _bJetEngine)
for(;i<19;i++)
m_aColMapping.push_back(i);
- std::map< OUString,sal_Int32> aMap1;
- aMap1[ OUString()] = 10;
+ std::map< OUString,sal_Int32> aMap1 { { OUString(), 10 } };
m_aStrValueRange[18] = aMap1;
- ::std::map<sal_Int32,sal_Int32> aMap;
- aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
- aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
- aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
- aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
- aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
- aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
- aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
- aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
- aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
- aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
- aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
- aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
- aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
- aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
- aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
- aMap[adError] = ADOS::MapADOType2Jdbc(adError);
- aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
- aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
- aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
- aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
- aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
- aMap[adDate] = _bJetEngine ? ADOS::MapADOType2Jdbc(adDBTimeStamp) : ADOS::MapADOType2Jdbc(adDate);
- aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
- aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
- aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
- aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
- aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
- aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
- aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
- aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
- aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
- aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
- aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
- aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
- aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
- aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
- aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
- aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
- aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
-// aMap[adArray] = ADOS::MapADOType2Jdbc(adArray);
+ ::std::map<sal_Int32,sal_Int32> aMap
+ {
+ {adEmpty, ADOS::MapADOType2Jdbc(adEmpty)},
+ {adTinyInt, ADOS::MapADOType2Jdbc(adTinyInt)},
+ {adSmallInt, ADOS::MapADOType2Jdbc(adSmallInt)},
+ {adInteger, ADOS::MapADOType2Jdbc(adInteger)},
+ {adBigInt, ADOS::MapADOType2Jdbc(adBigInt)},
+ {adUnsignedTinyInt, ADOS::MapADOType2Jdbc(adUnsignedTinyInt)},
+ {adUnsignedSmallInt, ADOS::MapADOType2Jdbc(adUnsignedSmallInt)},
+ {adUnsignedInt, ADOS::MapADOType2Jdbc(adUnsignedInt)},
+ {adUnsignedBigInt, ADOS::MapADOType2Jdbc(adUnsignedBigInt)},
+ {adSingle, ADOS::MapADOType2Jdbc(adSingle)},
+ {adDouble, ADOS::MapADOType2Jdbc(adDouble)},
+ {adCurrency, ADOS::MapADOType2Jdbc(adCurrency)},
+ {adDecimal, ADOS::MapADOType2Jdbc(adDecimal)},
+ {adNumeric, ADOS::MapADOType2Jdbc(adNumeric)},
+ {adBoolean, ADOS::MapADOType2Jdbc(adBoolean)},
+ {adError, ADOS::MapADOType2Jdbc(adError)},
+ {adUserDefined, ADOS::MapADOType2Jdbc(adUserDefined)},
+ {adVariant, ADOS::MapADOType2Jdbc(adVariant)},
+ {adIDispatch, ADOS::MapADOType2Jdbc(adIDispatch)},
+ {adIUnknown, ADOS::MapADOType2Jdbc(adIUnknown)},
+ {adGUID, ADOS::MapADOType2Jdbc(adGUID)},
+ {adDate, ADOS::MapADOType2Jdbc(_bJetEngine?adDBTimeStamp:adDate)},
+ {adDBDate, ADOS::MapADOType2Jdbc(adDBDate)},
+ {adDBTime, ADOS::MapADOType2Jdbc(adDBTime)},
+ {adDBTimeStamp, ADOS::MapADOType2Jdbc(adDBTimeStamp)},
+ {adBSTR, ADOS::MapADOType2Jdbc(adBSTR)},
+ {adChar, ADOS::MapADOType2Jdbc(adChar)},
+ {adVarChar, ADOS::MapADOType2Jdbc(adVarChar)},
+ {adLongVarChar, ADOS::MapADOType2Jdbc(adLongVarChar)},
+ {adWChar, ADOS::MapADOType2Jdbc(adWChar)},
+ {adVarWChar, ADOS::MapADOType2Jdbc(adVarWChar)},
+ {adLongVarWChar, ADOS::MapADOType2Jdbc(adLongVarWChar)},
+ {adBinary, ADOS::MapADOType2Jdbc(adBinary)},
+ {adVarBinary, ADOS::MapADOType2Jdbc(adVarBinary)},
+ {adLongVarBinary, ADOS::MapADOType2Jdbc(adLongVarBinary)},
+ {adChapter, ADOS::MapADOType2Jdbc(adChapter)},
+ {adFileTime, ADOS::MapADOType2Jdbc(adFileTime)},
+ {adPropVariant, ADOS::MapADOType2Jdbc(adPropVariant)},
+ {adVarNumeric, ADOS::MapADOType2Jdbc(adVarNumeric)}
+// {adArray, ADOS::MapADOType2Jdbc(adArray)}
+ };
m_aValueRange[2] = aMap;
- ::std::map<sal_Int32,sal_Int32> aColumnValueMapping;
- aColumnValueMapping[VARIANT_FALSE] = ColumnValue::NO_NULLS;
- aColumnValueMapping[VARIANT_TRUE] = ColumnValue::NULLABLE;
+ ::std::map<sal_Int32,sal_Int32> aColumnValueMapping
+ {
+ { VARIANT_FALSE, ColumnValue::NO_NULLS },
+ { VARIANT_TRUE, ColumnValue::NULLABLE }
+ };
m_aValueRange[7] = aColumnValueMapping;
// now adjust the column mapping
// OJ 24.01.2002 96860
- ::std::map<sal_Int32,sal_Int32> aSearchMapping;
- aSearchMapping[DB_UNSEARCHABLE] = ColumnSearch::NONE;
- aSearchMapping[DB_LIKE_ONLY] = ColumnSearch::CHAR;
- aSearchMapping[DB_ALL_EXCEPT_LIKE] = ColumnSearch::BASIC;
- aSearchMapping[DB_SEARCHABLE] = ColumnSearch::FULL;
+ ::std::map<sal_Int32,sal_Int32> aSearchMapping
+ {
+ { DB_UNSEARCHABLE, ColumnSearch::NONE },
+ { DB_LIKE_ONLY, ColumnSearch::CHAR },
+ { DB_ALL_EXCEPT_LIKE, ColumnSearch::BASIC },
+ { DB_SEARCHABLE, ColumnSearch::FULL }
+ };
m_aValueRange[9] = aSearchMapping;
::std::map<sal_Int32,sal_Int32> aCurrencyMapping;
m_aValueRange[11] = aCurrencyMapping;
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
+ rtl::Reference<ODatabaseMetaDataResultSetMetaData> pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
pMetaData->setTypeInfoMap();
m_xMetaData = pMetaData;
}
-void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw()
+void SAL_CALL ODatabaseMetaDataResultSet::acquire() noexcept
{
ODatabaseMetaDataResultSet_BASE::acquire();
}
-void SAL_CALL ODatabaseMetaDataResultSet::release() throw()
+void SAL_CALL ODatabaseMetaDataResultSet::release() noexcept
{
ODatabaseMetaDataResultSet_BASE::release();
}
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
index 94dbfddb34f9..3fa13d06b84a 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
@@ -71,9 +71,8 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnCount()
if (m_vMapping.size())
return m_mColumns.size();
- ADOFields* pFields = nullptr;
- m_pRecordSet->get_Fields(&pFields);
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields);
+ WpOLEAppendCollection<ADOFields, WpADOField> aFields;
+ m_pRecordSet->get_Fields(&aFields);
m_nColCount = aFields.GetItemCount();
return m_nColCount;
}
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx
index ee4ec27b6f05..a998664fdd86 100644
--- a/connectivity/source/drivers/ado/ADriver.cxx
+++ b/connectivity/source/drivers/ado/ADriver.cxx
@@ -24,16 +24,16 @@
#include <ado/Awrapado.hxx>
#include <ado/adoimp.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/servicehelper.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/safeCoInitUninit.hxx>
+#include <rtl/ref.hxx>
#include <strings.hrc>
#include <objbase.h>
#include <resource/sharedresources.hxx>
-#include <memory>
-
using namespace connectivity;
using namespace connectivity::ado;
using namespace com::sun::star::uno;
@@ -63,7 +63,7 @@ void ODriver::disposing()
for (auto& rxConnection : m_xConnections)
{
- Reference< XComponent > xComp(rxConnection.get(), UNO_QUERY);
+ rtl::Reference< OConnection > xComp(rxConnection.get());
if (xComp.is())
xComp->dispose();
}
@@ -94,13 +94,11 @@ Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const S
return nullptr;
// we need to wrap the connection as the construct call might throw
- std::unique_ptr<OConnection> pCon(new OConnection(this));
+ rtl::Reference<OConnection> pCon(new OConnection(this));
pCon->construct(url,info);
- OConnection* pPtr = pCon.get();
- Reference< XConnection > xCon = pCon.release();
- m_xConnections.push_back(WeakReferenceHelper(*pPtr));
+ m_xConnections.push_back(pCon);
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
@@ -123,34 +121,32 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
impl_checkURL_throw(url);
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< OUString > aBooleanValues(2);
- aBooleanValues[0] = "false";
- aBooleanValues[1] = "true";
+ Sequence< OUString > aBooleanValues{ "false", "true" };
- aDriverInfo.push_back(DriverPropertyInfo(
- "IgnoreDriverPrivileges"
- ,"Ignore the privileges from the database driver."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "EscapeDateTime"
- ,"Escape date time format."
- ,false
- ,"true"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "TypeInfoSettings"
- ,"Defines how the type info of the database metadata should be manipulated."
- ,false
- ,OUString( )
- ,Sequence< OUString > ())
- );
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ return
+ {
+ {
+ "IgnoreDriverPrivileges",
+ "Ignore the privileges from the database driver.",
+ false,
+ "false",
+ aBooleanValues
+ },
+ {
+ "EscapeDateTime",
+ "Escape date time format.",
+ false,
+ "true",
+ aBooleanValues
+ },
+ {
+ "TypeInfoSettings",
+ "Defines how the type info of the database metadata should be manipulated.",
+ false,
+ {},
+ {}
+ }
+ };
}
return Sequence< DriverPropertyInfo >();
}
@@ -174,13 +170,11 @@ Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( co
OConnection* pConnection = nullptr;
Reference< css::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if(xTunnel.is())
+ if (auto pSearchConnection = comphelper::getFromUnoTunnel<OConnection>(xTunnel))
{
- OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelId()) );
-
auto foundConnection = std::any_of(m_xConnections.begin(), m_xConnections.end(),
[&pSearchConnection](const css::uno::WeakReferenceHelper& rxConnection) {
- return static_cast<OConnection*>(Reference< XConnection >::query(rxConnection.get().get()).get()) == pSearchConnection; });
+ return static_cast<OConnection*>(Reference< XConnection >::query(rxConnection.get()).get()) == pSearchConnection; });
if (foundConnection)
pConnection = pSearchConnection;
}
@@ -192,11 +186,10 @@ Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( co
aCatalog.Create();
if(aCatalog.IsValid())
{
- aCatalog.putref_ActiveConnection(*pConnection->getConnection());
- OCatalog* pCatalog = new OCatalog(aCatalog,pConnection);
+ aCatalog.putref_ActiveConnection(pConnection->getConnection());
+ rtl::Reference<OCatalog> pCatalog = new OCatalog(aCatalog,pConnection);
xTab = pCatalog;
- pConnection->setCatalog(xTab);
- pConnection->setCatalog(pCatalog);
+ pConnection->setCatalog(pCatalog.get());
}
}
return xTab;
@@ -211,13 +204,11 @@ Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const OUS
void ADOS::ThrowException(ADOConnection* _pAdoCon,const Reference< XInterface >& _xInterface)
{
- ADOErrors *pErrors = nullptr;
+ sal::systools::COMReference<ADOErrors> pErrors;
_pAdoCon->get_Errors(&pErrors);
if(!pErrors)
return; // no error found
- pErrors->AddRef( );
-
// read all noted errors and issue them
sal_Int32 nLen;
pErrors->get_Count(&nLen);
@@ -227,28 +218,25 @@ void ADOS::ThrowException(ADOConnection* _pAdoCon,const Reference< XInterface >&
aException.ErrorCode = 1000;
for (sal_Int32 i = nLen-1; i>=0; --i)
{
- ADOError *pError = nullptr;
- pErrors->get_Item(OLEVariant(i),&pError);
- WpADOError aErr(pError);
- OSL_ENSURE(pError,"No error in collection found! BAD!");
- if(pError)
+ WpADOError aErr;
+ pErrors->get_Item(OLEVariant(i),&aErr);
+ OSL_ENSURE(aErr,"No error in collection found! BAD!");
+ if(aErr)
{
if(i==nLen-1)
aException = SQLException(aErr.GetDescription(),_xInterface,aErr.GetSQLState(),aErr.GetNumber(),Any());
else
{
SQLException aTemp(aErr.GetDescription(),
- _xInterface,aErr.GetSQLState(),aErr.GetNumber(),makeAny(aException));
+ _xInterface,aErr.GetSQLState(),aErr.GetNumber(),Any(aException));
aTemp.NextException <<= aException;
aException = aTemp;
}
}
}
pErrors->Clear();
- pErrors->Release();
throw aException;
}
- pErrors->Release();
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx
index b41fbdbba05d..02cd239d7682 100644
--- a/connectivity/source/drivers/ado/AGroup.cxx
+++ b/connectivity/source/drivers/ado/AGroup.cxx
@@ -21,7 +21,6 @@
#include <ado/AGroup.hxx>
#include <ado/AUsers.hxx>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <ado/AConnection.hxx>
@@ -37,26 +36,14 @@ using namespace com::sun::star::sdbcx;
void WpADOGroup::Create()
{
- ADOGroup* pGroup = nullptr;
- HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOGROUP_25,
- nullptr,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOGROUP_25,
- reinterpret_cast<void**>(&pGroup) );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pGroup );
- pGroup->Release();
- }
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOGROUP_25, nullptr, CLSCTX_INPROC_SERVER);
}
OAdoGroup::OAdoGroup(OCatalog* _pParent,bool _bCase, ADOGroup* _pGroup) : OGroup_ADO(_bCase),m_pCatalog(_pParent)
{
construct();
if(_pGroup)
- m_aGroup = WpADOGroup(_pGroup);
+ m_aGroup.set(_pGroup);
else
m_aGroup.Create();
@@ -82,23 +69,6 @@ void OAdoGroup::refreshUsers()
m_pUsers.reset(new OUsers(m_pCatalog, m_aMutex, aVector, aUsers, isCaseSensitive()));
}
-Sequence< sal_Int8 > OAdoGroup::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoGroup::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OAdoGroup>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : OGroup_ADO::getSomething(rId);
-}
-
-
void OAdoGroup::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if(m_aGroup.IsValid())
diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx
index 211f34f6bebe..527cfaac13fa 100644
--- a/connectivity/source/drivers/ado/AGroups.cxx
+++ b/connectivity/source/drivers/ado/AGroups.cxx
@@ -40,7 +40,7 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-sdbcx::ObjectType OGroups::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OGroups::createObject(const OUString& _rName)
{
return new OAdoGroup(m_pCatalog,isCaseSensitive(),_rName);
}
@@ -56,9 +56,9 @@ Reference< XPropertySet > OGroups::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OGroups::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OGroups::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OAdoGroup* pGroup = getUnoTunnelImplementation<OAdoGroup>(descriptor);
+ OAdoGroup* pGroup = dynamic_cast<OAdoGroup*>(descriptor.get());
if ( pGroup == nullptr )
m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_GROUP_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx
index 61a047bc9b00..b183d49c2435 100644
--- a/connectivity/source/drivers/ado/AIndex.cxx
+++ b/connectivity/source/drivers/ado/AIndex.cxx
@@ -20,7 +20,6 @@
#include <ado/AIndex.hxx>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <cppuhelper/typeprovider.hxx>
#include <ado/AColumns.hxx>
#include <TConnection.hxx>
#include <comphelper/servicehelper.hxx>
@@ -40,7 +39,7 @@ OAdoIndex::OAdoIndex(bool _bCase,OConnection* _pConnection,ADOIndex* _pIndex)
,m_pConnection(_pConnection)
{
construct();
- m_aIndex = WpADOIndex(_pIndex);
+ m_aIndex.set(_pIndex);
fillPropertyValues();
}
@@ -71,22 +70,6 @@ void OAdoIndex::refreshColumns()
}
-Sequence< sal_Int8 > OAdoIndex::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoIndex::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OAdoIndex>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : sdbcx::OIndex::getSomething(rId);
-}
-
void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if(m_aIndex.IsValid())
diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx
index 616cd863ada4..ea80e2d6d4a7 100644
--- a/connectivity/source/drivers/ado/AIndexes.cxx
+++ b/connectivity/source/drivers/ado/AIndexes.cxx
@@ -40,7 +40,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-sdbcx::ObjectType OIndexes::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OIndexes::createObject(const OUString& _rName)
{
return new OAdoIndex(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
}
@@ -56,16 +56,16 @@ Reference< XPropertySet > OIndexes::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OAdoIndex* pIndex = getUnoTunnelImplementation<OAdoIndex>(descriptor);
+ OAdoIndex* pIndex = dynamic_cast<OAdoIndex*>(descriptor.get());
if ( pIndex == nullptr )
m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
ADOIndexes* pIndexes = m_aCollection;
if ( FAILED( pIndexes->Append( OLEVariant( _rForName ), OLEVariant( pIndex->getImpl() ) ) ) )
{
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
}
diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx
index 764765b35620..9c2734ede8f1 100644
--- a/connectivity/source/drivers/ado/AKey.cxx
+++ b/connectivity/source/drivers/ado/AKey.cxx
@@ -21,7 +21,6 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <ado/AColumns.hxx>
#include <ado/AConnection.hxx>
@@ -38,7 +37,7 @@ OAdoKey::OAdoKey(bool _bCase,OConnection* _pConnection, ADOKey* _pKey)
,m_pConnection(_pConnection)
{
construct();
- m_aKey = WpADOKey(_pKey);
+ m_aKey.set(_pKey);
fillPropertyValues();
}
@@ -67,22 +66,6 @@ void OAdoKey::refreshColumns()
m_pColumns.reset(new OColumns(*this, m_aMutex, aVector, aColumns, isCaseSensitive(), m_pConnection));
}
-Sequence< sal_Int8 > OAdoKey::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoKey::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OAdoKey>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : OKey_ADO::getSomething(rId);
-}
-
void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if(m_aKey.IsValid())
@@ -94,7 +77,7 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
OUString aVal;
rValue >>= aVal;
m_aKey.put_Name(aVal);
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
}
break;
case PROPERTY_ID_TYPE:
@@ -102,7 +85,7 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
sal_Int32 nVal=0;
rValue >>= nVal;
m_aKey.put_Type(Map2KeyRule(nVal));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
}
break;
case PROPERTY_ID_REFERENCEDTABLE:
@@ -110,7 +93,7 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
OUString aVal;
rValue >>= aVal;
m_aKey.put_RelatedTable(aVal);
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
}
break;
case PROPERTY_ID_UPDATERULE:
@@ -118,7 +101,7 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
sal_Int32 nVal=0;
rValue >>= nVal;
m_aKey.put_UpdateRule(Map2Rule(nVal));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
}
break;
case PROPERTY_ID_DELETERULE:
@@ -126,7 +109,7 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
sal_Int32 nVal=0;
rValue >>= nVal;
m_aKey.put_DeleteRule(Map2Rule(nVal));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
}
break;
}
diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx
index 0d921c39842b..caf7eda5a391 100644
--- a/connectivity/source/drivers/ado/AKeys.cxx
+++ b/connectivity/source/drivers/ado/AKeys.cxx
@@ -40,7 +40,7 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
-sdbcx::ObjectType OKeys::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OKeys::createObject(const OUString& _rName)
{
return new OAdoKey(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
}
@@ -56,9 +56,9 @@ Reference< XPropertySet > OKeys::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OKeys::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OKeys::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
{
- OAdoKey* pKey = getUnoTunnelImplementation<OAdoKey>( descriptor );
+ OAdoKey* pKey = dynamic_cast<OAdoKey*>( descriptor.get() );
if ( pKey == nullptr)
m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
@@ -78,7 +78,7 @@ sdbcx::ObjectType OKeys::appendObject( const OUString&, const Reference< XProper
adKeyPrimary, // must be every time adKeyPrimary
vOptional)) )
{
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
// just make sure that an SQLExceptionis thrown here
m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
}
@@ -90,7 +90,7 @@ sdbcx::ObjectType OKeys::appendObject( const OUString&, const Reference< XProper
void OKeys::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
{
if(!m_aCollection.Delete(OLEVariant(_sElementName).getString()))
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
}
diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx
index 34697fa4388a..d7c82d184fdb 100644
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ b/connectivity/source/drivers/ado/APreparedStatement.cxx
@@ -31,13 +31,14 @@
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
+#include <rtl/ref.hxx>
#include <strings.hrc>
#include <limits>
#define CHECK_RETURN(x) \
if(!x) \
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
#ifdef max
# undef max
@@ -54,7 +55,7 @@ using namespace com::sun::star::util;
IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.APreparedStatement","com.sun.star.sdbc.PreparedStatement");
OPreparedStatement::OPreparedStatement( OConnection* _pConnection, const OUString& sql)
- : OStatement_Base( _pConnection )
+ : OPreparedStatement_BASE(_pConnection)
{
osl_atomic_increment( &m_refCount );
@@ -91,24 +92,6 @@ OPreparedStatement::~OPreparedStatement()
}
}
-Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType )
-{
- Any aRet = OStatement_Base::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface( rType,
- static_cast< XPreparedStatement*>(this),
- static_cast< XParameters*>(this),
- static_cast< XResultSetMetaDataSupplier*>(this));
-}
-
-css::uno::Sequence< css::uno::Type > SAL_CALL OPreparedStatement::getTypes( )
-{
- ::cppu::OTypeCollection aTypes( cppu::UnoType<XPreparedStatement>::get(),
- cppu::UnoType<XParameters>::get(),
- cppu::UnoType<XResultSetMetaDataSupplier>::get());
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_Base::getTypes());
-}
-
Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( )
{
if(!m_xMetaData.is() && m_RecordSet.IsValid())
@@ -144,21 +127,18 @@ sal_Bool SAL_CALL OPreparedStatement::execute( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- SQLWarning warning;
clearWarnings ();
// Call SQLExecute
try {
ADORecordset* pSet=nullptr;
CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet))
- m_RecordSet = WpADORecordset(pSet);
+ m_RecordSet.set(pSet);
}
- catch (SQLWarning& ex)
+ catch (SQLWarning&)
{
- // Save pointer to warning and save with ResultSet
+ //TODO: Save pointer to warning and save with ResultSet
// object once it is created.
-
- warning = ex;
}
return m_RecordSet.IsValid();
}
@@ -173,11 +153,11 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( )
CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet))
if ( VT_ERROR == m_RecordsAffected.getType() )
{
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
// to be sure that we get the error really thrown
throw SQLException();
}
- m_RecordSet = WpADORecordset(pSet);
+ m_RecordSet.set(pSet);
return m_RecordsAffected.getInt32();
}
@@ -201,10 +181,9 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEn
}
else
{
- ADOParameter* pParam = nullptr;
- m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
- WpADOParameter aParam(pParam);
- if(pParam)
+ WpADOParameter aParam;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&aParam);
+ if(aParam)
{
DataTypeEnum eType = aParam.GetADOType();
if ( _eType != eType && _eType != adDBTimeStamp )
@@ -222,7 +201,7 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEn
CHECK_RETURN(aParam.PutValue(Val));
}
}
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
}
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x )
@@ -264,13 +243,12 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( )
CHECK_RETURN(m_RecordSet.get_CursorType(m_eCursorType))
CHECK_RETURN(m_RecordSet.get_LockType(m_eLockType))
- OResultSet* pSet = new OResultSet(m_RecordSet,this);
- Reference< XResultSet > xRs = pSet;
+ rtl::Reference<OResultSet> pSet = new OResultSet(m_RecordSet,this);
pSet->construct();
pSet->setMetaData(getMetaData());
- m_xResultSet = WeakReference<XResultSet>(xRs);
+ m_xResultSet = pSet.get();
- return xRs;
+ return pSet;
}
void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x )
@@ -415,10 +393,9 @@ void SAL_CALL OPreparedStatement::clearParameters( )
aVal.setEmpty();
for(sal_Int32 i=0;i<nCount;++i)
{
- ADOParameter* pParam = nullptr;
- m_pParameters->get_Item(OLEVariant(i),&pParam);
- WpADOParameter aParam(pParam);
- if(pParam)
+ WpADOParameter aParam;
+ m_pParameters->get_Item(OLEVariant(i),&aParam);
+ if(aParam)
{
CHECK_RETURN(aParam.PutValue(aVal));
}
@@ -426,16 +403,6 @@ void SAL_CALL OPreparedStatement::clearParameters( )
}
}
-void SAL_CALL OPreparedStatement::acquire() throw()
-{
- OStatement_Base::acquire();
-}
-
-void SAL_CALL OPreparedStatement::release() throw()
-{
- OStatement_Base::release();
-}
-
void OPreparedStatement::replaceParameterNodeName(OSQLParseNode const * _pNode,
const OUString& _sDefaultName,
sal_Int32& _rParameterCount)
@@ -447,7 +414,7 @@ void OPreparedStatement::replaceParameterNodeName(OSQLParseNode const * _pNode,
if(SQL_ISRULE(pChildNode,parameter) && pChildNode->count() == 1)
{
OSQLParseNode* pNewNode = new OSQLParseNode(OUString(":") ,SQLNodeType::Punctuation,0);
- delete pChildNode->replace(pChildNode->getChild(0),pNewNode);
+ pChildNode->replaceAndDelete(pChildNode->getChild(0), pNewNode);
OUString sParameterName = _sDefaultName + OUString::number(++_rParameterCount);
pChildNode->append(new OSQLParseNode( sParameterName,SQLNodeType::Name,0));
}
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index bf33edbd4528..ae1013c1c177 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -44,7 +44,7 @@ using namespace ::comphelper;
#define CHECK_RETURN(x) \
if(!SUCCEEDED(x)) \
- ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pStmt->m_pConnection->getConnection(),*this);
using namespace connectivity::ado;
using namespace com::sun::star::uno;
@@ -132,14 +132,10 @@ Any SAL_CALL OResultSet::queryInterface( const Type & rType )
css::uno::Sequence< css::uno::Type > SAL_CALL OResultSet::getTypes( )
{
- ::cppu::OTypeCollection aTypes( cppu::UnoType<css::beans::XMultiPropertySet>::get(),
- cppu::UnoType<css::beans::XFastPropertySet>::get(),
- cppu::UnoType<css::beans::XPropertySet>::get());
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
+ return comphelper::concatSequences(cppu::OPropertySetHelper::getTypes(),
+ OResultSet_BASE::getTypes());
}
-
sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName )
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -157,9 +153,8 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName )
}
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
- return 0; // Never reached
}
+
#define BLOCK_SIZE 256
Reference< css::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex )
@@ -205,7 +200,6 @@ Reference< css::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int
Reference< css::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getCharacterStream", *this );
- return nullptr;
}
OLEVariant OResultSet::getValue(sal_Int32 columnIndex )
@@ -266,7 +260,7 @@ sal_Int32 SAL_CALL OResultSet::getRow( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- PositionEnum_Param aPos;
+ PositionEnum aPos;
m_pRecordSet->get_AbsolutePosition(&aPos);
return (aPos > 0) ? static_cast<sal_Int32>(aPos) : m_nRowPos;
// return the rowcount from driver if the driver doesn't support this return our count
@@ -276,7 +270,6 @@ sal_Int32 SAL_CALL OResultSet::getRow( )
sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getLong", *this );
- return sal_Int64(0);
}
@@ -294,30 +287,23 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( )
Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getArray", *this );
- return nullptr;
}
-
Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getClob", *this );
- return nullptr;
}
Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getBlob", *this );
- return nullptr;
}
-
Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRef", *this );
- return nullptr;
}
-
Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
return getValue(columnIndex).makeAny();
@@ -596,7 +582,7 @@ sal_Bool SAL_CALL OResultSet::next( )
++m_nRowPos;
}
else
- ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pStmt->m_pConnection->getConnection(),*this);
}
return bRet;
@@ -818,12 +804,12 @@ Any SAL_CALL OResultSet::getBookmark( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
if(m_nRowPos < static_cast<sal_Int32>(m_aBookmarks.size())) // this bookmark was already fetched
- return makeAny(sal_Int32(m_nRowPos-1));
+ return Any(sal_Int32(m_nRowPos-1));
OLEVariant aVar;
m_pRecordSet->get_Bookmark(&aVar);
m_aBookmarks.push_back(aVar);
- return makeAny(static_cast<sal_Int32>(m_aBookmarks.size()-1));
+ return Any(static_cast<sal_Int32>(m_aBookmarks.size()-1));
}
@@ -882,11 +868,9 @@ sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- ADOProperties* pProps = nullptr;
- m_pRecordSet->get_Properties(&pProps);
WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- ADOS::ThrowException(*static_cast<OConnection*>(m_pStmt->getConnection().get())->getConnection(),*this);
+ m_pRecordSet->get_Properties(&aProps);
+ ADOS::ThrowException(static_cast<OConnection*>(m_pStmt->getConnection().get())->getConnection(),*this);
OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
WpADOProperty aProp(aProps.GetItem(OUString("Bookmarks Ordered")));
@@ -894,7 +878,7 @@ sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( )
if(aProp.IsValid())
aVar = aProp.GetValue();
else
- ADOS::ThrowException(*static_cast<OConnection*>(m_pStmt->getConnection().get())->getConnection(),*this);
+ ADOS::ThrowException(static_cast<OConnection*>(m_pStmt->getConnection().get())->getConnection(),*this);
bool bValue(false);
if(!aVar.isNull() && !aVar.isEmpty())
@@ -929,11 +913,9 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& ro
rgsabound[0].cElements = rows.getLength();
SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
- const Any* pBegin = rows.getConstArray();
- const Any* pEnd = pBegin + rows.getLength();
- for(sal_Int32 i=0;pBegin != pEnd ;++pBegin,++i)
+ for (sal_Int32 i = 0; i < rows.getLength(); ++i)
{
- *pBegin >>= nPos;
+ rows[i] >>= nPos;
SafeArrayPutElement(psa,&i,&m_aBookmarks[nPos]);
}
@@ -1035,26 +1017,31 @@ void OResultSet::setFetchSize(sal_Int32 _par0)
::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
{
- Sequence< css::beans::Property > aProps(5);
- css::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
- PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
+ PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(), PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY
+ }
+ }
+ };
}
::cppu::IPropertyArrayHelper & OResultSet::getInfoHelper()
@@ -1136,12 +1123,12 @@ void OResultSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
}
}
-void SAL_CALL OResultSet::acquire() throw()
+void SAL_CALL OResultSet::acquire() noexcept
{
OResultSet_BASE::acquire();
}
-void SAL_CALL OResultSet::release() throw()
+void SAL_CALL OResultSet::release() noexcept
{
OResultSet_BASE::release();
}
diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
index e64c1c45b6e9..d43ee5da9216 100644
--- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
@@ -72,10 +72,9 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( )
if ( !m_pRecordSet )
return 0;
- ADOFields* pFields = nullptr;
+ WpOLEAppendCollection<ADOFields, WpADOField> pFields;
m_pRecordSet->get_Fields(&pFields);
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields);
- m_nColCount = aFields.GetItemCount();
+ m_nColCount = pFields.GetItemCount();
return m_nColCount;
}
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx
index 599df13aba36..0764a4b335a5 100644
--- a/connectivity/source/drivers/ado/AStatement.cxx
+++ b/connectivity/source/drivers/ado/AStatement.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/sdbc/FetchDirection.hpp>
#include <connectivity/dbexception.hxx>
#include <comphelper/types.hxx>
+#include <rtl/ref.hxx>
#undef max
@@ -40,7 +41,7 @@ using namespace ::comphelper;
#define CHECK_RETURN(x) \
if(!x) \
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
using namespace connectivity::ado;
@@ -50,7 +51,6 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
-using namespace ::std;
OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex)
,OPropertySetHelper(OStatement_BASE::rBHelper)
@@ -66,7 +66,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(
if(m_Command.IsValid())
m_Command.putref_ActiveConnection(m_pConnection->getConnection());
else
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ ADOS::ThrowException(m_pConnection->getConnection(),*this);
m_RecordsAffected.setNoArg();
m_Parameters.setNoArg();
@@ -79,7 +79,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(
void OStatement_Base::disposeResultSet()
{
// free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
+ rtl::Reference< OResultSet > xComp = m_xResultSet.get();
if (xComp.is())
xComp->dispose();
m_xResultSet.clear();
@@ -94,7 +94,7 @@ void OStatement_Base::disposing()
disposeResultSet();
if ( m_Command.IsValid() )
- m_Command.putref_ActiveConnection( nullptr );
+ m_Command.putref_ActiveConnection({});
m_Command.clear();
if ( m_RecordSet.IsValid() )
@@ -107,7 +107,7 @@ void OStatement_Base::disposing()
OStatement_BASE::disposing();
}
-void SAL_CALL OStatement_Base::release() throw()
+void SAL_CALL OStatement_Base::release() noexcept
{
OStatement_BASE::release();
}
@@ -120,11 +120,8 @@ Any SAL_CALL OStatement_Base::queryInterface( const Type & rType )
css::uno::Sequence< css::uno::Type > SAL_CALL OStatement_Base::getTypes( )
{
- ::cppu::OTypeCollection aTypes( cppu::UnoType<css::beans::XMultiPropertySet>::get(),
- cppu::UnoType<css::beans::XFastPropertySet>::get(),
- cppu::UnoType<css::beans::XPropertySet>::get());
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
+ return comphelper::concatSequences(cppu::OPropertySetHelper::getTypes(),
+ OStatement_BASE::getTypes());
}
@@ -178,8 +175,7 @@ void OStatement_Base::clearMyResultSet ()
try
{
- Reference<XCloseable> xCloseable(
- m_xResultSet.get(), css::uno::UNO_QUERY);
+ rtl::Reference<OResultSet> xCloseable = m_xResultSet.get();
if ( xCloseable.is() )
xCloseable->close();
}
@@ -239,7 +235,7 @@ void OStatement_Base::setWarning (const SQLWarning &ex)
void OStatement_Base::assignRecordSet( ADORecordset* _pRS )
{
WpADORecordset aOldRS( m_RecordSet );
- m_RecordSet = WpADORecordset( _pRS );
+ m_RecordSet.set( _pRS );
if ( aOldRS.IsValid() )
aOldRS.PutRefDataSource( nullptr );
@@ -286,7 +282,7 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const OUString&
reset();
- m_xResultSet = WeakReference<XResultSet>(nullptr);
+ m_xResultSet.clear();
WpADORecordset aSet;
aSet.Create();
@@ -305,13 +301,12 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const OUString&
CHECK_RETURN(aSet.get_CursorType(m_eCursorType))
CHECK_RETURN(aSet.get_LockType(m_eLockType))
- OResultSet* pSet = new OResultSet(aSet,this);
- Reference< XResultSet > xRs = pSet;
+ rtl::Reference<OResultSet> pSet = new OResultSet(aSet,this);
pSet->construct();
- m_xResultSet = WeakReference<XResultSet>(xRs);
+ m_xResultSet = pSet.get();
- return xRs;
+ return pSet;
}
@@ -376,7 +371,7 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( )
{
assignRecordSet( pSet );
- ADO_LONGPTR nValue;
+ long nValue;
if(m_RecordSet.get_RecordCount(nValue))
pArray[j] = nValue;
}
@@ -418,7 +413,7 @@ Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return m_xResultSet;
+ return m_xResultSet.get();
}
@@ -428,7 +423,7 @@ sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- ADO_LONGPTR nRet;
+ long nRet;
if(m_RecordSet.IsValid() && m_RecordSet.get_RecordCount(nRet))
return nRet;
return -1;
@@ -441,8 +436,6 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- SQLWarning warning;
-
// clear previous warnings
clearWarnings ();
@@ -456,13 +449,11 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( )
if(m_RecordSet.IsValid() && m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet)
assignRecordSet( pSet );
}
- catch (SQLWarning &ex)
+ catch (SQLWarning &)
{
- // Save pointer to warning and save with ResultSet
+ //TODO: Save pointer to warning and save with ResultSet
// object once it is created.
-
- warning = ex;
}
return m_RecordSet.IsValid();
}
@@ -474,7 +465,7 @@ Any SAL_CALL OStatement_Base::getWarnings( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return makeAny(m_aLastWarning);
+ return Any(m_aLastWarning);
}
@@ -495,7 +486,7 @@ sal_Int32 OStatement_Base::getQueryTimeOut() const
sal_Int32 OStatement_Base::getMaxRows() const
{
- ADO_LONGPTR nRet=-1;
+ long nRet = -1;
if(!(m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet)))
::dbtools::throwFunctionSequenceException(nullptr);
return nRet;
@@ -645,31 +636,71 @@ void OStatement_Base::setCursorName(std::u16string_view _par0)
::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
{
- Sequence< css::beans::Property > aProps(10);
- css::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
- PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
- PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
- PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
- PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
- PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
+ PROPERTY_ID_ESCAPEPROCESSING,
+ cppu::UnoType<bool>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
+ PROPERTY_ID_MAXFIELDSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
+ PROPERTY_ID_MAXROWS,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
+ PROPERTY_ID_QUERYTIMEOUT,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
+ PROPERTY_ID_USEBOOKMARKS,
+ cppu::UnoType<bool>::get(),
+ 0
+ }
+ }
+ };
}
@@ -809,17 +840,17 @@ OStatement::~OStatement()
}
IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement");
-void SAL_CALL OStatement_Base::acquire() throw()
+void SAL_CALL OStatement_Base::acquire() noexcept
{
OStatement_BASE::acquire();
}
-void SAL_CALL OStatement::acquire() throw()
+void SAL_CALL OStatement::acquire() noexcept
{
OStatement_Base::acquire();
}
-void SAL_CALL OStatement::release() throw()
+void SAL_CALL OStatement::release() noexcept
{
OStatement_Base::release();
}
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
index 92f28ce56a06..47e22e125398 100644
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ b/connectivity/source/drivers/ado/ATable.cxx
@@ -31,7 +31,6 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbcx/KeyType.hpp>
#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <ado/Awrapado.hxx>
@@ -55,7 +54,7 @@ OAdoTable::OAdoTable(sdbcx::OCollection* _pTables,bool _bCase,OCatalog* _pCatalo
,m_pCatalog(_pCatalog)
{
construct();
- m_aTable = WpADOTable(_pTable);
+ m_aTable.set(_pTable);
// m_aTable.putref_ParentCatalog(_pCatalog->getCatalog());
fillPropertyValues();
@@ -91,7 +90,7 @@ void OAdoTable::refreshColumns()
if(m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pCatalog->getConnection());
+ m_xColumns.reset(new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pCatalog->getConnection()));
}
void OAdoTable::refreshKeys()
@@ -108,7 +107,7 @@ void OAdoTable::refreshKeys()
if(m_xKeys)
m_xKeys->reFill(aVector);
else
- m_xKeys = new OKeys(*this,m_aMutex,aVector,aKeys,isCaseSensitive(),m_pCatalog->getConnection());
+ m_xKeys.reset(new OKeys(*this,m_aMutex,aVector,aKeys,isCaseSensitive(),m_pCatalog->getConnection()));
}
void OAdoTable::refreshIndexes()
@@ -125,23 +124,7 @@ void OAdoTable::refreshIndexes()
if(m_xIndexes)
m_xIndexes->reFill(aVector);
else
- m_xIndexes = new OIndexes(*this,m_aMutex,aVector,aIndexes,isCaseSensitive(),m_pCatalog->getConnection());
-}
-
-Sequence< sal_Int8 > OAdoTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OAdoTable>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
+ m_xIndexes.reset(new OIndexes(*this,m_aMutex,aVector,aIndexes,isCaseSensitive(),m_pCatalog->getConnection()));
}
// XRename
@@ -151,7 +134,7 @@ void SAL_CALL OAdoTable::rename( const OUString& newName )
checkDisposed(OTableDescriptor_BASE_TYPEDEF::rBHelper.bDisposed);
m_aTable.put_Name(newName);
- ADOS::ThrowException(*(m_pCatalog->getConnection()->getConnection()),*this);
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),*this);
OTable_TYPEDEF::rename(newName);
}
@@ -168,7 +151,7 @@ void SAL_CALL OAdoTable::alterColumnByName( const OUString& colName, const Refer
checkDisposed(OTableDescriptor_BASE_TYPEDEF::rBHelper.bDisposed);
bool bError = true;
- OAdoColumn* pColumn = comphelper::getUnoTunnelImplementation<OAdoColumn>(descriptor);
+ OAdoColumn* pColumn = dynamic_cast<OAdoColumn*>(descriptor.get());
if(pColumn != nullptr)
{
WpADOColumns aColumns = m_aTable.get_Columns();
@@ -176,7 +159,7 @@ void SAL_CALL OAdoTable::alterColumnByName( const OUString& colName, const Refer
bError = bError || !aColumns.Append(pColumn->getColumnImpl());
}
if(bError)
- ADOS::ThrowException(*(m_pCatalog->getConnection()->getConnection()),*this);
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),*this);
m_xColumns->refresh();
refreshColumns();
diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx
index 9ce87634e425..48a82ceee2d5 100644
--- a/connectivity/source/drivers/ado/ATables.cxx
+++ b/connectivity/source/drivers/ado/ATables.cxx
@@ -44,7 +44,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-sdbcx::ObjectType OTables::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OTables::createObject(const OUString& _rName)
{
OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
return new OAdoTable(this,isCaseSensitive(),m_pCatalog,m_aCollection.GetItem(_rName));
@@ -63,15 +63,15 @@ Reference< XPropertySet > OTables::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OTables::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OTables::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
{
- OAdoTable* pTable = getUnoTunnelImplementation<OAdoTable>( descriptor );
+ OAdoTable* pTable = dynamic_cast<OAdoTable*>( descriptor.get() );
if ( pTable == nullptr )
m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_TABLE_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
if(!m_aCollection.Append(pTable->getImpl()))
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
m_aCollection.Refresh();
return new OAdoTable(this,isCaseSensitive(),m_pCatalog,pTable->getImpl());
@@ -82,7 +82,7 @@ void OTables::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
{
OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
if ( !m_aCollection.Delete(_sElementName) )
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
}
void OTables::appendNew(const OUString& _rsNewTable)
@@ -93,10 +93,10 @@ void OTables::appendNew(const OUString& _rsNewTable)
insertElement(_rsNewTable,nullptr);
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners);
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rsNewTable), Any(), Any());
+ OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
+ aListenerLoop.next()->elementInserted(aEvent);
}
diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx
index 724334cea696..eb7a5803f60c 100644
--- a/connectivity/source/drivers/ado/AUser.cxx
+++ b/connectivity/source/drivers/ado/AUser.cxx
@@ -21,7 +21,6 @@
#include <ado/ACatalog.hxx>
#include <ado/AGroups.hxx>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <ado/AConnection.hxx>
@@ -41,7 +40,7 @@ OAdoUser::OAdoUser(OCatalog* _pParent,bool _bCase, ADOUser* _pUser)
construct();
if(_pUser)
- m_aUser = WpADOUser(_pUser);
+ m_aUser.set(_pUser);
else
m_aUser.Create();
}
@@ -66,23 +65,6 @@ void OAdoUser::refreshGroups()
m_pGroups.reset(new OGroups(m_pCatalog, m_aMutex, aVector, aGroups, isCaseSensitive()));
}
-Sequence< sal_Int8 > OAdoUser::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoUser::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OAdoUser>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : OUser_TYPEDEF::getSomething(rId);
-}
-
-
void OAdoUser::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if(m_aUser.IsValid())
@@ -160,7 +142,7 @@ sal_Int32 SAL_CALL OAdoUser::getGrantablePrivileges( const OUString& objName, sa
RightsEnum eRights = m_aUser.GetPermissions(objName, ADOS::mapObjectType2Ado(objType));
if((eRights & adRightWithGrant) == adRightWithGrant)
nRights = ADOS::mapAdoRights2Sdbc(eRights);
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),*this);
return nRights;
}
@@ -169,7 +151,7 @@ void SAL_CALL OAdoUser::grantPrivileges( const OUString& objName, sal_Int32 objT
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
m_aUser.SetPermissions(objName,ADOS::mapObjectType2Ado(objType),adAccessGrant,RightsEnum(ADOS::mapRights2Ado(objPrivileges)));
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),*this);
}
void SAL_CALL OAdoUser::revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges )
@@ -177,7 +159,7 @@ void SAL_CALL OAdoUser::revokePrivileges( const OUString& objName, sal_Int32 obj
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
m_aUser.SetPermissions(objName,ADOS::mapObjectType2Ado(objType),adAccessRevoke,RightsEnum(ADOS::mapRights2Ado(objPrivileges)));
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),*this);
}
// XUser
@@ -186,7 +168,7 @@ void SAL_CALL OAdoUser::changePassword( const OUString& objPassword, const OUStr
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
m_aUser.ChangePassword(objPassword,newPassword);
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),*this);
}
diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx
index 2620e915a89e..ce45af21732c 100644
--- a/connectivity/source/drivers/ado/AUsers.cxx
+++ b/connectivity/source/drivers/ado/AUsers.cxx
@@ -27,6 +27,7 @@
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
+#include <systools/win32/oleauto.hxx>
#include <strings.hrc>
using namespace comphelper;
@@ -38,7 +39,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-sdbcx::ObjectType OUsers::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OUsers::createObject(const OUString& _rName)
{
return new OAdoUser(m_pCatalog,isCaseSensitive(),_rName);
}
@@ -54,14 +55,14 @@ Reference< XPropertySet > OUsers::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OUserExtend* pUser = getUnoTunnelImplementation<OUserExtend>( descriptor );
+ OUserExtend* pUser = dynamic_cast<OUserExtend*>( descriptor.get() );
if ( pUser == nullptr )
m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_USER_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
ADOUsers* pUsers = m_aCollection;
- pUsers->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword()).asBSTR());
+ pUsers->Append(OLEVariant(pUser->getImpl()), sal::systools::BStr(pUser->getPassword()));
return createObject( _rForName );
}
diff --git a/connectivity/source/drivers/ado/AView.cxx b/connectivity/source/drivers/ado/AView.cxx
index b53c1a026200..10a5524db95b 100644
--- a/connectivity/source/drivers/ado/AView.cxx
+++ b/connectivity/source/drivers/ado/AView.cxx
@@ -20,10 +20,11 @@
#include <ado/AView.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <ado/adoimp.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <ado/Awrapado.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
+#include <systools/win32/oleauto.hxx>
+
#include <TConnection.hxx>
@@ -41,23 +42,6 @@ OAdoView::OAdoView(bool _bCase,ADOView* _pView) : OView_ADO(_bCase,nullptr)
{
}
-Sequence< sal_Int8 > OAdoView::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OAdoView>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : OView_ADO::getSomething(rId);
-}
-
-
void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
{
if(m_aView.IsValid())
@@ -79,9 +63,9 @@ void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
if(!aVar.isNull() && !aVar.isEmpty())
{
ADOCommand* pCom = static_cast<ADOCommand*>(aVar.getIDispatch());
- OLEString aBSTR;
- pCom->get_CommandText(aBSTR.getAddress());
- rValue <<= aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pCom->get_CommandText(&aBSTR);
+ rValue <<= OUString(aBSTR);
}
}
break;
diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx
index 77cc5abfae0f..536b95309bb2 100644
--- a/connectivity/source/drivers/ado/AViews.cxx
+++ b/connectivity/source/drivers/ado/AViews.cxx
@@ -27,6 +27,9 @@
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
+#include <rtl/ref.hxx>
+#include <systools/win32/oleauto.hxx>
+
#include <strings.hrc>
using namespace ::comphelper;
@@ -39,9 +42,9 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-sdbcx::ObjectType OViews::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OViews::createObject(const OUString& _rName)
{
- OAdoView* pView = new OAdoView(isCaseSensitive(),m_aCollection.GetItem(_rName));
+ rtl::Reference<OAdoView> pView = new OAdoView(isCaseSensitive(),m_aCollection.GetItem(_rName));
pView->setNew(false);
return pView;
}
@@ -58,9 +61,9 @@ Reference< XPropertySet > OViews::createDescriptor()
// XAppend
-sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OAdoView* pView = getUnoTunnelImplementation<OAdoView>( descriptor );
+ OAdoView* pView = dynamic_cast<OAdoView*>( descriptor.get() );
if ( pView == nullptr )
m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_VIEW_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
@@ -73,8 +76,8 @@ sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Referen
aCommand.put_Name(sName);
aCommand.put_CommandText(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))));
ADOViews* pViews = m_aCollection;
- if(FAILED(pViews->Append(OLEString(sName).asBSTR(),aCommand)))
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
+ if (FAILED(pViews->Append(sal::systools::BStr(sName), aCommand)))
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables());
if ( pTables )
@@ -87,7 +90,7 @@ sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Referen
void OViews::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
{
if(!m_aCollection.Delete(_sElementName))
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
+ ADOS::ThrowException(m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
}
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx
index 8b6ad10b4662..75591468be36 100644
--- a/connectivity/source/drivers/ado/Aolevariant.cxx
+++ b/connectivity/source/drivers/ado/Aolevariant.cxx
@@ -37,64 +37,6 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::bridge::oleautomation;
using namespace connectivity::ado;
-OLEString::OLEString()
- :m_sStr(nullptr)
-{
-}
-OLEString::OLEString(const BSTR& _sBStr)
- :m_sStr(_sBStr)
-{
-}
-OLEString::OLEString(std::u16string_view _sBStr)
-{
- m_sStr = SysAllocStringLen(o3tl::toW(_sBStr.data()), _sBStr.length());
-}
-OLEString::~OLEString()
-{
- if(m_sStr)
- ::SysFreeString(m_sStr);
-}
-OLEString& OLEString::operator=(std::u16string_view _rSrc)
-{
- if(m_sStr)
- ::SysFreeString(m_sStr);
- m_sStr = SysAllocStringLen(o3tl::toW(_rSrc.data()), _rSrc.length());
- return *this;
-}
-OLEString& OLEString::operator=(const OLEString& _rSrc)
-{
- if(this != &_rSrc)
- {
- if(m_sStr)
- ::SysFreeString(m_sStr);
- m_sStr = ::SysAllocString(_rSrc.m_sStr);
- }
- return *this;
-}
-OLEString& OLEString::operator=(const BSTR& _rSrc)
-{
- if(m_sStr)
- ::SysFreeString(m_sStr);
- m_sStr = _rSrc;
- return *this;
-}
-OUString OLEString::asOUString() const
-{
- return (m_sStr != nullptr) ? OUString(o3tl::toU(m_sStr),::SysStringLen(m_sStr)) : OUString();
-}
-BSTR OLEString::asBSTR() const
-{
- return m_sStr;
-}
-BSTR* OLEString::getAddress()
-{
- return &m_sStr;
-}
-sal_Int32 OLEString::length() const
-{
- return (m_sStr != nullptr) ? ::SysStringLen(m_sStr) : 0;
-}
-
OLEVariant::OLEVariant()
{
VariantInit(this);
@@ -175,12 +117,10 @@ OLEVariant::OLEVariant(const css::uno::Sequence< sal_Int8 >& x)
vt = VT_ARRAY|VT_UI1;
parray = SafeArrayCreateVector(VT_UI1, 0, x.getLength());
- const sal_Int8* pBegin = x.getConstArray();
- const sal_Int8* pEnd = pBegin + x.getLength();
- for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin)
+ for (sal_Int32 i = 0; i < x.getLength(); ++i)
{
- sal_Int32 nData = *pBegin;
+ sal_Int32 nData = x[i];
HRESULT rs = SafeArrayPutElement(parray,&i,&nData);
OSL_ENSURE(S_OK == rs,"Error while copy byte data");
}
@@ -427,8 +367,8 @@ css::uno::Sequence< sal_Int8 > OLEVariant::getByteSequence() const
css::uno::Sequence< sal_Int8 > aRet;
if(V_VT(this) == VT_BSTR)
{
- OLEString sStr(V_BSTR(this));
- aRet = css::uno::Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sStr.asBSTR()),sizeof(sal_Unicode)*sStr.length());
+ aRet = css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8*>(V_BSTR(this)),
+ ::SysStringByteLen(V_BSTR(this)));
}
else if(!isNull())
{
diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx
index 6f4dd5ce1c20..74abd185353f 100644
--- a/connectivity/source/drivers/ado/Awrapado.cxx
+++ b/connectivity/source/drivers/ado/Awrapado.cxx
@@ -21,50 +21,38 @@
#include <ado/Awrapado.hxx>
#include <ado/Awrapadox.hxx>
#include <comphelper/types.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
+#include <systools/win32/oleauto.hxx>
using namespace connectivity::ado;
void WpADOCatalog::Create()
{
- _ADOCatalog* pCommand;
- HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOCATALOG_25,
- nullptr,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOCATALOG_25,
- reinterpret_cast<void**>(&pCommand) );
-
-
- if( !FAILED( hr ) )
- setWithOutAddRef(pCommand);
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOCATALOG_25, nullptr, CLSCTX_INPROC_SERVER);
}
WpADOProperties WpADOConnection::get_Properties() const
{
- ADOProperties* pProps=nullptr;
+ WpADOProperties pProps;
pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- return aProps;
+ return pProps;
}
OUString WpADOConnection::GetConnectionString() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_ConnectionString(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_ConnectionString(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOConnection::PutConnectionString(std::u16string_view aCon) const
{
assert(pInterface);
- OLEString bstr(aCon);
- bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr.asBSTR()));
-
- return bErg;
+ return SUCCEEDED(pInterface->put_ConnectionString(sal::systools::BStr(aCon)));
}
sal_Int32 WpADOConnection::GetCommandTimeout() const
@@ -104,9 +92,8 @@ bool WpADOConnection::Close()
bool WpADOConnection::Execute(std::u16string_view CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset)
{
assert(pInterface);
- OLEString sStr1(CommandText);
- bool bErg = SUCCEEDED(pInterface->Execute(sStr1.asBSTR(),&RecordsAffected,Options,reinterpret_cast<ADORecordset**>(ppiRset)));
- return bErg;
+ return SUCCEEDED(pInterface->Execute(sal::systools::BStr(CommandText), &RecordsAffected,
+ Options, reinterpret_cast<ADORecordset**>(ppiRset)));
}
bool WpADOConnection::BeginTrans()
@@ -131,11 +118,9 @@ bool WpADOConnection::RollbackTrans( )
bool WpADOConnection::Open(std::u16string_view ConnectionString, std::u16string_view UserID,std::u16string_view Password,long Options)
{
assert(pInterface);
- OLEString sStr1(ConnectionString);
- OLEString sStr2(UserID);
- OLEString sStr3(Password);
- bool bErg = SUCCEEDED(pInterface->Open(sStr1.asBSTR(),sStr2.asBSTR(),sStr3.asBSTR(),Options));
- return bErg;
+ return SUCCEEDED(pInterface->Open(sal::systools::BStr(ConnectionString),
+ sal::systools::BStr(UserID), sal::systools::BStr(Password),
+ Options));
}
bool WpADOConnection::GetErrors(ADOErrors** pErrors)
@@ -147,17 +132,14 @@ bool WpADOConnection::GetErrors(ADOErrors** pErrors)
OUString WpADOConnection::GetDefaultDatabase() const
{
assert(pInterface);
- OLEString aBSTR; pInterface->get_DefaultDatabase(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOConnection::PutDefaultDatabase(std::u16string_view _bstr)
{
assert(pInterface);
- OLEString bstr(_bstr);
- bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr.asBSTR()));
-
- return bErg;
+ return SUCCEEDED(pInterface->put_DefaultDatabase(sal::systools::BStr(_bstr)));
}
IsolationLevelEnum WpADOConnection::get_IsolationLevel() const
@@ -219,15 +201,14 @@ bool WpADOConnection::put_Mode(const ConnectModeEnum &eNum)
OUString WpADOConnection::get_Provider() const
{
assert(pInterface);
- OLEString aBSTR; pInterface->get_Provider(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR; pInterface->get_Provider(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOConnection::put_Provider(std::u16string_view _bstr)
{
assert(pInterface);
- OLEString bstr(_bstr);
- return SUCCEEDED(pInterface->put_Provider(bstr.asBSTR()));
+ return SUCCEEDED(pInterface->put_Provider(sal::systools::BStr(_bstr)));
}
sal_Int32 WpADOConnection::get_State() const
@@ -247,18 +228,15 @@ bool WpADOConnection::OpenSchema(SchemaEnum eNum,OLEVariant const & Restrictions
OUString WpADOConnection::get_Version() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Version(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Version(&aBSTR);
+ return OUString(aBSTR);
}
-bool WpADOCommand::putref_ActiveConnection( WpADOConnection *pCon)
+bool WpADOCommand::putref_ActiveConnection(const WpADOConnection& rCon)
{
assert(pInterface);
- if(pCon)
- return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface));
- else
- return SUCCEEDED(pInterface->putref_ActiveConnection(nullptr));
+ return SUCCEEDED(pInterface->putref_ActiveConnection(rCon));
}
void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
@@ -269,31 +247,19 @@ void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
void WpADOCommand::Create()
{
- IClassFactory2* pInterface2 = nullptr;
- HRESULT hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21,
- CLSCTX_INPROC_SERVER,
- nullptr,
- IID_IClassFactory2,
- reinterpret_cast<void**>(&pInterface2) );
-
- if( !FAILED( hr ) )
+ sal::systools::COMReference<IClassFactory2> pInterface2;
+ if (!FAILED(pInterface2.CoGetClassObject(ADOS::CLSID_ADOCOMMAND_21, CLSCTX_INPROC_SERVER)))
{
- ADOCommand* pCommand=nullptr;
- IUnknown* pOuter=nullptr;
+ sal::systools::COMReference<ADOCommand> pCommand;
- hr = pInterface2->CreateInstanceLic( pOuter,
+ HRESULT hr = pInterface2->CreateInstanceLic(nullptr,
nullptr,
ADOS::IID_ADOCOMMAND_21,
- ADOS::GetKeyStr().asBSTR(),
+ ADOS::GetKeyStr(),
reinterpret_cast<void**>(&pCommand));
if( !FAILED( hr ) )
- {
- operator=(pCommand);
- pCommand->Release();
- }
-
- pInterface2->Release();
+ pInterface = std::move(pCommand);
}
}
@@ -308,18 +274,15 @@ sal_Int32 WpADOCommand::get_State() const
OUString WpADOCommand::get_CommandText() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_CommandText(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_CommandText(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOCommand::put_CommandText(std::u16string_view aCon)
{
assert(pInterface);
- OLEString bstr(aCon);
- bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr.asBSTR()));
-
- return bErg;
+ return SUCCEEDED(pInterface->put_CommandText(sal::systools::BStr(aCon)));
}
sal_Int32 WpADOCommand::get_CommandTimeout() const
@@ -360,8 +323,8 @@ ADOParameter* WpADOCommand::CreateParameter(std::u16string_view _bstr,DataTypeEn
{
assert(pInterface);
ADOParameter* pPara = nullptr;
- OLEString bstr(_bstr);
- bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr.asBSTR(),Type,Direction,nSize,Value,&pPara));
+ bool bErg = SUCCEEDED(pInterface->CreateParameter(sal::systools::BStr(_bstr), Type, Direction,
+ nSize, Value, &pPara));
return bErg ? pPara : nullptr;
}
@@ -392,18 +355,15 @@ CommandTypeEnum WpADOCommand::get_CommandType() const
OUString WpADOCommand::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOCommand::put_Name(std::u16string_view Name)
{
assert(pInterface);
- OLEString bstr(Name);
- bool bErg = SUCCEEDED(pInterface->put_Name(bstr.asBSTR()));
-
- return bErg;
+ return SUCCEEDED(pInterface->put_Name(sal::systools::BStr(Name)));
}
bool WpADOCommand::Cancel()
{
@@ -414,17 +374,17 @@ bool WpADOCommand::Cancel()
OUString WpADOError::GetDescription() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Description(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Description(&aBSTR);
+ return OUString(aBSTR);
}
OUString WpADOError::GetSource() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Source(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Source(&aBSTR);
+ return OUString(aBSTR);
}
sal_Int32 WpADOError::GetNumber() const
@@ -438,9 +398,9 @@ sal_Int32 WpADOError::GetNumber() const
OUString WpADOError::GetSQLState() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_SQLState(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_SQLState(&aBSTR);
+ return OUString(aBSTR);
}
sal_Int32 WpADOError::GetNativeError() const
@@ -454,18 +414,15 @@ sal_Int32 WpADOError::GetNativeError() const
WpADOProperties WpADOField::get_Properties()
{
assert(pInterface);
- ADOProperties* pProps = nullptr;
+ WpADOProperties pProps;
pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
-
- aProps.setWithOutAddRef(pProps);
- return aProps;
+ return pProps;
}
sal_Int32 WpADOField::GetActualSize() const
{
assert(pInterface);
- ADO_LONGPTR nActualSize=0;
+ long nActualSize = 0;
pInterface->get_ActualSize(&nActualSize);
return nActualSize;
}
@@ -488,7 +445,7 @@ sal_Int32 WpADOField::GetStatus() const
sal_Int32 WpADOField::GetDefinedSize() const
{
assert(pInterface);
- ADO_LONGPTR nDefinedSize=0;
+ long nDefinedSize = 0;
pInterface->get_DefinedSize(&nDefinedSize);
return nDefinedSize;
}
@@ -497,9 +454,9 @@ sal_Int32 WpADOField::GetDefinedSize() const
OUString WpADOField::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
DataTypeEnum WpADOField::GetADOType() const
@@ -649,9 +606,9 @@ bool WpADOProperty::PutValue(const OLEVariant &aValVar)
OUString WpADOProperty::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
DataTypeEnum WpADOProperty::GetADOType() const
@@ -677,30 +634,18 @@ bool WpADOProperty::PutAttributes(sal_Int32 _nDefSize)
}
void WpADORecordset::Create()
{
- IClassFactory2* pInterface2 = nullptr;
- HRESULT hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21,
- CLSCTX_INPROC_SERVER,
- nullptr,
- IID_IClassFactory2,
- reinterpret_cast<void**>(&pInterface2) );
-
- if( !FAILED( hr ) )
+ sal::systools::COMReference<IClassFactory2> pInterface2;
+ if (!FAILED(pInterface2.CoGetClassObject(ADOS::CLSID_ADORECORDSET_21, CLSCTX_INPROC_SERVER)))
{
- ADORecordset *pRec = nullptr;
- IUnknown *pOuter = nullptr;
- hr = pInterface2->CreateInstanceLic( pOuter,
+ sal::systools::COMReference<ADORecordset> pRec;
+ HRESULT hr = pInterface2->CreateInstanceLic(nullptr,
nullptr,
ADOS::IID_ADORECORDSET_21,
- ADOS::GetKeyStr().asBSTR(),
+ ADOS::GetKeyStr(),
reinterpret_cast<void**>(&pRec));
if( !FAILED( hr ) )
- {
- operator=(pRec);
- pRec->Release();
- }
-
- pInterface2->Release();
+ pInterface = std::move(pRec);
}
}
@@ -752,10 +697,10 @@ bool WpADORecordset::Supports( /* [in] */ CursorOptionEnum CursorOptions)
return bSupports == VARIANT_TRUE;
}
-PositionEnum_Param WpADORecordset::get_AbsolutePosition()
+PositionEnum WpADORecordset::get_AbsolutePosition()
{
assert(pInterface);
- PositionEnum_Param aTemp=adPosUnknown;
+ PositionEnum aTemp = adPosUnknown;
pInterface->get_AbsolutePosition(&aTemp);
return aTemp;
}
@@ -804,11 +749,9 @@ bool WpADORecordset::SetBookmark(const OLEVariant &pSafeAr)
WpADOFields WpADORecordset::GetFields() const
{
assert(pInterface);
- ADOFields* pFields=nullptr;
+ WpADOFields pFields;
pInterface->get_Fields(&pFields);
- WpADOFields aFields;
- aFields.setWithOutAddRef(pFields);
- return aFields;
+ return pFields;
}
@@ -861,11 +804,9 @@ bool WpADORecordset::CancelUpdate()
WpADOProperties WpADORecordset::get_Properties() const
{
assert(pInterface);
- ADOProperties* pProps=nullptr;
+ WpADOProperties pProps;
pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- return aProps;
+ return pProps;
}
bool WpADORecordset::NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset)
@@ -874,13 +815,13 @@ bool WpADORecordset::NextRecordset(OLEVariant& RecordsAffected,ADORecordset** pp
return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset));
}
-bool WpADORecordset::get_RecordCount(ADO_LONGPTR &_nRet) const
+bool WpADORecordset::get_RecordCount(long& _nRet) const
{
assert(pInterface);
return SUCCEEDED(pInterface->get_RecordCount(&_nRet));
}
-bool WpADORecordset::get_MaxRecords(ADO_LONGPTR &_nRet) const
+bool WpADORecordset::get_MaxRecords(long& _nRet) const
{
assert(pInterface);
return SUCCEEDED(pInterface->get_MaxRecords(&_nRet));
@@ -937,9 +878,9 @@ bool WpADORecordset::UpdateBatch(AffectEnum AffectRecords)
OUString WpADOParameter::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
DataTypeEnum WpADOParameter::GetADOType() const
@@ -1021,30 +962,28 @@ bool WpADOParameter::put_Size(sal_Int32 _nSize)
OUString WpADOColumn::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
OUString WpADOColumn::get_RelatedColumn() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_RelatedColumn(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_RelatedColumn(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOColumn::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ pInterface->put_Name(sal::systools::BStr(_rName));
}
void WpADOColumn::put_RelatedColumn(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_RelatedColumn(bstr.asBSTR());
+ pInterface->put_RelatedColumn(sal::systools::BStr(_rName));
}
DataTypeEnum WpADOColumn::get_Type() const
@@ -1127,27 +1066,23 @@ bool WpADOColumn::put_Attributes(const ColumnAttributesEnum& _eNum)
WpADOProperties WpADOColumn::get_Properties() const
{
assert(pInterface);
- ADOProperties* pProps = nullptr;
+ WpADOProperties pProps;
pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
-
- aProps.setWithOutAddRef(pProps);
- return aProps;
+ return pProps;
}
OUString WpADOKey::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOKey::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ pInterface->put_Name(sal::systools::BStr(_rName));
}
KeyTypeEnum WpADOKey::get_Type() const
@@ -1167,16 +1102,15 @@ void WpADOKey::put_Type(const KeyTypeEnum& _eNum)
OUString WpADOKey::get_RelatedTable() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_RelatedTable(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_RelatedTable(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOKey::put_RelatedTable(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_RelatedTable(bstr.asBSTR());
+ pInterface->put_RelatedTable(sal::systools::BStr(_rName));
}
RuleEnum WpADOKey::get_DeleteRule() const
@@ -1210,26 +1144,23 @@ void WpADOKey::put_UpdateRule(const RuleEnum& _eNum)
WpADOColumns WpADOKey::get_Columns() const
{
assert(pInterface);
- ADOColumns* pCols = nullptr;
+ WpADOColumns pCols;
pInterface->get_Columns(&pCols);
- WpADOColumns aCols;
- aCols.setWithOutAddRef(pCols);
- return aCols;
+ return pCols;
}
OUString WpADOIndex::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOIndex::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ pInterface->put_Name(sal::systools::BStr(_rName));
}
bool WpADOIndex::get_Clustered() const
@@ -1277,11 +1208,9 @@ void WpADOIndex::put_PrimaryKey(bool _b)
WpADOColumns WpADOIndex::get_Columns() const
{
assert(pInterface);
- ADOColumns* pCols = nullptr;
+ WpADOColumns pCols;
pInterface->get_Columns(&pCols);
- WpADOColumns aCols;
- aCols.setWithOutAddRef(pCols);
- return aCols;
+ return pCols;
}
void WpADOCatalog::putref_ActiveConnection(IDispatch* pCon)
@@ -1293,41 +1222,33 @@ void WpADOCatalog::putref_ActiveConnection(IDispatch* pCon)
WpADOTables WpADOCatalog::get_Tables()
{
assert(pInterface);
- ADOTables* pRet = nullptr;
+ WpADOTables pRet;
pInterface->get_Tables(&pRet);
- WpADOTables aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
+ return pRet;
}
WpADOViews WpADOCatalog::get_Views()
{
assert(pInterface);
- ADOViews* pRet = nullptr;
+ WpADOViews pRet;
pInterface->get_Views(&pRet);
- WpADOViews aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
+ return pRet;
}
WpADOGroups WpADOCatalog::get_Groups()
{
assert(pInterface);
- ADOGroups* pRet = nullptr;
+ WpADOGroups pRet;
pInterface->get_Groups(&pRet);
- WpADOGroups aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
+ return pRet;
}
WpADOUsers WpADOCatalog::get_Users()
{
assert(pInterface);
- ADOUsers* pRet = nullptr;
+ WpADOUsers pRet;
pInterface->get_Users(&pRet);
- WpADOUsers aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
+ return pRet;
}
ADOProcedures* WpADOCatalog::get_Procedures()
@@ -1341,82 +1262,71 @@ ADOProcedures* WpADOCatalog::get_Procedures()
OUString WpADOTable::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOTable::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ pInterface->put_Name(sal::systools::BStr(_rName));
}
OUString WpADOTable::get_Type() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Type(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Type(&aBSTR);
+ return OUString(aBSTR);
}
WpADOColumns WpADOTable::get_Columns() const
{
assert(pInterface);
- ADOColumns* pCols = nullptr;
+ WpADOColumns pCols;
pInterface->get_Columns(&pCols);
- WpADOColumns aCols;
- aCols.setWithOutAddRef(pCols);
- return aCols;
+ return pCols;
}
WpADOIndexes WpADOTable::get_Indexes() const
{
assert(pInterface);
- ADOIndexes* pCols = nullptr;
- pInterface->get_Indexes(&pCols);
- WpADOIndexes aRet;
- aRet.setWithOutAddRef(pCols);
- return aRet;
+ WpADOIndexes pRet;
+ pInterface->get_Indexes(&pRet);
+ return pRet;
}
WpADOKeys WpADOTable::get_Keys() const
{
assert(pInterface);
- ADOKeys* pCols = nullptr;
- pInterface->get_Keys(&pCols);
- WpADOKeys aRet;
- aRet.setWithOutAddRef(pCols);
- return aRet;
+ WpADOKeys pRet;
+ pInterface->get_Keys(&pRet);
+ return pRet;
}
WpADOCatalog WpADOTable::get_ParentCatalog() const
{
assert(pInterface);
- ADOCatalog* pCat = nullptr;
+ WpADOCatalog pCat;
pInterface->get_ParentCatalog(&pCat);
- WpADOCatalog aRet;
- aRet.setWithOutAddRef(pCat);
- return aRet;
+ return pCat;
}
WpADOProperties WpADOTable::get_Properties() const
{
assert(pInterface);
- ADOProperties* pProps = nullptr;
+ WpADOProperties pProps;
pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- return aProps;
+ return pProps;
}
OUString WpADOView::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOView::get_Command(OLEVariant& _rVar) const
@@ -1433,15 +1343,14 @@ void WpADOView::put_Command(OLEVariant const & _rVar)
OUString WpADOGroup::get_Name() const
{
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOGroup::put_Name(std::u16string_view _rName)
{
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ pInterface->put_Name(sal::systools::BStr(_rName));
}
RightsEnum WpADOGroup::GetPermissions(
@@ -1468,41 +1377,34 @@ bool WpADOGroup::SetPermissions(
WpADOUsers WpADOGroup::get_Users( )
{
- ADOUsers* pRet = nullptr;
+ WpADOUsers pRet;
pInterface->get_Users( &pRet);
- WpADOUsers aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
+ return pRet;
}
OUString WpADOUser::get_Name() const
{
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOUser::put_Name(std::u16string_view _rName)
{
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ pInterface->put_Name(sal::systools::BStr(_rName));
}
bool WpADOUser::ChangePassword(std::u16string_view _rPwd,std::u16string_view _rNewPwd)
{
- OLEString sStr1(_rPwd);
- OLEString sStr2(_rNewPwd);
- bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1.asBSTR(),sStr2.asBSTR()));
- return bErg;
+ return SUCCEEDED(
+ pInterface->ChangePassword(sal::systools::BStr(_rPwd), sal::systools::BStr(_rNewPwd)));
}
WpADOGroups WpADOUser::get_Groups()
{
- ADOGroups* pRet = nullptr;
+ WpADOGroups pRet;
pInterface->get_Groups(&pRet);
- WpADOGroups aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
+ return pRet;
}
RightsEnum WpADOUser::GetPermissions(
@@ -1527,73 +1429,6 @@ bool WpADOUser::SetPermissions(
return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId));
}
-WpBase::WpBase() : pIUnknown(nullptr)
-{
-}
-WpBase::WpBase(IDispatch* pInt)
- :pIUnknown(pInt)
-{
- if (pIUnknown)
- {
- pIUnknown->AddRef();
- }
-}
-
-WpBase::WpBase(const WpBase& aWrapper)
- :pIUnknown(aWrapper.pIUnknown)
-{
- if (pIUnknown)
- pIUnknown->AddRef();
-}
-
-//inline
-WpBase& WpBase::operator=(const WpBase& rhs)
-{
- operator=(rhs.pIUnknown);
- return *this;
-};
-
-WpBase& WpBase::operator=(IDispatch* rhs)
-{
- if (pIUnknown != rhs)
- {
- if (pIUnknown)
- pIUnknown->Release();
- pIUnknown = rhs;
- if (pIUnknown)
- pIUnknown->AddRef();
- }
- return *this;
-}
-
-WpBase::~WpBase()
-{
- if (pIUnknown)
- {
- pIUnknown->Release();
- pIUnknown = nullptr;
- }
-}
-
-void WpBase::clear()
-{
- if (pIUnknown)
- {
- pIUnknown->Release();
- pIUnknown = nullptr;
- }
-}
-
-
-bool WpBase::IsValid() const
-{
- return pIUnknown != nullptr;
-}
-WpBase::operator IDispatch*()
-{
- return pIUnknown;
-}
-
ADORecordset* WpADOConnection::getExportedKeys( const css::uno::Any& catalog, const OUString& schema, std::u16string_view table )
{
// Create elements used in the array
@@ -1603,7 +1438,7 @@ ADORecordset* WpADOConnection::getExportedKeys( const css::uno::Any& catalog, co
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1643,7 +1478,7 @@ ADORecordset* WpADOConnection::getImportedKeys( const css::uno::Any& catalog, co
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1685,7 +1520,7 @@ ADORecordset* WpADOConnection::getPrimaryKeys( const css::uno::Any& catalog, con
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1725,7 +1560,7 @@ ADORecordset* WpADOConnection::getIndexInfo(
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1759,7 +1594,7 @@ ADORecordset* WpADOConnection::getIndexInfo(
ADORecordset* WpADOConnection::getTablePrivileges( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern )
+ std::u16string_view tableNamePattern )
{
SAFEARRAYBOUND rgsabound[1];
SAFEARRAY *psa = nullptr;
@@ -1767,7 +1602,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1779,7 +1614,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(tableNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(tableNamePattern, u"%"))
varCriteria[nPos].setString(tableNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
@@ -1813,7 +1648,7 @@ ADORecordset* WpADOConnection::getCrossReference( const css::uno::Any& primaryCa
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1854,7 +1689,7 @@ ADORecordset* WpADOConnection::getCrossReference( const css::uno::Any& primaryCa
ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& procedureNamePattern )
+ std::u16string_view procedureNamePattern )
{
SAFEARRAYBOUND rgsabound[1];
SAFEARRAY *psa = nullptr;
@@ -1862,7 +1697,7 @@ ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1874,7 +1709,7 @@ ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(procedureNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(procedureNamePattern, u"%"))
varCriteria[nPos].setString(procedureNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
@@ -1893,8 +1728,8 @@ ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& procedureNamePattern,
- const OUString& columnNamePattern )
+ std::u16string_view procedureNamePattern,
+ std::u16string_view columnNamePattern )
{
// Create elements used in the array
SAFEARRAYBOUND rgsabound[1];
@@ -1903,7 +1738,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1915,11 +1750,11 @@ ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(procedureNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(procedureNamePattern, u"%"))
varCriteria[nPos].setString(procedureNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
- if(columnNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(columnNamePattern, u"%"))
varCriteria[nPos].setString(columnNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
@@ -1938,7 +1773,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog
ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern,
+ std::u16string_view tableNamePattern,
const css::uno::Sequence< OUString >& types )
{
// Create elements used in the array
@@ -1955,18 +1790,16 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
++nPos;
- if(tableNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(tableNamePattern, u"%"))
varCriteria[nPos].setString(tableNamePattern);
++nPos;
OUStringBuffer aTypes;
- const OUString* pIter = types.getConstArray();
- const OUString* pEnd = pIter + types.getLength();
- for( ; pIter != pEnd ; ++pIter)
+ for (auto& type : types)
{
if ( aTypes.getLength() )
aTypes.append(",");
- aTypes.append(*pIter);
+ aTypes.append(type);
}
OUString sTypeNames = aTypes.makeStringAndClear();
@@ -1974,7 +1807,7 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
varCriteria[nPos].setString(sTypeNames);
// Create SafeArray Bounds and initialize the array
- const sal_Int32 nCrit = SAL_N_ELEMENTS(varCriteria);
+ const sal_Int32 nCrit = std::size(varCriteria);
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = nCrit;
@@ -2001,7 +1834,7 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
ADORecordset* WpADOConnection::getColumns( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern,
+ std::u16string_view tableNamePattern,
std::u16string_view columnNamePattern )
{
// Create elements used in the array
@@ -2011,7 +1844,7 @@ ADORecordset* WpADOConnection::getColumns( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -2023,7 +1856,7 @@ ADORecordset* WpADOConnection::getColumns( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(tableNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(tableNamePattern, u"%"))
varCriteria[nPos].setString(tableNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
@@ -2055,7 +1888,7 @@ ADORecordset* WpADOConnection::getColumnPrivileges( const css::uno::Any& catalog
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -2090,7 +1923,7 @@ ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
{
// Create elements used in the array
OLEVariant varCriteria[2];
- const int nCrit = SAL_N_ELEMENTS(varCriteria);
+ const int nCrit = std::size(varCriteria);
// Create SafeArray Bounds and initialize the array
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
@@ -2128,11 +1961,6 @@ void WpADOTable::putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObjec
SAL_WARN_IF(!bRet, "connectivity.ado", "Could not set ParentCatalog!");
}
-void WpBase::setIDispatch(IDispatch* _pIUnknown)
-{
- pIUnknown = _pIUnknown;
-}
-
void OTools::putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar)
{
SAL_WARN_IF(!_rProps.IsValid(), "connectivity.ado", "Properties are not valid!");
diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx
index 0b4936e734f2..91f19dd7380d 100644
--- a/connectivity/source/drivers/ado/adoimp.cxx
+++ b/connectivity/source/drivers/ado/adoimp.cxx
@@ -23,6 +23,7 @@
#include <ado/Awrapado.hxx>
#include <ado/adoimp.hxx>
#include <osl/diagnose.h>
+#include <systools/win32/oleauto.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
@@ -67,9 +68,9 @@ const IID ADOS::IID_ADOUSER_25 = MYADOID(0x00000619);
const CLSID ADOS::CLSID_ADOVIEW_25 = MYADOID(0x00000612);
const IID ADOS::IID_ADOVIEW_25 = MYADOID(0x00000613);
-OLEString& ADOS::GetKeyStr()
+BSTR ADOS::GetKeyStr()
{
- static OLEString sKeyStr(u"gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz");
+ static sal::systools::BStr sKeyStr(u"gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz");
return sKeyStr;
}
@@ -310,9 +311,8 @@ WpADOField ADOS::getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex)
if ( !_pRecordSet )
return WpADOField();
- ADOFields* pFields = nullptr;
- _pRecordSet->get_Fields(&pFields);
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields);
+ WpOLEAppendCollection<ADOFields, WpADOField> aFields;
+ _pRecordSet->get_Fields(&aFields);
if(_nColumnIndex <= 0 || _nColumnIndex > aFields.GetItemCount())
::dbtools::throwInvalidIndexException(nullptr);
WpADOField aField(aFields.GetItem(_nColumnIndex-1));
diff --git a/connectivity/source/drivers/calc/CCatalog.cxx b/connectivity/source/drivers/calc/CCatalog.cxx
index 03c4358b9b65..60cf3e7ba06a 100644
--- a/connectivity/source/drivers/calc/CCatalog.cxx
+++ b/connectivity/source/drivers/calc/CCatalog.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
@@ -41,7 +40,7 @@ void OCalcCatalog::refreshTables()
::std::vector<OUString> aVector;
Sequence<OUString> aTypes;
OCalcConnection::ODocHolder aDocHolder(static_cast<OCalcConnection*>(m_pConnection));
- Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), "%", "%", aTypes);
+ Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), u"%"_ustr, u"%"_ustr, aTypes);
if (xResult.is())
{
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
index 9b03d473bda1..d1ae21a38e07 100644
--- a/connectivity/source/drivers/calc/CConnection.cxx
+++ b/connectivity/source/drivers/calc/CConnection.cxx
@@ -62,9 +62,9 @@ void OCalcConnection::construct(const OUString& url,const Sequence< PropertyValu
sal_Int32 nLen = url.indexOf(':');
nLen = url.indexOf(':',nLen+1);
- OUString aDSN(url.copy(nLen+1));
- m_aFileName = aDSN;
+ m_aFileName = url.copy(nLen+1); // DSN
+
INetURLObject aURL;
aURL.SetSmartProtocol(INetProtocol::File);
{
@@ -80,18 +80,15 @@ void OCalcConnection::construct(const OUString& url,const Sequence< PropertyValu
m_aFileName = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
m_sPassword.clear();
- const char pPwd[] = "password";
- const PropertyValue *pIter = info.getConstArray();
- const PropertyValue *pEnd = pIter + info.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& propval : info)
{
- if(pIter->Name == pPwd)
+ if (propval.Name == "password")
{
- pIter->Value >>= m_sPassword;
+ propval.Value >>= m_sPassword;
break;
}
- } // for(;pIter != pEnd;++pIter)
+ }
ODocHolder aDocHolder(this); // just to test that the doc can be loaded
acquireDoc();
}
@@ -104,18 +101,17 @@ Reference< XSpreadsheetDocument> const & OCalcConnection::acquireDoc()
return m_xDoc;
}
// open read-only as long as updating isn't implemented
- Sequence<PropertyValue> aArgs(2);
- aArgs[0].Name = "Hidden";
- aArgs[0].Value <<= true;
- aArgs[1].Name = "ReadOnly";
- aArgs[1].Value <<= true;
+ Sequence<PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3);
+ auto pArgs = aArgs.getArray();
+ pArgs[0].Name = "Hidden";
+ pArgs[0].Value <<= true;
+ pArgs[1].Name = "ReadOnly";
+ pArgs[1].Value <<= true;
if ( !m_sPassword.isEmpty() )
{
- const sal_Int32 nPos = aArgs.getLength();
- aArgs.realloc(nPos+1);
- aArgs[nPos].Name = "Password";
- aArgs[nPos].Value <<= m_sPassword;
+ pArgs[2].Name = "Password";
+ pArgs[2].Value <<= m_sPassword;
}
Reference< XDesktop2 > xDesktop = Desktop::create( getDriver()->getComponentContext() );
@@ -124,7 +120,7 @@ Reference< XSpreadsheetDocument> const & OCalcConnection::acquireDoc()
try
{
xComponent = xDesktop->loadComponentFromURL(
- m_aFileName, "_blank", 0, aArgs );
+ m_aFileName, u"_blank"_ustr, 0, aArgs );
}
catch( const Exception& )
{
@@ -143,12 +139,11 @@ Reference< XSpreadsheetDocument> const & OCalcConnection::acquireDoc()
Exception aLoaderError;
OSL_VERIFY( aLoaderException >>= aLoaderError );
- SQLException aDetailException;
- aDetailException.Message = m_aResources.getResourceStringWithSubstitution(
- STR_LOAD_FILE_ERROR_MESSAGE,
- "$exception_type$", aLoaderException.getValueTypeName(),
- "$error_message$", aLoaderError.Message
- );
+ SQLException aDetailException(m_aResources.getResourceStringWithSubstitution(
+ STR_LOAD_FILE_ERROR_MESSAGE, "$exception_type$",
+ aLoaderException.getValueTypeName(),
+ "$error_message$", aLoaderError.Message),
+ {}, {}, 0, {});
aErrorDetails <<= aDetailException;
}
@@ -195,7 +190,7 @@ void OCalcConnection::disposing()
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(OCalcConnection, "com.sun.star.sdbc.drivers.calc.Connection", "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(OCalcConnection, u"com.sun.star.sdbc.drivers.calc.Connection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
Reference< XDatabaseMetaData > SAL_CALL OCalcConnection::getMetaData( )
@@ -218,12 +213,11 @@ Reference< XDatabaseMetaData > SAL_CALL OCalcConnection::getMetaData( )
css::uno::Reference< XTablesSupplier > OCalcConnection::createCatalog()
{
::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
+ rtl::Reference< connectivity::sdbcx::OCatalog > xTab = m_xCatalog;
if(!xTab.is())
{
- OCalcCatalog *pCat = new OCalcCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
+ xTab = new OCalcCatalog(this);
+ m_xCatalog = xTab.get();
}
return xTab;
}
@@ -247,8 +241,7 @@ Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareStatement( cons
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- auto pStmt = new connectivity::component::OComponentPreparedStatement(this);
- Reference< XPreparedStatement > xHoldAlive = pStmt;
+ rtl::Reference<connectivity::component::OComponentPreparedStatement> pStmt = new connectivity::component::OComponentPreparedStatement(this);
pStmt->construct(sql);
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
return pStmt;
@@ -260,9 +253,7 @@ Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareCall( const OUS
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::prepareCall"_ustr, *this );
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
index cea1b32c7a94..4c642e66f2e7 100644
--- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
@@ -34,7 +34,6 @@ using namespace connectivity::file;
using namespace connectivity::component;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::table;
@@ -59,37 +58,37 @@ static bool lcl_IsEmptyOrHidden( const Reference<XSpreadsheets>& xSheets, const
{
Any aAny = xSheets->getByName( rName );
Reference<XSpreadsheet> xSheet;
- if ( aAny >>= xSheet )
+ if ( !(aAny >>= xSheet) )
+ return false;
+
+ // test if sheet is hidden
+
+ Reference<XPropertySet> xProp( xSheet, UNO_QUERY );
+ if (xProp.is())
{
- // test if sheet is hidden
+ bool bVisible;
+ Any aVisAny = xProp->getPropertyValue(u"IsVisible"_ustr);
+ if ( (aVisAny >>= bVisible) && !bVisible)
+ return true; // hidden
+ }
- Reference<XPropertySet> xProp( xSheet, UNO_QUERY );
- if (xProp.is())
- {
- bool bVisible;
- Any aVisAny = xProp->getPropertyValue("IsVisible");
- if ( (aVisAny >>= bVisible) && !bVisible)
- return true; // hidden
- }
+ // use the same data area as in OCalcTable to test for empty table
- // use the same data area as in OCalcTable to test for empty table
+ Reference<XSheetCellCursor> xCursor = xSheet->createCursor();
+ Reference<XCellRangeAddressable> xRange( xCursor, UNO_QUERY );
+ if ( xRange.is() )
+ {
+ xCursor->collapseToSize( 1, 1 ); // single (first) cell
+ xCursor->collapseToCurrentRegion(); // contiguous data area
- Reference<XSheetCellCursor> xCursor = xSheet->createCursor();
- Reference<XCellRangeAddressable> xRange( xCursor, UNO_QUERY );
- if ( xRange.is() )
+ CellRangeAddress aRangeAddr = xRange->getRangeAddress();
+ if ( aRangeAddr.StartColumn == aRangeAddr.EndColumn &&
+ aRangeAddr.StartRow == aRangeAddr.EndRow )
{
- xCursor->collapseToSize( 1, 1 ); // single (first) cell
- xCursor->collapseToCurrentRegion(); // contiguous data area
-
- CellRangeAddress aRangeAddr = xRange->getRangeAddress();
- if ( aRangeAddr.StartColumn == aRangeAddr.EndColumn &&
- aRangeAddr.StartRow == aRangeAddr.EndRow )
- {
- // single cell -> check content
- Reference<XCell> xCell = xCursor->getCellByPosition( 0, 0 );
- if ( xCell.is() && xCell->getType() == CellContentType_EMPTY )
- return true;
- }
+ // single cell -> check content
+ Reference<XCell> xCell = xCursor->getCellByPosition( 0, 0 );
+ if ( xCell.is() && xCell->getType() == CellContentType_EMPTY )
+ return true;
}
}
@@ -109,7 +108,7 @@ static bool lcl_IsUnnamed( const Reference<XDatabaseRanges>& xRanges, const OUSt
{
try
{
- Any aUserAny = xRangeProp->getPropertyValue("IsUserDefined");
+ Any aUserAny = xRangeProp->getPropertyValue(u"IsUserDefined"_ustr);
bool bUserDefined;
if ( aUserAny >>= bUserDefined )
bUnnamed = !bUserDefined;
@@ -130,33 +129,28 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
// check if ORowSetValue type is given
// when no types are given then we have to return all tables e.g. TABLE
- OUString aTable("TABLE");
+ static constexpr OUString aTable(u"TABLE"_ustr);
- bool bTableFound = true;
- sal_Int32 nLength = types.getLength();
- if(nLength)
+ if (types.hasElements())
{
- bTableFound = false;
+ bool bTableFound = false;
- const OUString* pIter = types.getConstArray();
- const OUString* pEnd = pIter + nLength;
- for(;pIter != pEnd;++pIter)
+ for (auto& type : types)
{
- if(*pIter == aTable)
+ if (type == aTable)
{
bTableFound = true;
break;
}
}
+ if (!bTableFound)
+ return pResult;
}
- if(!bTableFound)
- return xRef;
// get the sheet names from the document
@@ -173,15 +167,14 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables(
sal_Int32 nSheetCount = aSheetNames.getLength();
for (sal_Int32 nSheet=0; nSheet<nSheetCount; nSheet++)
{
- OUString aName = aSheetNames[nSheet];
+ const OUString& aName = aSheetNames[nSheet];
if ( !lcl_IsEmptyOrHidden( xSheets, aName ) && match(tableNamePattern,aName,'\0') )
{
- ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr };
- aRow.reserve(6);
- aRow.push_back(new ORowSetValueDecorator(aName));
- aRow.push_back(new ORowSetValueDecorator(aTable));
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRows.push_back(aRow);
+ aRows.push_back( { nullptr, nullptr, nullptr,
+ new ORowSetValueDecorator(aName),
+ new ORowSetValueDecorator(aTable),
+ ODatabaseMetaDataResultSet::getEmptyValue()
+ } );
}
}
@@ -190,7 +183,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables(
Reference<XPropertySet> xDocProp( xDoc, UNO_QUERY );
if ( xDocProp.is() )
{
- Any aRangesAny = xDocProp->getPropertyValue("DatabaseRanges");
+ Any aRangesAny = xDocProp->getPropertyValue(u"DatabaseRanges"_ustr);
Reference<XDatabaseRanges> xRanges;
if ( aRangesAny >>= xRanges )
{
@@ -198,23 +191,22 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables(
sal_Int32 nDBCount = aDBNames.getLength();
for (sal_Int32 nRange=0; nRange<nDBCount; nRange++)
{
- OUString aName = aDBNames[nRange];
+ const OUString& aName = aDBNames[nRange];
if ( !lcl_IsUnnamed( xRanges, aName ) && match(tableNamePattern,aName,'\0') )
{
- ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr };
- aRow.reserve(6);
- aRow.push_back(new ORowSetValueDecorator(aName));
- aRow.push_back(new ORowSetValueDecorator(aTable));
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRows.push_back(aRow);
+ aRows.push_back( { nullptr, nullptr, nullptr,
+ new ORowSetValueDecorator(aName),
+ new ORowSetValueDecorator(aTable),
+ ODatabaseMetaDataResultSet::getEmptyValue()
+ } );
}
}
}
}
- pResult->setRows(aRows);
+ pResult->setRows(std::move(aRows));
- return xRef;
+ return pResult;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx
index 324094ac04df..528df911c219 100644
--- a/connectivity/source/drivers/calc/CDriver.cxx
+++ b/connectivity/source/drivers/calc/CDriver.cxx
@@ -37,7 +37,7 @@ using namespace ::com::sun::star::lang;
OUString SAL_CALL ODriver::getImplementationName( )
{
- return "com.sun.star.comp.sdbc.calc.ODriver";
+ return u"com.sun.star.comp.sdbc.calc.ODriver"_ustr;
}
// service names from file::OFileDriver
@@ -53,7 +53,7 @@ connectivity_calc_ODriver(
}
if (ret)
ret->acquire();
- return static_cast<cppu::OWeakObject*>(ret.get());
+ return getXWeak(ret.get());
}
@@ -68,12 +68,11 @@ Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url,
if ( ! acceptsURL(url) )
return nullptr;
- OCalcConnection* pCon = new OCalcConnection(this);
+ rtl::Reference<OCalcConnection> pCon = new OCalcConnection(this);
pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon.get());
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 56214c9f3881..da7e74542af3 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -41,7 +41,6 @@
#include <rtl/math.hxx>
#include <tools/time.hxx>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
using namespace connectivity;
using namespace connectivity::calc;
@@ -50,10 +49,8 @@ using namespace ::cppu;
using namespace ::dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sheet;
using namespace ::com::sun::star::table;
using namespace ::com::sun::star::text;
@@ -72,14 +69,11 @@ static void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32&
CellFlags::STRING | CellFlags::VALUE | CellFlags::DATETIME | CellFlags::FORMULA | CellFlags::ANNOTATION;
const Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags );
- const Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses();
- const sal_Int32 nCount = aAddresses.getLength();
- const CellRangeAddress* pData = aAddresses.getConstArray();
- for ( sal_Int32 i=0; i<nCount; i++ )
+ for (auto& address : xUsedRanges->getRangeAddresses())
{
- rEndCol = std::max(pData[i].EndColumn, rEndCol);
- rEndRow = std::max(pData[i].EndRow, rEndRow);
+ rEndCol = std::max(address.EndColumn, rEndCol);
+ rEndRow = std::max(address.EndRow, rEndRow);
}
}
@@ -140,7 +134,7 @@ static CellContentType lcl_GetContentOrResultType( const Reference<XCell>& xCell
Reference<XPropertySet> xProp( xCell, UNO_QUERY );
try
{
- xProp->getPropertyValue( "CellContentType" ) >>= eCellType; // type of cell content
+ xProp->getPropertyValue( u"CellContentType"_ustr ) >>= eCellType; // type of cell content
}
catch (UnknownPropertyException&)
{
@@ -192,24 +186,23 @@ static bool lcl_HasTextInColumn( const Reference<XSpreadsheet>& xSheet, sal_Int3
// look for any text cell or text result in the column
Reference<XCellRangeAddressable> xAddr( xSheet, UNO_QUERY );
- if (xAddr.is())
- {
- CellRangeAddress aTotalRange = xAddr->getRangeAddress();
- sal_Int32 nLastRow = aTotalRange.EndRow;
- Reference<XCellRangesQuery> xQuery( xSheet->getCellRangeByPosition( nDocColumn, nDocRow, nDocColumn, nLastRow ), UNO_QUERY );
- if (xQuery.is())
- {
- // are there text cells in the column?
- Reference<XSheetCellRanges> xTextContent = xQuery->queryContentCells( CellFlags::STRING );
- if ( xTextContent.is() && xTextContent->hasElements() )
- return true;
-
- // are there formulas with text results in the column?
- Reference<XSheetCellRanges> xTextFormula = xQuery->queryFormulaCells( FormulaResult::STRING );
- if ( xTextFormula.is() && xTextFormula->hasElements() )
- return true;
- }
- }
+ if (!xAddr)
+ return false;
+ CellRangeAddress aTotalRange = xAddr->getRangeAddress();
+ sal_Int32 nLastRow = aTotalRange.EndRow;
+ Reference<XCellRangesQuery> xQuery( xSheet->getCellRangeByPosition( nDocColumn, nDocRow, nDocColumn, nLastRow ), UNO_QUERY );
+ if (!xQuery)
+ return false;
+
+ // are there text cells in the column?
+ Reference<XSheetCellRanges> xTextContent = xQuery->queryContentCells( CellFlags::STRING );
+ if ( xTextContent.is() && xTextContent->hasElements() )
+ return true;
+
+ // are there formulas with text results in the column?
+ Reference<XSheetCellRanges> xTextFormula = xQuery->queryFormulaCells( FormulaResult::STRING );
+ if ( xTextFormula.is() && xTextFormula->hasElements() )
+ return true;
return false;
}
@@ -255,7 +248,7 @@ static void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Refe
{
sal_Int32 nKey = 0;
- if ( xProp->getPropertyValue( "NumberFormat" ) >>= nKey )
+ if ( xProp->getPropertyValue( u"NumberFormat"_ustr ) >>= nKey )
{
const Reference<XPropertySet> xFormat = xFormats->getByKey( nKey );
if ( xFormat.is() )
@@ -486,13 +479,12 @@ void OCalcTable::fillColumns()
aFind = connectivity::find(m_aColumns->begin(),m_aColumns->end(),aAlias,aCase);
}
- sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, OUString(),OUString(),
+ rtl::Reference<sdbcx::OColumn> pColumn = new sdbcx::OColumn( aAlias, aTypeName, OUString(),OUString(),
ColumnValue::NULLABLE, nPrecision, nDecimals,
eType, false, false, bCurrency,
bStoresMixedCaseQuotedIdentifiers,
m_CatalogName, getSchema(), getName());
- Reference< XPropertySet> xCol = pColumn;
- m_aColumns->push_back(xCol);
+ m_aColumns->push_back(pColumn);
m_aTypes.push_back(eType);
}
}
@@ -540,7 +532,7 @@ void OCalcTable::construct()
Reference<XPropertySet> xDocProp( xDoc, UNO_QUERY );
if ( xDocProp.is() )
{
- Reference<XDatabaseRanges> xRanges(xDocProp->getPropertyValue("DatabaseRanges"),UNO_QUERY);
+ Reference<XDatabaseRanges> xRanges(xDocProp->getPropertyValue(u"DatabaseRanges"_ustr),UNO_QUERY);
if ( xRanges.is() && xRanges->hasByName( m_Name ) )
{
@@ -554,7 +546,7 @@ void OCalcTable::construct()
bool bRangeHeader = true;
Reference<XPropertySet> xFiltProp( xDBRange->getFilterDescriptor(), UNO_QUERY );
if ( xFiltProp.is() )
- xFiltProp->getPropertyValue("ContainsHeader") >>= bRangeHeader;
+ xFiltProp->getPropertyValue(u"ContainsHeader"_ustr) >>= bRangeHeader;
Reference<XSheetCellRange> xSheetRange( xRefer->getReferredCells(), UNO_QUERY );
Reference<XCellRangeAddressable> xAddr( xSheetRange, UNO_QUERY );
@@ -588,7 +580,7 @@ void OCalcTable::construct()
if (xProp.is())
{
css::util::Date aDateStruct;
- if ( xProp->getPropertyValue("NullDate") >>= aDateStruct )
+ if ( xProp->getPropertyValue(u"NullDate"_ustr) >>= aDateStruct )
m_aNullDate = ::Date( aDateStruct.Day, aDateStruct.Month, aDateStruct.Year );
}
}
@@ -611,22 +603,6 @@ void SAL_CALL OCalcTable::disposing()
}
-Sequence< sal_Int8 > OCalcTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return (isUnoTunnelId<OCalcTable>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : OCalcTable_BASE::getSomething(rId);
-}
-
bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols,
bool bRetrieveData )
{
diff --git a/connectivity/source/drivers/calc/CTables.cxx b/connectivity/source/drivers/calc/CTables.cxx
index 703ab27120c5..87fb959fbda6 100644
--- a/connectivity/source/drivers/calc/CTables.cxx
+++ b/connectivity/source/drivers/calc/CTables.cxx
@@ -25,24 +25,18 @@
#include <file/FCatalog.hxx>
#include <file/FConnection.hxx>
-using namespace ::comphelper;
using namespace connectivity;
using namespace connectivity::calc;
using namespace connectivity::file;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
-sdbcx::ObjectType OCalcTables::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OCalcTables::createObject(const OUString& _rName)
{
- OCalcTable* pTable = new OCalcTable(this, static_cast<OCalcConnection*>(static_cast<OFileCatalog&>(m_rParent).getConnection()),
- _rName,"TABLE");
- sdbcx::ObjectType xRet = pTable;
+ rtl::Reference<OCalcTable> pTable = new OCalcTable(this, static_cast<OCalcConnection*>(static_cast<OFileCatalog&>(m_rParent).getConnection()),
+ _rName,u"TABLE"_ustr);
pTable->construct();
- return xRet;
+ return pTable;
}
diff --git a/connectivity/source/drivers/component/CColumns.cxx b/connectivity/source/drivers/component/CColumns.cxx
index 9f802b6e4c57..9fc7f22882fe 100644
--- a/connectivity/source/drivers/component/CColumns.cxx
+++ b/connectivity/source/drivers/component/CColumns.cxx
@@ -23,20 +23,16 @@
using namespace connectivity::component;
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-sdbcx::ObjectType OComponentColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OComponentColumns::createObject(const OUString& _rName)
{
::rtl::Reference<OSQLColumns> aCols = m_pTable->getTableColumns();
OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
- sdbcx::ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
if(aIter != aCols->end())
- xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
+ xRet = *aIter;
return xRet;
}
diff --git a/connectivity/source/drivers/component/CDatabaseMetaData.cxx b/connectivity/source/drivers/component/CDatabaseMetaData.cxx
index f225747a6486..45a932657f67 100644
--- a/connectivity/source/drivers/component/CDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/component/CDatabaseMetaData.cxx
@@ -46,80 +46,72 @@ OComponentDatabaseMetaData::~OComponentDatabaseMetaData()
Reference< XResultSet > OComponentDatabaseMetaData::impl_getTypeInfo_throw( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
+ ODatabaseMetaDataResultSet::ORows aRows;
+ aRows.reserve(6);
+ ODatabaseMetaDataResultSet::ORow aRow
{
- ODatabaseMetaDataResultSet::ORow aRow;
-
- aRows.reserve(6);
- aRow.reserve(18);
-
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(OUString("VARCHAR")));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(65535)));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); // ORowSetValue((sal_Int32)ColumnValue::NULLABLE)
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(ColumnSearch::CHAR)));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(10)));
-
-
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
- aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
- aRow[3] = ODatabaseMetaDataResultSet::get0Value();
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("BOOL"));
- aRow[2] = new ORowSetValueDecorator(DataType::BIT);
- aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[15] = new ORowSetValueDecorator(sal_Int32(15));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
- aRow[2] = new ORowSetValueDecorator(DataType::DATE);
- aRow[3] = ODatabaseMetaDataResultSet::get0Value();
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
- aRow[2] = new ORowSetValueDecorator(DataType::TIME);
- aRow[3] = ODatabaseMetaDataResultSet::get0Value();
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
- aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[3] = ODatabaseMetaDataResultSet::get0Value();
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRows.push_back(aRow);
- }
-
- pResult->setRows(aRows);
- return xRef;
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ new ORowSetValueDecorator(u"VARCHAR"_ustr),
+ new ORowSetValueDecorator(DataType::VARCHAR),
+ new ORowSetValueDecorator(sal_Int32(65535)),
+ ODatabaseMetaDataResultSet::getQuoteValue(),
+ ODatabaseMetaDataResultSet::getQuoteValue(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ ODatabaseMetaDataResultSet::get1Value(), // ORowSetValue((sal_Int32)ColumnValue::NULLABLE
+ ODatabaseMetaDataResultSet::get1Value(),
+ new ORowSetValueDecorator(sal_Int32(ColumnSearch::CHAR)),
+ ODatabaseMetaDataResultSet::get1Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ new ORowSetValueDecorator(sal_Int32(10))
+ };
+
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"DECIMAL"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"BOOL"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::BIT);
+ aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = new ORowSetValueDecorator(sal_Int32(15));
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"DATE"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::DATE);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"TIME"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::TIME);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"TIMESTAMP"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns(
@@ -179,7 +171,7 @@ Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns(
aRow[13] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
// aRow[14] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
// aRow[15] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
- switch(sal_Int32(aRow[5]->getValue()))
+ switch(aRow[5]->getValue().getInt32())
{
case DataType::CHAR:
case DataType::VARCHAR:
@@ -192,13 +184,13 @@ Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns(
aRow[16] = new ORowSetValueDecorator(sal_Int32(0));
}
aRow[17] = new ORowSetValueDecorator(i);
- switch(sal_Int32(aRow[11]->getValue()))
+ switch(aRow[11]->getValue().getInt32())
{
case ColumnValue::NO_NULLS:
- aRow[18] = new ORowSetValueDecorator(OUString("NO"));
+ aRow[18] = new ORowSetValueDecorator(u"NO"_ustr);
break;
case ColumnValue::NULLABLE:
- aRow[18] = new ORowSetValueDecorator(OUString("YES"));
+ aRow[18] = new ORowSetValueDecorator(u"YES"_ustr);
break;
default:
aRow[18] = new ORowSetValueDecorator(OUString());
@@ -209,11 +201,10 @@ Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns(
}
}
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
+ pResult->setRows(std::move(aRows));
- return xRef;
+ return pResult;
}
sal_Int32 SAL_CALL OComponentDatabaseMetaData::getMaxBinaryLiteralLength( )
diff --git a/connectivity/source/drivers/component/CPreparedStatement.cxx b/connectivity/source/drivers/component/CPreparedStatement.cxx
index bc3af3e8c9b8..dc7dd01304b9 100644
--- a/connectivity/source/drivers/component/CPreparedStatement.cxx
+++ b/connectivity/source/drivers/component/CPreparedStatement.cxx
@@ -22,13 +22,12 @@
using namespace connectivity::component;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
-OResultSet* OComponentPreparedStatement::createResultSet()
+rtl::Reference<OResultSet> OComponentPreparedStatement::createResultSet()
{
return new connectivity::component::OComponentResultSet(this,m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OComponentPreparedStatement,"com.sun.star.sdbc.driver.component.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(OComponentPreparedStatement,u"com.sun.star.sdbc.driver.component.PreparedStatement"_ustr,u"com.sun.star.sdbc.PreparedStatement"_ustr);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/component/CResultSet.cxx b/connectivity/source/drivers/component/CResultSet.cxx
index 050b4034da45..8a170bab20d4 100644
--- a/connectivity/source/drivers/component/CResultSet.cxx
+++ b/connectivity/source/drivers/component/CResultSet.cxx
@@ -45,12 +45,12 @@ OComponentResultSet::OComponentResultSet( OStatement_Base* pStmt,connectivity::O
OUString SAL_CALL OComponentResultSet::getImplementationName( )
{
- return "com.sun.star.sdbcx.component.ResultSet";
+ return u"com.sun.star.sdbcx.component.ResultSet"_ustr;
}
Sequence< OUString > SAL_CALL OComponentResultSet::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
+ return { u"com.sun.star.sdbc.ResultSet"_ustr, u"com.sun.star.sdbcx.ResultSet"_ustr };
}
sal_Bool SAL_CALL OComponentResultSet::supportsService( const OUString& _rServiceName )
@@ -77,7 +77,7 @@ Any SAL_CALL OComponentResultSet::getBookmark( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return makeAny(static_cast<sal_Int32>((*m_aRow)[0]->getValue()));
+ return Any((*m_aRow)[0]->getValue().getInt32());
}
sal_Bool SAL_CALL OComponentResultSet::moveToBookmark( const Any& bookmark )
@@ -130,8 +130,7 @@ Sequence< sal_Int32 > SAL_CALL OComponentResultSet::deleteRows( const Sequence<
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XDeleteRows::deleteRows", *this );
- return Sequence< sal_Int32 >();
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XDeleteRows::deleteRows"_ustr, *this );
}
bool OComponentResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
@@ -153,12 +152,12 @@ bool OComponentResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*
}
-void SAL_CALL OComponentResultSet::acquire() throw()
+void SAL_CALL OComponentResultSet::acquire() noexcept
{
OComponentResultSet_BASE2::acquire();
}
-void SAL_CALL OComponentResultSet::release() throw()
+void SAL_CALL OComponentResultSet::release() noexcept
{
OComponentResultSet_BASE2::release();
}
diff --git a/connectivity/source/drivers/component/CStatement.cxx b/connectivity/source/drivers/component/CStatement.cxx
index 8a1a2fa92287..61903e01ad08 100644
--- a/connectivity/source/drivers/component/CStatement.cxx
+++ b/connectivity/source/drivers/component/CStatement.cxx
@@ -22,14 +22,13 @@
using namespace connectivity::component;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
-OResultSet* OComponentStatement::createResultSet()
+rtl::Reference<OResultSet> OComponentStatement::createResultSet()
{
return new connectivity::component::OComponentResultSet(this, m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OComponentStatement, "com.sun.star.sdbc.driver.component.Statement",
- "com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(OComponentStatement, u"com.sun.star.sdbc.driver.component.Statement"_ustr,
+ u"com.sun.star.sdbc.Statement"_ustr);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/component/CTable.cxx b/connectivity/source/drivers/component/CTable.cxx
index 9b5354d266d1..6fe82dc830bb 100644
--- a/connectivity/source/drivers/component/CTable.cxx
+++ b/connectivity/source/drivers/component/CTable.cxx
@@ -25,15 +25,12 @@ using namespace connectivity;
using namespace connectivity::component;
using namespace connectivity::file;
using namespace ::cppu;
-using namespace ::dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sheet;
-using namespace ::com::sun::star::util;
OComponentTable::OComponentTable(sdbcx::OCollection* _pTables,file::OConnection* _pConnection,
@@ -63,7 +60,7 @@ void OComponentTable::refreshColumns()
if(m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = new component::OComponentColumns(this,m_aMutex,aVector);
+ m_xColumns.reset(new component::OComponentColumns(this,m_aMutex,aVector));
}
void OComponentTable::refreshIndexes()
@@ -104,8 +101,7 @@ Any SAL_CALL OComponentTable::queryInterface( const Type & rType )
rType == cppu::UnoType<XDataDescriptorFactory>::get())
return Any();
- const Any aRet = ::cppu::queryInterface(rType,static_cast< css::lang::XUnoTunnel*> (this));
- return aRet.hasValue() ? aRet : OTable_TYPEDEF::queryInterface(rType);
+ return OTable_TYPEDEF::queryInterface(rType);
}
diff --git a/connectivity/source/drivers/dbase/DCatalog.cxx b/connectivity/source/drivers/dbase/DCatalog.cxx
index a8aaf89c529a..6af3440b6071 100644
--- a/connectivity/source/drivers/dbase/DCatalog.cxx
+++ b/connectivity/source/drivers/dbase/DCatalog.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
@@ -40,7 +39,7 @@ void ODbaseCatalog::refreshTables()
{
::std::vector<OUString> aVector;
Sequence<OUString> aTypes;
- Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), "%", "%", aTypes);
+ Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), u"%"_ustr, u"%"_ustr, aTypes);
if (xResult.is())
{
diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx
index b997ec8d9087..4025fcc5a800 100644
--- a/connectivity/source/drivers/dbase/DColumns.cxx
+++ b/connectivity/source/drivers/dbase/DColumns.cxx
@@ -25,21 +25,17 @@ using namespace connectivity::dbase;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-sdbcx::ObjectType ODbaseColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > ODbaseColumns::createObject(const OUString& _rName)
{
ODbaseTable* pTable = static_cast<ODbaseTable*>(m_pTable);
const ::rtl::Reference<OSQLColumns>& aCols = pTable->getTableColumns();
OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
- sdbcx::ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
if(aIter != aCols->end())
- xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
+ xRet = *aIter;
return xRet;
}
@@ -56,7 +52,7 @@ Reference< XPropertySet > ODbaseColumns::createDescriptor()
// XAppend
-sdbcx::ObjectType ODbaseColumns::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > ODbaseColumns::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
if ( m_pTable->isNew() )
return cloneDescriptor( descriptor );
diff --git a/connectivity/source/drivers/dbase/DConnection.cxx b/connectivity/source/drivers/dbase/DConnection.cxx
index 7c577b7c9541..ab97a3aeeaa0 100644
--- a/connectivity/source/drivers/dbase/DConnection.cxx
+++ b/connectivity/source/drivers/dbase/DConnection.cxx
@@ -33,10 +33,8 @@ typedef connectivity::file::OConnection OConnection_BASE;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver)
{
@@ -49,7 +47,7 @@ ODbaseConnection::~ODbaseConnection()
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(ODbaseConnection, "com.sun.star.sdbc.drivers.dbase.Connection", "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(ODbaseConnection, u"com.sun.star.sdbc.drivers.dbase.Connection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData( )
@@ -71,12 +69,11 @@ Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData( )
css::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog()
{
::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
+ rtl::Reference< connectivity::sdbcx::OCatalog > xTab = m_xCatalog;
if(!xTab.is())
{
- ODbaseCatalog *pCat = new ODbaseCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
+ xTab = new ODbaseCatalog(this);
+ m_xCatalog = xTab.get();
}
return xTab;
}
@@ -97,9 +94,7 @@ Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( con
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- ODbasePreparedStatement* pStmt = new ODbasePreparedStatement(this);
- Reference< XPreparedStatement > xHoldAlive = pStmt;
+ rtl::Reference<ODbasePreparedStatement> pStmt = new ODbasePreparedStatement(this);
pStmt->construct(sql);
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
return pStmt;
@@ -107,9 +102,7 @@ Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( con
Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareCall( const OUString& /*sql*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::prepareCall"_ustr, *this );
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
index b896e942cb01..7e17e1fc0d79 100644
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
@@ -54,101 +54,96 @@ ODbaseDatabaseMetaData::~ODbaseDatabaseMetaData()
Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
+ ODatabaseMetaDataResultSet::ORows aRows;
+ aRows.reserve(10);
+ ODatabaseMetaDataResultSet::ORow aRow
{
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.reserve(19);
-
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(OUString("VARCHAR")));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(254)));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(new ORowSetValueDecorator(OUString("length")));
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(new ORowSetValueDecorator(OUString("C")));
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(10)));
-
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("LONGVARCHAR"));
- aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
- aRow[3] = new ORowSetValueDecorator(sal_Int32(2147483647));
- aRow[6] = new ORowSetValueDecorator();
- aRow[13] = new ORowSetValueDecorator(OUString("M"));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
- aRow[2] = new ORowSetValueDecorator(DataType::DATE);
- aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
- aRow[13] = new ORowSetValueDecorator(OUString("D"));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("BOOLEAN"));
- aRow[2] = new ORowSetValueDecorator(DataType::BIT);
- aRow[3] = ODatabaseMetaDataResultSet::get1Value();
- aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[6] = new ORowSetValueDecorator(OUString());
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[13] = new ORowSetValueDecorator(OUString("L"));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("DOUBLE"));
- aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
- aRow[3] = new ORowSetValueDecorator(sal_Int32(8));
- aRow[13] = new ORowSetValueDecorator(OUString("B"));
- aRows.push_back(aRow);
-
- aRow[11] = new ORowSetValueDecorator(true);
- aRow[13] = new ORowSetValueDecorator(OUString("Y"));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
- aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[11] = new ORowSetValueDecorator(false);
- aRow[13] = new ORowSetValueDecorator(OUString("T"));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("INTEGER"));
- aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
- aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
- aRow[13] = new ORowSetValueDecorator(OUString("I"));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
- aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
- aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
- aRow[6] = new ORowSetValueDecorator(OUString("length,scale"));
- aRow[13] = new ORowSetValueDecorator(OUString("F"));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(OUString("NUMERIC"));
- aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
- aRow[3] = new ORowSetValueDecorator(sal_Int32(16));
- aRow[13] = new ORowSetValueDecorator(OUString("N"));
- aRow[15] = new ORowSetValueDecorator(sal_Int32(16));
- aRows.push_back(aRow);
- }
-
- pResult->setRows(aRows);
- return xRef;
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ new ORowSetValueDecorator(u"VARCHAR"_ustr),
+ new ORowSetValueDecorator(DataType::VARCHAR),
+ new ORowSetValueDecorator(sal_Int32(254)),
+ ODatabaseMetaDataResultSet::getQuoteValue(),
+ ODatabaseMetaDataResultSet::getQuoteValue(),
+ new ORowSetValueDecorator(u"length"_ustr),
+ new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)),
+ ODatabaseMetaDataResultSet::get1Value(),
+ new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)),
+ ODatabaseMetaDataResultSet::get1Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ new ORowSetValueDecorator(u"C"_ustr),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ new ORowSetValueDecorator(sal_Int32(10))
+ };
+
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"LONGVARCHAR"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
+ aRow[3] = new ORowSetValueDecorator(sal_Int32(2147483647));
+ aRow[6] = new ORowSetValueDecorator();
+ aRow[13] = new ORowSetValueDecorator(u"M"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"DATE"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::DATE);
+ aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
+ aRow[13] = new ORowSetValueDecorator(u"D"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"BOOLEAN"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::BIT);
+ aRow[3] = ODatabaseMetaDataResultSet::get1Value();
+ aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue();
+ aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
+ aRow[6] = new ORowSetValueDecorator(OUString());
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[13] = new ORowSetValueDecorator(u"L"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"DOUBLE"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
+ aRow[3] = new ORowSetValueDecorator(sal_Int32(8));
+ aRow[13] = new ORowSetValueDecorator(u"B"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[11] = new ORowSetValueDecorator(ORowSetValue(true));
+ aRow[13] = new ORowSetValueDecorator(u"Y"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"TIMESTAMP"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
+ aRow[11] = new ORowSetValueDecorator(ORowSetValue(false));
+ aRow[13] = new ORowSetValueDecorator(u"T"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"INTEGER"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
+ aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
+ aRow[13] = new ORowSetValueDecorator(u"I"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"DECIMAL"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
+ aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
+ aRow[6] = new ORowSetValueDecorator(u"length,scale"_ustr);
+ aRow[13] = new ORowSetValueDecorator(u"F"_ustr);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(u"NUMERIC"_ustr);
+ aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
+ aRow[3] = new ORowSetValueDecorator(sal_Int32(16));
+ aRow[13] = new ORowSetValueDecorator(u"N"_ustr);
+ aRow[15] = new ORowSetValueDecorator(sal_Int32(16));
+ aRows.push_back(aRow);
+
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
@@ -171,35 +166,28 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
try
{
aRow[10] = new ORowSetValueDecorator(sal_Int32(10));
- Sequence< OUString> aTabNames(xNames->getElementNames());
- const OUString* pTabBegin = aTabNames.getConstArray();
- const OUString* pTabEnd = pTabBegin + aTabNames.getLength();
- for(;pTabBegin != pTabEnd;++pTabBegin)
+ for (auto& tabName : xNames->getElementNames())
{
- if(match(tableNamePattern,*pTabBegin,'\0'))
+ if (match(tableNamePattern, tabName, '\0'))
{
- Reference< XColumnsSupplier> xTable(
- xNames->getByName(*pTabBegin), css::uno::UNO_QUERY);
+ Reference<XColumnsSupplier> xTable(xNames->getByName(tabName), css::uno::UNO_QUERY);
OSL_ENSURE(xTable.is(),"Table not found! Normally an exception had to be thrown here!");
- aRow[3] = new ORowSetValueDecorator(*pTabBegin);
+ aRow[3] = new ORowSetValueDecorator(tabName);
Reference< XNameAccess> xColumns = xTable->getColumns();
if(!xColumns.is())
throw SQLException();
- Sequence< OUString> aColNames(xColumns->getElementNames());
-
- const OUString* pBegin = aColNames.getConstArray();
- const OUString* pEnd = pBegin + aColNames.getLength();
Reference< XPropertySet> xColumn;
- for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i)
+ sal_Int32 i = 0;
+ for (auto& colName : xColumns->getElementNames())
{
- if(match(columnNamePattern,*pBegin,'\0'))
+ ++i;
+ if (match(columnNamePattern, colName, '\0'))
{
- aRow[4] = new ORowSetValueDecorator(*pBegin);
+ aRow[4] = new ORowSetValueDecorator(colName);
- xColumn.set(
- xColumns->getByName(*pBegin), css::uno::UNO_QUERY);
+ xColumn.set(xColumns->getByName(colName), css::uno::UNO_QUERY);
OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!");
aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))));
@@ -207,7 +195,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
- switch(static_cast<sal_Int32>(aRow[5]->getValue()))
+ switch(aRow[5]->getValue().getInt32())
{
case DataType::CHAR:
case DataType::VARCHAR:
@@ -220,13 +208,13 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
aRow[16] = new ORowSetValueDecorator(sal_Int32(0));
}
aRow[17] = new ORowSetValueDecorator(i);
- switch(sal_Int32(aRow[11]->getValue()))
+ switch(aRow[11]->getValue().getInt32())
{
case ColumnValue::NO_NULLS:
- aRow[18] = new ORowSetValueDecorator(OUString("NO"));
+ aRow[18] = new ORowSetValueDecorator(u"NO"_ustr);
break;
case ColumnValue::NULLABLE:
- aRow[18] = new ORowSetValueDecorator(OUString("YES"));
+ aRow[18] = new ORowSetValueDecorator(u"YES"_ustr);
break;
default:
aRow[18] = new ORowSetValueDecorator(OUString());
@@ -244,11 +232,10 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
throw aSql;
throw WrappedTargetRuntimeException(e.Message, e.Context, e.TargetException);
}
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
+ pResult->setRows(std::move(aRows));
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
@@ -269,7 +256,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
ODatabaseMetaDataResultSet::ORow aRow(14);
aRow[5] = new ORowSetValueDecorator(OUString());
- aRow[10] = new ORowSetValueDecorator(OUString("A"));
+ aRow[10] = new ORowSetValueDecorator(u"A"_ustr);
Reference< XIndexesSupplier> xTable(
xNames->getByName(table), css::uno::UNO_QUERY);
@@ -280,22 +267,18 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
if(!xIndexes.is())
throw SQLException();
- Sequence< OUString> aIdxNames(xIndexes->getElementNames());
-
- const OUString* pBegin = aIdxNames.getConstArray();
- const OUString* pEnd = pBegin + aIdxNames.getLength();
Reference< XPropertySet> xIndex;
- for(;pBegin != pEnd;++pBegin)
+ for (auto& idxName : xIndexes->getElementNames())
{
- xIndex.set(xIndexes->getByName(*pBegin), css::uno::UNO_QUERY);
+ xIndex.set(xIndexes->getByName(idxName), css::uno::UNO_QUERY);
OSL_ENSURE(xIndex.is(),"Indexes contains a column who isn't a fastpropertyset!");
if(unique && !getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))))
continue;
- aRow[4] = new ORowSetValueDecorator(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))));
- aRow[6] = new ORowSetValueDecorator(*pBegin);
+ aRow[4] = new ORowSetValueDecorator(ORowSetValue(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))));
+ aRow[6] = new ORowSetValueDecorator(idxName);
- auto pIndex = comphelper::getUnoTunnelImplementation<ODbaseIndex>(xIndex);
+ auto pIndex = dynamic_cast<ODbaseIndex*>(xIndex.get());
if(pIndex)
{
aRow[11] = new ORowSetValueDecorator(static_cast<sal_Int32>(pIndex->getHeader().db_maxkeys));
@@ -304,22 +287,19 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
Reference<XColumnsSupplier> xColumnsSup(xIndex,UNO_QUERY);
Reference< XNameAccess> xColumns = xColumnsSup->getColumns();
- Sequence< OUString> aColNames(xColumns->getElementNames());
- const OUString* pColBegin = aColNames.getConstArray();
- const OUString* pColEnd = pColBegin + aColNames.getLength();
- for(sal_Int32 j=1;pColBegin != pColEnd;++pColBegin,++j)
+ sal_Int32 j = 0;
+ for (auto& colName : xColumns->getElementNames())
{
- aRow[8] = new ORowSetValueDecorator(j);
- aRow[9] = new ORowSetValueDecorator(*pColBegin);
+ aRow[8] = new ORowSetValueDecorator(++j);
+ aRow[9] = new ORowSetValueDecorator(colName);
aRows.push_back(aRow);
}
}
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
- return xRef;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
OUString SAL_CALL ODbaseDatabaseMetaData::getURL( )
@@ -369,7 +349,7 @@ sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( )
bool bReadOnly = false;
::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
- aFile.getPropertyValue("IsReadOnly") >>= bReadOnly;
+ aFile.getPropertyValue(u"IsReadOnly"_ustr) >>= bReadOnly;
return bReadOnly;
}
diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx
index 5d9d56dcd5cf..36d44951f0f2 100644
--- a/connectivity/source/drivers/dbase/DDriver.cxx
+++ b/connectivity/source/drivers/dbase/DDriver.cxx
@@ -36,7 +36,7 @@ using namespace ::com::sun::star::lang;
OUString SAL_CALL ODriver::getImplementationName( )
{
- return "com.sun.star.comp.sdbc.dbase.ODriver";
+ return u"com.sun.star.comp.sdbc.dbase.ODriver"_ustr;
}
@@ -51,7 +51,7 @@ connectivity_dbase_ODriver(
}
if (ret)
ret->acquire();
- return static_cast<cppu::OWeakObject*>(ret.get());
+ return getXWeak(ret.get());
}
@@ -64,12 +64,11 @@ Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const S
if ( ! acceptsURL(url) )
return nullptr;
- ODbaseConnection* pCon = new ODbaseConnection(this);
+ rtl::Reference<ODbaseConnection> pCon = new ODbaseConnection(this);
pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon.get());
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
@@ -81,41 +80,37 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
{
if ( acceptsURL(url) )
{
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence< OUString > aBoolean { u"0"_ustr, u"1"_ustr };
- DriverPropertyInfo aDriverInfo[] = {
+ return
+ {
{
- "CharSet"
- ,"CharSet of the database."
+ u"CharSet"_ustr
+ ,u"CharSet of the database."_ustr
,false
,OUString()
,Sequence< OUString >()
},
{
- "ShowDeleted"
- ,"Display inactive records."
+ u"ShowDeleted"_ustr
+ ,u"Display inactive records."_ustr
,false
- ,"0"
+ ,u"0"_ustr
,aBoolean
},
{
- "EnableSQL92Check"
- ,"Use SQL92 naming constraints."
+ u"EnableSQL92Check"_ustr
+ ,u"Use SQL92 naming constraints."_ustr
,false
- ,"0"
+ ,u"0"_ustr
,aBoolean
}
};
-
- return Sequence< DriverPropertyInfo >(aDriverInfo, std::size(aDriverInfo));
}
SharedResources aResources;
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
}
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index d168de39eb77..1c32440e6b89 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -30,7 +30,6 @@
#include <unotools/ucbhelper.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <connectivity/dbexception.hxx>
#include <dbase/DResultSet.hxx>
#include <strings.hrc>
@@ -42,15 +41,12 @@ using namespace connectivity;
using namespace utl;
using namespace ::cppu;
using namespace connectivity::file;
-using namespace connectivity::sdbcx;
using namespace connectivity::dbase;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-IMPLEMENT_SERVICE_INFO(ODbaseIndex,"com.sun.star.sdbcx.driver.dbase.Index","com.sun.star.sdbcx.Index");
+IMPLEMENT_SERVICE_INFO(ODbaseIndex,u"com.sun.star.sdbcx.driver.dbase.Index"_ustr,u"com.sun.star.sdbcx.Index"_ustr);
ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable)
: OIndex(true/*_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()*/)
@@ -100,22 +96,6 @@ void ODbaseIndex::refreshColumns()
m_pColumns.reset(new ODbaseIndexColumns(this,m_aMutex,aVector));
}
-Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// XUnoTunnel
-
-sal_Int64 ODbaseIndex::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return (isUnoTunnelId<ODbaseIndex>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : ODbaseIndex_BASE::getSomething(rId);
-}
-
ONDXPagePtr const & ODbaseIndex::getRoot()
{
openIndexFile();
@@ -357,7 +337,7 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ODbaseIndex& rInd
return rStream;
}
-SvStream& connectivity::dbase::WriteODbaseIndex(SvStream &rStream, ODbaseIndex& rIndex)
+SvStream& connectivity::dbase::WriteODbaseIndex(SvStream &rStream, const ODbaseIndex& rIndex)
{
rStream.Seek(0);
rStream.WriteUInt32(rIndex.m_aHeader.db_rootpage);
@@ -404,8 +384,7 @@ void ODbaseIndex::createINFEntry()
bool bCase = isCaseSensitive();
while (aNewEntry.isEmpty())
{
- aNewEntry = OString("NDX");
- aNewEntry += OString::number(++nSuffix);
+ aNewEntry = "NDX" + OString::number(++nSuffix);
for (sal_uInt16 i = 0; i < aInfFile.GetKeyCount(); i++)
{
aKeyName = aInfFile.GetKeyName(i);
@@ -461,7 +440,7 @@ void ODbaseIndex::DropImpl()
}
}
-void ODbaseIndex::impl_killFileAndthrowError_throw(const char* pErrorId, const OUString& _sFile)
+void ODbaseIndex::impl_killFileAndthrowError_throw(TranslateId pErrorId, const OUString& _sFile)
{
closeImpl();
if(UCBContentHelper::Exists(_sFile))
@@ -568,15 +547,13 @@ void ODbaseIndex::CreateImpl()
if(xSet->last())
{
- Reference< XUnoTunnel> xTunnel(xSet, UNO_QUERY_THROW);
- ODbaseResultSet* pDbaseRes = reinterpret_cast< ODbaseResultSet* >( xTunnel->getSomething(ODbaseResultSet::getUnoTunnelId()) );
+ ODbaseResultSet* pDbaseRes = dynamic_cast<ODbaseResultSet*>(xSet.getTyped().get());
assert(pDbaseRes); //"No dbase resultset found? What's going on here!
nRowsLeft = xSet->getRow();
xSet->beforeFirst();
- ORowSetValue atmpValue;
- ONDXKey aKey(atmpValue, nType, 0);
- ONDXKey aInsertKey(atmpValue, nType, 0);
+ ONDXKey aKey(ORowSetValue(), nType, 0);
+ ONDXKey aInsertKey(ORowSetValue(), nType, 0);
// Create the index structure
while (xSet->next())
{
diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx
index 886c7273db31..dbf8f59a43c9 100644
--- a/connectivity/source/drivers/dbase/DIndexColumns.cxx
+++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx
@@ -28,12 +28,10 @@ using namespace connectivity::dbase;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-sdbcx::ObjectType ODbaseIndexColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > ODbaseIndexColumns::createObject(const OUString& _rName)
{
const ODbaseTable* pTable = m_pIndex->getTable();
@@ -45,9 +43,9 @@ sdbcx::ObjectType ODbaseIndexColumns::createObject(const OUString& _rName)
xCol = *aIter;
if(!xCol.is())
- return sdbcx::ObjectType();
+ return css::uno::Reference< css::beans::XPropertySet >();
- sdbcx::ObjectType xRet = new sdbcx::OIndexColumn(true,_rName
+ css::uno::Reference< css::beans::XPropertySet > xRet = new sdbcx::OIndexColumn(true,_rName
,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
,OUString()
,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
@@ -73,7 +71,7 @@ Reference< XPropertySet > ODbaseIndexColumns::createDescriptor()
return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
}
-sdbcx::ObjectType ODbaseIndexColumns::appendObject( const OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > ODbaseIndexColumns::appendObject( const OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
{
return cloneDescriptor( descriptor );
}
diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx
index 37e28a073f4c..35f5862b1bc2 100644
--- a/connectivity/source/drivers/dbase/DIndexIter.cxx
+++ b/connectivity/source/drivers/dbase/DIndexIter.cxx
@@ -109,7 +109,7 @@ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey)
pFoundKey = nullptr;
m_aCurLeaf = pPage;
- m_nCurNode = pFoundKey ? i : i - 1;
+ m_nCurNode = pFoundKey ? i : sal_uInt16(i - 1);
}
return pFoundKey;
}
@@ -262,7 +262,8 @@ ONDXKey* OIndexIterator::GetNextKey()
sal_uInt16 nPos = pParentPage->Search(pPage);
if (nPos != pParentPage->Count() - 1)
{ // page found
- pPage = (*pParentPage)[nPos + 1].GetChild(m_xIndex.get(), pParentPage);
+ pPage = (*pParentPage)[o3tl::sanitizing_inc(nPos)].GetChild(m_xIndex.get(),
+ pParentPage);
break;
}
}
diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx
index 1ebce2612098..1ade0679216c 100644
--- a/connectivity/source/drivers/dbase/DIndexes.cxx
+++ b/connectivity/source/drivers/dbase/DIndexes.cxx
@@ -24,20 +24,14 @@
#include <unotools/ucbhelper.hxx>
#include <strings.hrc>
-using namespace ::comphelper;
-
using namespace utl;
using namespace ::connectivity;
using namespace ::dbtools;
using namespace ::connectivity::dbase;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-sdbcx::ObjectType ODbaseIndexes::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > ODbaseIndexes::createObject(const OUString& _rName)
{
OUString sFile = m_pTable->getConnection()->getURL() +
OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER) +
@@ -51,23 +45,8 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const OUString& _rName)
::dbtools::throwGenericSQLException( sError, *m_pTable );
}
- sdbcx::ObjectType xRet;
std::unique_ptr<SvStream> pFileStream = ::connectivity::file::OFileTable::createStream_simpleError(sFile, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYWRITE);
- if(pFileStream)
- {
- pFileStream->SetEndian(SvStreamEndian::LITTLE);
- pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
- ODbaseIndex::NDXHeader aHeader;
-
- pFileStream->Seek(0);
- ReadHeader(*pFileStream, aHeader);
- pFileStream.reset();
-
- ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);
- xRet = pIndex;
- pIndex->openIndexFile();
- }
- else
+ if(!pFileStream)
{
const OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
STR_COULD_NOT_LOAD_FILE,
@@ -75,7 +54,18 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const OUString& _rName)
) );
::dbtools::throwGenericSQLException( sError, *m_pTable );
}
- return xRet;
+
+ pFileStream->SetEndian(SvStreamEndian::LITTLE);
+ pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
+ ODbaseIndex::NDXHeader aHeader;
+
+ pFileStream->Seek(0);
+ ReadHeader(*pFileStream, aHeader);
+ pFileStream.reset();
+
+ rtl::Reference<ODbaseIndex> pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);
+ pIndex->openIndexFile();
+ return pIndex;
}
void ODbaseIndexes::impl_refresh( )
@@ -90,16 +80,11 @@ Reference< XPropertySet > ODbaseIndexes::createDescriptor()
}
// XAppend
-sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > ODbaseIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
- {
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) );
- if(!pIndex)
- throw SQLException();
+ ODbaseIndex* pIndex = dynamic_cast<ODbaseIndex*>(descriptor.get());
+ if(pIndex)
pIndex->CreateImpl();
- }
return createObject( _rForName );
}
@@ -107,7 +92,7 @@ sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const
// XDrop
void ODbaseIndexes::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
{
- auto pIndex = comphelper::getUnoTunnelImplementation<ODbaseIndex>(getObject(_nPos));
+ rtl::Reference<ODbaseIndex> pIndex = dynamic_cast<ODbaseIndex*>(getObject(_nPos).get());
if ( pIndex )
pIndex->DropImpl();
}
diff --git a/connectivity/source/drivers/dbase/DPreparedStatement.cxx b/connectivity/source/drivers/dbase/DPreparedStatement.cxx
index 852c98acf509..3dc39e68857a 100644
--- a/connectivity/source/drivers/dbase/DPreparedStatement.cxx
+++ b/connectivity/source/drivers/dbase/DPreparedStatement.cxx
@@ -22,14 +22,14 @@
using namespace connectivity::dbase;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
-OResultSet* ODbasePreparedStatement::createResultSet()
+rtl::Reference<OResultSet> ODbasePreparedStatement::createResultSet()
{
return new ODbaseResultSet(this, m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(ODbasePreparedStatement, "com.sun.star.sdbc.driver.dbase.PreparedStatement",
- "com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(ODbasePreparedStatement,
+ u"com.sun.star.sdbc.driver.dbase.PreparedStatement"_ustr,
+ u"com.sun.star.sdbc.PreparedStatement"_ustr);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx
index f9395a359465..99357a01fcc8 100644
--- a/connectivity/source/drivers/dbase/DResultSet.cxx
+++ b/connectivity/source/drivers/dbase/DResultSet.cxx
@@ -49,12 +49,12 @@ ODbaseResultSet::ODbaseResultSet( OStatement_Base* pStmt,connectivity::OSQLParse
OUString SAL_CALL ODbaseResultSet::getImplementationName( )
{
- return "com.sun.star.sdbcx.dbase.ResultSet";
+ return u"com.sun.star.sdbcx.dbase.ResultSet"_ustr;
}
Sequence< OUString > SAL_CALL ODbaseResultSet::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
+ return { u"com.sun.star.sdbc.ResultSet"_ustr, u"com.sun.star.sdbcx.ResultSet"_ustr };
}
sal_Bool SAL_CALL ODbaseResultSet::supportsService( const OUString& _rServiceName )
@@ -81,7 +81,7 @@ Any SAL_CALL ODbaseResultSet::getBookmark( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getBookmark called for deleted row");
- return makeAny(static_cast<sal_Int32>((*m_aRow)[0]->getValue()));
+ return Any((*m_aRow)[0]->getValue().getInt32());
}
sal_Bool SAL_CALL ODbaseResultSet::moveToBookmark( const Any& bookmark )
@@ -149,13 +149,12 @@ Sequence< sal_Int32 > SAL_CALL ODbaseResultSet::deleteRows( const Sequence< An
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XDeleteRows::deleteRows", *this );
- return Sequence< sal_Int32 >();
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XDeleteRows::deleteRows"_ustr, *this );
}
bool ODbaseResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_xIndex)
{
- auto pIndex = comphelper::getUnoTunnelImplementation<dbase::ODbaseIndex>(_xIndex);
+ auto pIndex = dynamic_cast<dbase::ODbaseIndex*>(_xIndex.get());
if(pIndex)
{
std::unique_ptr<dbase::OIndexIterator> pIter = pIndex->createIterator();
@@ -187,12 +186,12 @@ bool ODbaseResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_xInde
return new ::cppu::OPropertyArrayHelper(aProps);
}
-void SAL_CALL ODbaseResultSet::acquire() throw()
+void SAL_CALL ODbaseResultSet::acquire() noexcept
{
ODbaseResultSet_BASE2::acquire();
}
-void SAL_CALL ODbaseResultSet::release() throw()
+void SAL_CALL ODbaseResultSet::release() noexcept
{
ODbaseResultSet_BASE2::release();
}
diff --git a/connectivity/source/drivers/dbase/DStatement.cxx b/connectivity/source/drivers/dbase/DStatement.cxx
index 096878e3e245..c6245e852d31 100644
--- a/connectivity/source/drivers/dbase/DStatement.cxx
+++ b/connectivity/source/drivers/dbase/DStatement.cxx
@@ -22,14 +22,13 @@
using namespace connectivity::dbase;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
-OResultSet* ODbaseStatement::createResultSet()
+rtl::Reference<OResultSet> ODbaseStatement::createResultSet()
{
return new ODbaseResultSet(this,m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(ODbaseStatement,"com.sun.star.sdbc.driver.dbase.Statement","com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(ODbaseStatement,u"com.sun.star.sdbc.driver.dbase.Statement"_ustr,u"com.sun.star.sdbc.Statement"_ustr);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index fece1bf7fb21..c7b6802209fd 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -28,7 +28,7 @@
#include <dbase/DConnection.hxx>
#include <dbase/DColumns.hxx>
#include <tools/config.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <dbase/DIndex.hxx>
#include <dbase/DIndexes.hxx>
#include <comphelper/processfactory.hxx>
@@ -39,11 +39,12 @@
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <comphelper/property.hxx>
#include <comphelper/servicehelper.hxx>
+#include <o3tl/string_view.hxx>
#include <comphelper/string.hxx>
+#include <comphelper/configuration.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/ucbhelper.hxx>
#include <comphelper/types.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <connectivity/dbtools.hxx>
@@ -54,6 +55,7 @@
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
#include <tools/date.hxx>
+#include <i18nutil/calendar.hxx>
#include <algorithm>
#include <cassert>
@@ -132,13 +134,13 @@ void lcl_CalcJulDate(sal_Int32& _nJulianDate,sal_Int32& _nJulianTime, const css:
if ( aDateTime.Year <= 0 )
{
_nJulianDate = static_cast<sal_Int32>((365.25 * iy0) - 0.75)
- + static_cast<sal_Int32>(30.6001 * (im0 + 1) )
+ + static_cast<sal_Int32>(i18nutil::monthDaysWithoutJanFeb * (im0 + 1) )
+ aDateTime.Day + 1720994;
} // if ( rDateTime.Year <= 0 )
else
{
_nJulianDate = static_cast<sal_Int32>(365.25 * iy0)
- + static_cast<sal_Int32>(30.6001 * (im0 + 1))
+ + static_cast<sal_Int32>(i18nutil::monthDaysWithoutJanFeb * (im0 + 1))
+ aDateTime.Day + 1720994;
}
double JD = _nJulianDate + 0.5;
@@ -155,17 +157,17 @@ void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,css::util::DateTi
{
if ( _nJulianDate )
{
- sal_Int32 ka = _nJulianDate;
+ sal_Int64 ka = _nJulianDate;
if ( _nJulianDate >= 2299161 )
{
- sal_Int32 ialp = static_cast<sal_Int32>( (static_cast<double>(_nJulianDate) - 1867216.25 ) / 36524.25 );
- ka = _nJulianDate + 1 + ialp - ( ialp >> 2 );
+ sal_Int64 ialp = static_cast<sal_Int64>( (static_cast<double>(_nJulianDate) - 1867216.25 ) / 36524.25 );
+ ka = ka + 1 + ialp - ( ialp >> 2 );
}
- sal_Int32 kb = ka + 1524;
- sal_Int32 kc = static_cast<sal_Int32>( (static_cast<double>(kb) - 122.1 ) / 365.25 );
- sal_Int32 kd = static_cast<sal_Int32>(static_cast<double>(kc) * 365.25);
- sal_Int32 ke = static_cast<sal_Int32>(static_cast<double>( kb - kd ) / 30.6001 );
- _rDateTime.Day = static_cast<sal_uInt16>(kb - kd - static_cast<sal_Int32>( static_cast<double>(ke) * 30.6001 ));
+ sal_Int64 kb = ka + 1524;
+ sal_Int64 kc = static_cast<sal_Int64>((static_cast<double>(kb) - 122.1) / 365.25);
+ sal_Int64 kd = static_cast<sal_Int64>(static_cast<double>(kc) * 365.25);
+ sal_Int64 ke = static_cast<sal_Int64>(static_cast<double>(kb - kd) / i18nutil::monthDaysWithoutJanFeb);
+ _rDateTime.Day = static_cast<sal_uInt16>(kb - kd - static_cast<sal_Int64>( static_cast<double>(ke) * i18nutil::monthDaysWithoutJanFeb ));
if ( ke > 13 )
_rDateTime.Month = static_cast<sal_uInt16>(ke - 13);
else
@@ -273,7 +275,11 @@ void ODbaseTable::readHeader()
void ODbaseTable::fillColumns()
{
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
- m_pFileStream->Seek(32);
+ if (!checkSeek(*m_pFileStream, 32))
+ {
+ SAL_WARN("connectivity.drivers", "ODbaseTable::fillColumns: bad offset!");
+ return;
+ }
if(!m_aColumns.is())
m_aColumns = new OSQLColumns();
@@ -285,8 +291,21 @@ void ODbaseTable::fillColumns()
m_aScales.clear();
// Number of fields:
- const sal_Int32 nFieldCount = (m_aHeader.headerLength - 1) / 32 - 1;
- OSL_ENSURE(nFieldCount,"No columns in table!");
+ sal_Int32 nFieldCount = (m_aHeader.headerLength - 1) / 32 - 1;
+ if (nFieldCount <= 0)
+ {
+ SAL_WARN("connectivity.drivers", "No columns in table!");
+ return;
+ }
+
+ auto nRemainingsize = m_pFileStream->remainingSize();
+ auto nMaxPossibleRecords = nRemainingsize / 32;
+ if (o3tl::make_unsigned(nFieldCount) > nMaxPossibleRecords)
+ {
+ SAL_WARN("connectivity.drivers", "Parsing error: " << nMaxPossibleRecords <<
+ " max possible entries, but " << nFieldCount << " claimed, truncating");
+ nFieldCount = nMaxPossibleRecords;
+ }
m_aColumns->reserve(nFieldCount);
m_aTypes.reserve(nFieldCount);
@@ -301,17 +320,13 @@ void ODbaseTable::fillColumns()
for (; i < nFieldCount; i++)
{
DBFColumn aDBFColumn;
-#if !defined(NDEBUG)
- sal_uInt64 const nOldPos(m_pFileStream->Tell());
-#endif
m_pFileStream->ReadBytes(aDBFColumn.db_fnm, 11);
m_pFileStream->ReadUChar(aDBFColumn.db_typ);
m_pFileStream->ReadUInt32(aDBFColumn.db_adr);
m_pFileStream->ReadUChar(aDBFColumn.db_flng);
m_pFileStream->ReadUChar(aDBFColumn.db_dez);
m_pFileStream->ReadBytes(aDBFColumn.db_free2, 14);
- assert(m_pFileStream->GetError() || m_pFileStream->Tell() == nOldPos + sizeof(aDBFColumn));
- if (m_pFileStream->GetError())
+ if (!m_pFileStream->good())
{
SAL_WARN("connectivity.drivers", "ODbaseTable::fillColumns: short read!");
break;
@@ -455,7 +470,6 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables, ODbaseConnection* _pConne
m_eEncoding = getConnection()->getTextEncoding();
}
-
void ODbaseTable::construct()
{
// initialize the header
@@ -483,19 +497,47 @@ void ODbaseTable::construct()
m_pFileStream = createStream_simpleError( sFileName, StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYNONE);
}
- if(!m_pFileStream)
+ if (!m_pFileStream)
return;
readHeader();
+
+ std::size_t nFileSize = lcl_getFileSize(*m_pFileStream);
+
+ if (m_aHeader.headerLength > nFileSize)
+ {
+ SAL_WARN("connectivity.drivers", "Parsing error: " << nFileSize <<
+ " max possible size, but " << m_aHeader.headerLength << " claimed, abandoning");
+ return;
+ }
+
+ if (m_aHeader.recordLength)
+ {
+ std::size_t nMaxPossibleRecords = (nFileSize - m_aHeader.headerLength) / m_aHeader.recordLength;
+ // #i83401# seems to be empty or someone wrote nonsense into the dbase
+ // file try and recover if m_aHeader.db_slng is sane
+ if (m_aHeader.nbRecords == 0)
+ {
+ SAL_WARN("connectivity.drivers", "Parsing warning: 0 records claimed, recovering");
+ m_aHeader.nbRecords = nMaxPossibleRecords;
+ }
+ else if (m_aHeader.nbRecords > nMaxPossibleRecords)
+ {
+ SAL_WARN("connectivity.drivers", "Parsing error: " << nMaxPossibleRecords <<
+ " max possible records, but " << m_aHeader.nbRecords << " claimed, truncating");
+ m_aHeader.nbRecords = std::max(nMaxPossibleRecords, static_cast<size_t>(1));
+ }
+ }
+
if (HasMemoFields())
{
// Create Memo-Filename (.DBT):
// nyi: Ugly for Unix and Mac!
if ( m_aHeader.type == FoxProMemo || m_aHeader.type == VisualFoxPro || m_aHeader.type == VisualFoxProAuto) // foxpro uses another extension
- aURL.SetExtension("fpt");
+ aURL.SetExtension(u"fpt");
else
- aURL.SetExtension("dbt");
+ aURL.SetExtension(u"dbt");
// If the memo file isn't found, the data will be displayed anyhow.
// However, updates can't be done
@@ -508,18 +550,10 @@ void ODbaseTable::construct()
if (m_pMemoStream)
ReadMemoHeader();
}
- fillColumns();
- std::size_t nFileSize = lcl_getFileSize(*m_pFileStream);
+ fillColumns();
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
- // seems to be empty or someone wrote bullshit into the dbase file
- // try and recover if m_aHeader.db_slng is sane
- if (m_aHeader.nbRecords == 0 && m_aHeader.recordLength)
- {
- std::size_t nRecords = (nFileSize-m_aHeader.headerLength)/m_aHeader.recordLength;
- if (nRecords > 0)
- m_aHeader.nbRecords = nRecords;
- }
+
// Buffersize dependent on the file size
m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
@@ -614,7 +648,7 @@ OUString ODbaseTable::getEntry(file::OConnection const * _pConnection, std::u16s
// name and extension have to coincide
if ( _pConnection->matchesExtension( sExt ) )
{
- sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength() + 1, OUString());
+ sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength() + 1, u"");
if ( sName == _sName )
{
Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );
@@ -645,7 +679,7 @@ void ODbaseTable::refreshColumns()
if(m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = new ODbaseColumns(this,m_aMutex,aVector);
+ m_xColumns.reset(new ODbaseColumns(this,m_aMutex,aVector));
}
void ODbaseTable::refreshIndexes()
@@ -656,7 +690,7 @@ void ODbaseTable::refreshIndexes()
INetURLObject aURL;
aURL.SetURL(getEntry(m_pConnection,m_Name));
- aURL.setExtension("inf");
+ aURL.setExtension(u"inf");
Config aInfFile(aURL.getFSysPath(FSysStyle::Detect));
aInfFile.SetGroup(dBASE_III_GROUP);
sal_uInt16 nKeyCnt = aInfFile.GetKeyCount();
@@ -688,7 +722,7 @@ void ODbaseTable::refreshIndexes()
if(m_xIndexes)
m_xIndexes->reFill(aVector);
else
- m_xIndexes = new ODbaseIndexes(this,m_aMutex,aVector);
+ m_xIndexes.reset(new ODbaseIndexes(this,m_aMutex,aVector));
}
@@ -705,14 +739,12 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes( )
std::vector<Type> aOwnTypes;
aOwnTypes.reserve(aTypes.getLength());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
+ for (auto& type : aTypes)
{
- if(*pBegin != cppu::UnoType<XKeysSupplier>::get() &&
- *pBegin != cppu::UnoType<XDataDescriptorFactory>::get())
+ if(type != cppu::UnoType<XKeysSupplier>::get() &&
+ type != cppu::UnoType<XDataDescriptorFactory>::get())
{
- aOwnTypes.push_back(*pBegin);
+ aOwnTypes.push_back(type);
}
}
aOwnTypes.push_back(cppu::UnoType<css::lang::XUnoTunnel>::get());
@@ -727,25 +759,9 @@ Any SAL_CALL ODbaseTable::queryInterface( const Type & rType )
return Any();
Any aRet = OTable_TYPEDEF::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< css::lang::XUnoTunnel*> (this));
-}
-
-
-Sequence< sal_Int8 > ODbaseTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ return aRet;
}
-// css::lang::XUnoTunnel
-
-sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return (isUnoTunnelId<ODbaseTable>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : ODbaseTable_BASE::getSomething(rId);
-}
bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool bRetrieveData)
{
@@ -753,7 +769,7 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
return false;
// Read the data
- bool bIsCurRecordDeleted = static_cast<char>(m_pBuffer[0]) == '*';
+ bool bIsCurRecordDeleted = m_pBuffer[0] == '*';
// only read the bookmark
@@ -772,10 +788,8 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
for (std::size_t i = 1; aIter != aEnd && nByteOffset <= m_nBufferSize && i < nCount;++aIter, i++)
{
// Lengths depending on data type:
- sal_Int32 nLen = 0;
- sal_Int32 nType = 0;
- nLen = m_aPrecisions[i-1];
- nType = m_aTypes[i-1];
+ sal_Int32 nLen = m_aPrecisions[i-1];
+ sal_Int32 nType = m_aTypes[i-1];
switch(nType)
{
@@ -827,15 +841,20 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
}
else
{
- // Commit the string. Use intern() to ref-count it.
- *(*_rRow)[i] = OUString::intern(pData, static_cast<sal_Int32>(nLastPos+1), m_eEncoding);
+ // Commit the string
+ *(*_rRow)[i] = OUString(pData, static_cast<sal_Int32>(nLastPos+1), m_eEncoding);
}
} // if (nType == DataType::CHAR || nType == DataType::VARCHAR)
else if ( DataType::TIMESTAMP == nType )
{
sal_Int32 nDate = 0,nTime = 0;
+ if (o3tl::make_unsigned(nLen) < 8)
+ {
+ SAL_WARN("connectivity.drivers", "short TIMESTAMP");
+ return false;
+ }
memcpy(&nDate, pData, 4);
- memcpy(&nTime, pData+ 4, 4);
+ memcpy(&nTime, pData + 4, 4);
if ( !nDate && !nTime )
{
(*_rRow)[i]->setNull();
@@ -907,20 +926,20 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
continue;
}
- OUString aStr = OUString::intern(pData+nPos1, nPos2-nPos1+1, m_eEncoding);
+ OUString aStr(pData+nPos1, nPos2-nPos1+1, m_eEncoding);
switch (nType)
{
case DataType::DATE:
{
- if (aStr.getLength() != nLen)
+ if (nLen < 8 || aStr.getLength() != nLen)
{
(*_rRow)[i]->setNull();
break;
}
- const sal_uInt16 nYear = static_cast<sal_uInt16>(aStr.copy( 0, 4 ).toInt32());
- const sal_uInt16 nMonth = static_cast<sal_uInt16>(aStr.copy( 4, 2 ).toInt32());
- const sal_uInt16 nDay = static_cast<sal_uInt16>(aStr.copy( 6, 2 ).toInt32());
+ const sal_uInt16 nYear = static_cast<sal_uInt16>(o3tl::toInt32(aStr.subView( 0, 4 )));
+ const sal_uInt16 nMonth = static_cast<sal_uInt16>(o3tl::toInt32(aStr.subView( 4, 2 )));
+ const sal_uInt16 nDay = static_cast<sal_uInt16>(o3tl::toInt32(aStr.subView( 6, 2 )));
const css::util::Date aDate(nDay,nMonth,nYear);
*(*_rRow)[i] = aDate;
@@ -971,9 +990,6 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
void ODbaseTable::FileClose()
{
::osl::MutexGuard aGuard(m_aMutex);
- // if not everything has been written yet
- if (m_pMemoStream && m_pMemoStream->IsWritable())
- m_pMemoStream->Flush();
m_pMemoStream.reset();
@@ -984,7 +1000,7 @@ bool ODbaseTable::CreateImpl()
{
OSL_ENSURE(!m_pFileStream, "SequenceError");
- if ( m_pConnection->isCheckEnabled() && ::dbtools::convertName2SQLName(m_Name,OUString()) != m_Name )
+ if ( m_pConnection->isCheckEnabled() && ::dbtools::convertName2SQLName(m_Name, u"") != m_Name )
{
const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
STR_SQL_NAME_ERROR,
@@ -1036,7 +1052,7 @@ bool ODbaseTable::CreateImpl()
try
{
Content aContent(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
- aContent.executeCommand( "delete", css::uno::Any( true ) );
+ aContent.executeCommand( u"delete"_ustr, css::uno::Any( true ) );
}
catch(const Exception&) // an exception is thrown when no file exists
{
@@ -1047,7 +1063,7 @@ bool ODbaseTable::CreateImpl()
if (bMemoFile)
{
OUString aExt = aURL.getExtension();
- aURL.setExtension("dbt"); // extension for memo file
+ aURL.setExtension(u"dbt"); // extension for memo file
bool bMemoAlreadyExists = false;
try
@@ -1064,7 +1080,7 @@ bool ODbaseTable::CreateImpl()
try
{
Content aMemoContent(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
- aMemoContent.executeCommand( "delete", css::uno::Any( true ) );
+ aMemoContent.executeCommand( u"delete"_ustr, css::uno::Any( true ) );
}
catch(const Exception&)
{
@@ -1082,7 +1098,7 @@ bool ODbaseTable::CreateImpl()
try
{
Content aMemoContent(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
- aMemoContent.executeCommand( "delete", css::uno::Any( true ) );
+ aMemoContent.executeCommand( u"delete"_ustr, css::uno::Any( true ) );
}
catch(const ContentCreationException&)
{
@@ -1103,7 +1119,7 @@ bool ODbaseTable::CreateImpl()
return true;
}
-void ODbaseTable::throwInvalidColumnType(const char* pErrorId, const OUString& _sColumnName)
+void ODbaseTable::throwInvalidColumnType(TranslateId pErrorId, const OUString& _sColumnName)
{
try
{
@@ -1363,6 +1379,10 @@ bool ODbaseTable::CreateFile(const INetURLObject& aFile, bool& bCreateMemo)
return true;
}
+bool ODbaseTable::HasMemoFields() const
+{
+ return m_aHeader.type > dBaseIV && !comphelper::IsFuzzing();
+}
// creates in principle dBase III file format
bool ODbaseTable::CreateMemoFile(const INetURLObject& aFile)
@@ -1378,12 +1398,11 @@ bool ODbaseTable::CreateMemoFile(const INetURLObject& aFile)
m_pMemoStream->Seek(0);
(*m_pMemoStream).WriteUInt32( 1 ); // pointer to the first free block
- m_pMemoStream->Flush();
m_pMemoStream.reset();
return true;
}
-bool ODbaseTable::Drop_Static(const OUString& _sUrl, bool _bHasMemoFields, OCollection* _pIndexes )
+bool ODbaseTable::Drop_Static(std::u16string_view _sUrl, bool _bHasMemoFields, OCollection* _pIndexes )
{
INetURLObject aURL;
aURL.SetURL(_sUrl);
@@ -1394,7 +1413,7 @@ bool ODbaseTable::Drop_Static(const OUString& _sUrl, bool _bHasMemoFields, OColl
{
if (_bHasMemoFields)
{ // delete the memo fields
- aURL.setExtension("dbt");
+ aURL.setExtension(u"dbt");
bDropped = ::utl::UCBContentHelper::Kill(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
}
@@ -1414,13 +1433,13 @@ bool ODbaseTable::Drop_Static(const OUString& _sUrl, bool _bHasMemoFields, OColl
{
}
}
- aURL.setExtension("inf");
+ aURL.setExtension(u"inf");
// as the inf file does not necessarily exist, we aren't allowed to use UCBContentHelper::Kill
try
{
::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
- aDeleteContent.executeCommand( "delete", makeAny( true ) );
+ aDeleteContent.executeCommand( u"delete"_ustr, Any( true ) );
}
catch(const Exception&)
{
@@ -1562,10 +1581,8 @@ bool ODbaseTable::DeleteRow(const OSQLColumns& _rCols)
{
xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
- Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
- OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) );
- OSL_ENSURE(pIndex,"ODbaseTable::DeleteRow: No Index returned!");
+ ODbaseIndex* pIndex = dynamic_cast<ODbaseIndex*>(xIndex.get());
+ assert(pIndex && "ODbaseTable::DeleteRow: No Index returned!");
OSQLColumns::const_iterator aIter = std::find_if(_rCols.begin(), _rCols.end(),
[&aCase, &aColName](const OSQLColumns::value_type& rxCol) {
@@ -1613,7 +1630,7 @@ Reference<XPropertySet> ODbaseTable::isUniqueByColumnName(sal_Int32 _nColumnPos)
return Reference<XPropertySet>();
}
-static double toDouble(const OString& rString)
+static double toDouble(std::string_view rString)
{
return ::rtl::math::stringToDouble( rString, '.', ',' );
}
@@ -1635,7 +1652,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
::comphelper::UStringMixEqual aCase(isCaseSensitive());
- Reference<XIndexAccess> xColumns = m_xColumns.get();
+ Reference<XIndexAccess> xColumns(m_xColumns.get());
// first search a key that exist already in the table
for (sal_Int32 i = 0; i < nColumnCount; ++i)
{
@@ -1668,10 +1685,8 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
continue;
else
{
- Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
- OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) );
- OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!");
+ ODbaseIndex* pIndex = dynamic_cast<ODbaseIndex*>(xIndex.get());
+ assert(pIndex && "ODbaseTable::UpdateBuffer: No Index returned!");
if (pIndex->Find(0,*rRow[nPos]))
{
@@ -1776,10 +1791,8 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
}
if (aIndexedCols[i].is())
{
- Reference<XUnoTunnel> xTunnel(aIndexedCols[i],UNO_QUERY);
- OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) );
- OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!");
+ ODbaseIndex* pIndex = dynamic_cast<ODbaseIndex*>(aIndexedCols[i].get());
+ assert(pIndex && "ODbaseTable::UpdateBuffer: No Index returned!");
// Update !!
if (pOrgRow.is() && !thisColIsNull)
pIndex->Update(m_nFilePos, *(*pOrgRow)[nPos], thisColVal);
@@ -1806,7 +1819,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
case DataType::TIMESTAMP:
{
sal_Int32 nJulianDate = 0, nJulianTime = 0;
- lcl_CalcJulDate(nJulianDate,nJulianTime, thisColVal);
+ lcl_CalcJulDate(nJulianDate,nJulianTime, thisColVal.getDateTime());
// Exactly 8 bytes to copy:
memcpy(pData,&nJulianDate,4);
memcpy(pData+4,&nJulianTime,4);
@@ -1818,7 +1831,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
if(thisColVal.getTypeKind() == DataType::DOUBLE)
aDate = ::dbtools::DBTypeConversion::toDate(thisColVal.getDouble());
else
- aDate = thisColVal;
+ aDate = thisColVal.getDate();
char s[sizeof("-327686553565535")];
// reserve enough space for hypothetical max length
snprintf(s,
@@ -1833,7 +1846,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
} break;
case DataType::INTEGER:
{
- sal_Int32 nValue = thisColVal;
+ sal_Int32 nValue = thisColVal.getInt32();
if (o3tl::make_unsigned(nLen) > sizeof(nValue))
return false;
memcpy(pData,&nValue,nLen);
@@ -1841,7 +1854,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
break;
case DataType::DOUBLE:
{
- const double d = thisColVal;
+ const double d = thisColVal.getDouble();
m_xColumns->getByIndex(i) >>= xCol;
if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately
@@ -1867,7 +1880,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
{
memset(pData,' ',nLen); // Clear to NULL
- const double n = thisColVal;
+ const double n = thisColVal.getDouble();
// one, because const_cast GetFormatPrecision on SvNumberFormat is not constant,
// even though it really could and should be
@@ -1885,11 +1898,13 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
m_xColumns->getByIndex(i) >>= xCol;
OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!");
xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
- std::vector< std::pair<const char* , OUString > > aStringToSubstitutes;
- aStringToSubstitutes.push_back(std::pair<const char* , OUString >("$columnname$", aColName));
- aStringToSubstitutes.push_back(std::pair<const char* , OUString >("$precision$", OUString::number(nLen)));
- aStringToSubstitutes.push_back(std::pair<const char* , OUString >("$scale$", OUString::number(nScale)));
- aStringToSubstitutes.push_back(std::pair<const char* , OUString >("$value$", OStringToOUString(aDefaultValue,RTL_TEXTENCODING_UTF8)));
+ std::vector< std::pair<const char* , OUString > > aStringToSubstitutes
+ {
+ { "$columnname$", aColName },
+ { "$precision$", OUString::number(nLen) },
+ { "$scale$", OUString::number(nScale) },
+ { "$value$", OStringToOUString(aDefaultValue,RTL_TEXTENCODING_UTF8) }
+ };
const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
STR_INVALID_COLUMN_DECIMAL_VALUE
@@ -2154,9 +2169,8 @@ void ODbaseTable::alterColumn(sal_Int32 index,
OUString sTempName = createTempFile();
- ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
- Reference<XPropertySet> xHoldTable = pNewTable;
- pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
+ rtl::Reference<ODbaseTable> pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
+ pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),Any(sTempName));
Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
OSL_ENSURE(xAppend.is(),"ODbaseTable::alterColumn: No XAppend interface!");
@@ -2205,7 +2219,7 @@ void ODbaseTable::alterColumn(sal_Int32 index,
pNewTable->construct();
// copy the data
- copyData(pNewTable,0);
+ copyData(pNewTable.get(),0);
// now drop the old one
if( DropImpl() ) // we don't want to delete the memo columns too
@@ -2224,8 +2238,8 @@ void ODbaseTable::alterColumn(sal_Int32 index,
::dbtools::throwGenericSQLException( sError, *this );
}
// release the temp file
+ ::comphelper::disposeComponent(pNewTable);
pNewTable = nullptr;
- ::comphelper::disposeComponent(xHoldTable);
}
else
{
@@ -2272,7 +2286,7 @@ void SAL_CALL ODbaseTable::rename( const OUString& newName )
namespace
{
void renameFile(file::OConnection const * _pConnection,std::u16string_view oldName,
- const OUString& newName,const OUString& _sExtension)
+ const OUString& newName, std::u16string_view _sExtension)
{
OUString aName = ODbaseTable::getEntry(_pConnection,oldName);
if(aName.isEmpty())
@@ -2293,14 +2307,14 @@ namespace
{
Content aContent(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
- Sequence< PropertyValue > aProps( 1 );
- aProps[0].Name = "Title";
- aProps[0].Handle = -1; // n/a
- aProps[0].Value <<= sNewName;
+ Sequence< PropertyValue > aProps{ { u"Title"_ustr,
+ -1, // n/a
+ Any(sNewName),
+ css::beans::PropertyState_DIRECT_VALUE } };
Sequence< Any > aValues;
- aContent.executeCommand( "setPropertyValues",makeAny(aProps) ) >>= aValues;
+ aContent.executeCommand( u"setPropertyValues"_ustr,Any(aProps) ) >>= aValues;
if(aValues.hasElements() && aValues[0].hasValue())
- throw Exception("setPropertyValues returned non-zero", nullptr);
+ throw Exception(u"setPropertyValues returned non-zero"_ustr, nullptr);
}
catch(const Exception&)
{
@@ -2319,7 +2333,7 @@ void ODbaseTable::renameImpl( const OUString& newName )
renameFile(m_pConnection,m_Name,newName,m_pConnection->getExtension());
if ( HasMemoFields() )
{ // delete the memo fields
- renameFile(m_pConnection,m_Name,newName,"dbt");
+ renameFile(m_pConnection,m_Name,newName,u"dbt");
}
}
@@ -2328,7 +2342,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
OUString sTempName = createTempFile();
rtl::Reference xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)));
- xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
+ xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),Any(sTempName));
{
Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY);
bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
@@ -2386,7 +2400,7 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos)
OUString sTempName = createTempFile();
rtl::Reference xNewTable(new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)));
- xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName));
+ xNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),Any(sTempName));
{
Reference<XAppend> xAppend(xNewTable->getColumns(),UNO_QUERY);
bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
@@ -2440,16 +2454,14 @@ OUString ODbaseTable::createTempFile()
if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
aIdent += "/";
- OUString sTempName(aIdent);
OUString sExt("." + m_pConnection->getExtension());
- OUString sName(m_Name);
- TempFile aTempFile(sName, true, &sExt, &sTempName);
- if(!aTempFile.IsValid())
+ OUString aTempFileURL = utl::CreateTempURL(m_Name, true, sExt, &aIdent);
+ if(aTempFileURL.isEmpty())
getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE, *this);
INetURLObject aURL;
aURL.SetSmartProtocol(INetProtocol::File);
- aURL.SetURL(aTempFile.GetURL());
+ aURL.SetURL(aTempFileURL);
OUString sNewName(aURL.getName().copy(0, aURL.getName().getLength() - sExt.getLength()));
@@ -2499,7 +2511,7 @@ void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos)
}
}
}
- bOk = _pNewTable->InsertRow(*aInsertRow,_pNewTable->m_xColumns.get());
+ bOk = _pNewTable->InsertRow(*aInsertRow, _pNewTable->m_xColumns.get());
SAL_WARN_IF(!bOk, "connectivity.drivers", "Row could not be inserted!");
}
else
@@ -2646,7 +2658,7 @@ bool ODbaseTable::ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable)
} while (!bReady && !m_pMemoStream->eof());
- aVariable = OStringToOUString(aBStr.makeStringAndClear(),
+ aVariable = OStringToOUString(aBStr,
m_eEncoding);
} break;
@@ -2670,7 +2682,14 @@ bool ODbaseTable::ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable)
(*m_pMemoStream).ReadUInt32( nLength );
if (m_aMemoHeader.db_typ == MemodBaseIV)
+ {
+ if (nLength < 8)
+ {
+ SAL_WARN("connectivity.drivers", "Size too small");
+ return false;
+ }
nLength -= 8;
+ }
if ( nLength )
{
@@ -2680,7 +2699,7 @@ bool ODbaseTable::ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable)
//pad it out with ' ' to expected length on short read
sal_Int32 nRequested = sal::static_int_cast<sal_Int32>(nLength);
comphelper::string::padToLength(aBuffer, nRequested, ' ');
- aVariable = OStringToOUString(aBuffer.makeStringAndClear(), m_eEncoding);
+ aVariable = OStringToOUString(aBuffer, m_eEncoding);
} // if ( bIsText )
else
{
diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx
index 1d922969493f..d43bfb31356a 100644
--- a/connectivity/source/drivers/dbase/DTables.cxx
+++ b/connectivity/source/drivers/dbase/DTables.cxx
@@ -32,7 +32,6 @@
#include <strings.hrc>
#include <connectivity/dbexception.hxx>
-using namespace ::comphelper;
using namespace connectivity;
using namespace connectivity::dbase;
using namespace connectivity::file;
@@ -40,17 +39,15 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
-sdbcx::ObjectType ODbaseTables::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > ODbaseTables::createObject(const OUString& _rName)
{
- ODbaseTable* pRet = new ODbaseTable(this, static_cast<ODbaseConnection*>(static_cast<OFileCatalog&>(m_rParent).getConnection()),
- _rName,"TABLE");
+ rtl::Reference<ODbaseTable> pRet = new ODbaseTable(this, static_cast<ODbaseConnection*>(static_cast<OFileCatalog&>(m_rParent).getConnection()),
+ _rName,u"TABLE"_ustr);
- sdbcx::ObjectType xRet = pRet;
pRet->construct();
- return xRet;
+ return pRet;
}
void ODbaseTables::impl_refresh( )
@@ -64,12 +61,12 @@ Reference< XPropertySet > ODbaseTables::createDescriptor()
}
// XAppend
-sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > ODbaseTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- auto pTable = comphelper::getUnoTunnelImplementation<ODbaseTable>(descriptor);
+ auto pTable = dynamic_cast<ODbaseTable*>(descriptor.get());
if(pTable)
{
- pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(_rForName));
+ pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),Any(_rForName));
try
{
if(!pTable->CreateImpl())
@@ -82,7 +79,7 @@ sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const R
catch(Exception& ex)
{
css::uno::Any anyEx = cppu::getCaughtException();
- throw SQLException( ex.Message, nullptr, "", 0, anyEx );
+ throw SQLException( ex.Message, nullptr, u""_ustr, 0, anyEx );
}
}
return createObject( _rForName );
@@ -91,7 +88,7 @@ sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const R
// XDrop
void ODbaseTables::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
{
- Reference< XUnoTunnel> xTunnel;
+ Reference< XInterface > xTunnel;
try
{
xTunnel.set(getObject(_nPos),UNO_QUERY);
@@ -104,7 +101,7 @@ void ODbaseTables::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
if ( xTunnel.is() )
{
- ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelId()) );
+ ODbaseTable* pTable = dynamic_cast<ODbaseTable*>(xTunnel.get());
if(pTable)
pTable->DropImpl();
}
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index 69648c480e79..0e4746a0b9a6 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -26,6 +26,7 @@
#include <algorithm>
#include <memory>
+#include <utility>
using namespace connectivity;
@@ -38,10 +39,10 @@ ONDXKey::ONDXKey()
{
}
-ONDXKey::ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, sal_uInt32 nRec)
+ONDXKey::ONDXKey(ORowSetValue aVal, sal_Int32 eType, sal_uInt32 nRec)
: ONDXKey_BASE(eType)
, nRecord(nRec)
- , xValue(rVal)
+ , xValue(std::move(aVal))
{
}
@@ -167,7 +168,7 @@ bool ONDXPage::Find(const ONDXKey& rKey)
else if (i == nCount)
{
rIndex.m_aCurLeaf = this;
- rIndex.m_nCurNode = i - 1;
+ rIndex.m_nCurNode = sal_uInt16(i - 1);
bResult = false;
}
else
@@ -206,8 +207,13 @@ bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft)
}
else // position unknown
{
- sal_uInt16 nPos = NODE_NOTFOUND;
- while (++nPos < nCount && rNode.GetKey() > ((*this)[nPos]).GetKey()) ;
+ sal_uInt16 nPos = 0;
+ while (nPos < nCount)
+ {
+ if (rNode.GetKey() <= ((*this)[nPos]).GetKey())
+ break;
+ ++nPos;
+ }
--nCount; // (otherwise we might get Assertions and GPFs - 60593)
bResult = Insert(nPos, rNode);
@@ -234,7 +240,7 @@ bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft)
ONDXPagePtr aNewRoot = rIndex.CreatePage(nNewPagePos + 1);
aNewRoot->SetChild(this);
- rIndex.m_aRoot = aNewRoot;
+ rIndex.m_aRoot = std::move(aNewRoot);
rIndex.SetRootPos(nNewPagePos + 1);
rIndex.SetPageCount(++nNewPageCount);
}
@@ -268,7 +274,7 @@ bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft)
ONDXPagePtr aTempParent = aParent;
if (IsLeaf())
{
- rIndex.m_aCurLeaf = aNewPage;
+ rIndex.m_aCurLeaf = std::move(aNewPage);
rIndex.m_nCurNode = rIndex.m_aCurLeaf->Count() - 1;
// free not needed pages, there are no references to those on the page
@@ -410,8 +416,8 @@ void ONDXPage::Delete(sal_uInt16 nNodePos)
else
{
// merge with right neighbour
- Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent)));
- nParentNodePos++;
+ nParentNodePos = o3tl::sanitizing_inc(nParentNodePos);
+ Merge(nParentNodePos,((*aParent)[nParentNodePos].GetChild(&rIndex,aParent)));
}
if (HasParent() && !(*aParent)[nParentNodePos].HasChild())
aParent->Delete(nParentNodePos);
@@ -482,7 +488,7 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, const ONDXPagePtr& xPage)
nMaxNodes_2 = nMaxNodes / 2;
// Determine if page is right or left neighbour
- bool bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // sal_True, whenn xPage the right side is
+ bool bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // true when xPage is at the right side
sal_uInt16 nNewCount = (*xPage).Count() + Count();
if (IsLeaf())
@@ -701,7 +707,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
rStream.WriteBytes(&buf[0], sizeof(double));
}
else
- rStream.WriteDouble( static_cast<double>(aKey.getValue()) );
+ rStream.WriteDouble( aKey.getValue().getDouble() );
}
else
{
@@ -710,7 +716,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
memset(&pBuf[0], 0x20, nLen);
if (!aKey.getValue().isNull())
{
- OUString sValue = aKey.getValue();
+ OUString sValue = aKey.getValue().getString();
OString aText(OUStringToOString(sValue, rIndex.m_pTable->getConnection()->getTextEncoding()));
strncpy(reinterpret_cast<char *>(&pBuf[0]), aText.getStr(),
std::min<size_t>(nLen, aText.getLength()));
@@ -764,8 +770,8 @@ int ONDXKey::Compare(const ONDXKey& rKey) const
}
else
{
- double m = getValue();
- double n = rKey.getValue();
+ double m = getValue().getDouble();
+ double n = rKey.getValue().getDouble();
nRes = (m > n) ? 1 : ( m < n) ? -1 : 0;
}
@@ -968,28 +974,28 @@ bool ONDXPage::IsFull() const
return Count() == rIndex.getHeader().db_maxkeys;
}
-
sal_uInt16 ONDXPage::Search(const ONDXKey& rSearch)
{
// binary search later
- sal_uInt16 i = NODE_NOTFOUND;
- while (++i < Count())
- if ((*this)[i].GetKey() == rSearch)
- break;
+ for (sal_uInt16 i = 0, nSize = Count(); i < nSize; ++i)
+ {
+ if (((*this)[i]).GetKey() == rSearch)
+ return i;
+ }
- return (i < Count()) ? i : NODE_NOTFOUND;
+ return NODE_NOTFOUND;
}
-
sal_uInt16 ONDXPage::Search(const ONDXPage* pPage)
{
- sal_uInt16 i = NODE_NOTFOUND;
- while (++i < Count())
+ for (sal_uInt16 i = 0, nSize = Count(); i < nSize; ++i)
+ {
if (((*this)[i]).GetChild() == pPage)
- break;
+ return i;
+ }
// if not found, then we assume, that the page itself points to the page
- return (i < Count()) ? i : NODE_NOTFOUND;
+ return NODE_NOTFOUND;
}
// runs recursively
diff --git a/connectivity/source/drivers/evoab2/EApi.cxx b/connectivity/source/drivers/evoab2/EApi.cxx
index 56a957fabb63..9ec8e0d44e32 100644
--- a/connectivity/source/drivers/evoab2/EApi.cxx
+++ b/connectivity/source/drivers/evoab2/EApi.cxx
@@ -21,24 +21,14 @@
#define DECLARE_FN_POINTERS 1
#include "EApi.h"
static const char *eBookLibNames[] = {
+ "libebook-1.2.so.21", // evolution-data-server 3.45.2+
"libebook-1.2.so.20", // evolution-data-server 3.33.2+
"libebook-1.2.so.19", // evolution-data-server 3.24+
- "libebook-1.2.so.16",
- "libebook-1.2.so.15",
- "libebook-1.2.so.14", // bumped again (evolution-3.6)
- "libebook-1.2.so.13", // bumped again (evolution-3.4)
- "libebook-1.2.so.12", // bumped again
- "libebook-1.2.so.10", // bumped again
- "libebook-1.2.so.9", // evolution-2.8
- "libebook-1.2.so.5", // evolution-2.4 and 2.6+
- "libebook-1.2.so.3", // evolution-2.2
- "libebook.so.8" // evolution-2.0
+ "libebook-1.2.so.16"
};
typedef void (*SymbolFunc) ();
-#define SYM_MAP(a) { #a, reinterpret_cast<SymbolFunc *>(&a) }
-
namespace {
struct ApiMap
@@ -51,70 +41,48 @@ struct ApiMap
const ApiMap aCommonApiMap[] =
{
- SYM_MAP( eds_check_version ),
- SYM_MAP( e_contact_field_name ),
- SYM_MAP( e_contact_get ),
- SYM_MAP( e_contact_get_type ),
- SYM_MAP( e_contact_field_id ),
- SYM_MAP( e_book_new ),
- SYM_MAP( e_book_open ),
- SYM_MAP( e_book_get_source ),
- SYM_MAP( e_book_get_contacts ),
- SYM_MAP( e_book_query_field_test ),
- SYM_MAP( e_book_query_and ),
- SYM_MAP( e_book_query_or ),
- SYM_MAP( e_book_query_not ),
- SYM_MAP( e_book_query_ref ),
- SYM_MAP( e_book_query_unref ),
- SYM_MAP( e_book_query_from_string ),
- SYM_MAP( e_book_query_to_string ),
- SYM_MAP( e_book_query_field_exists )
-};
-
-//< 3.6 api
-const ApiMap aOldApiMap[] =
-{
- SYM_MAP( e_book_get_addressbooks ),
- SYM_MAP( e_book_get_uri ),
- SYM_MAP( e_book_authenticate_user ),
- SYM_MAP( e_source_group_peek_base_uri),
- SYM_MAP( e_source_peek_name ),
- SYM_MAP( e_source_get_property ),
- SYM_MAP( e_source_list_peek_groups ),
- SYM_MAP( e_source_group_peek_sources )
+ { "eds_check_version", reinterpret_cast<SymbolFunc *>(&eds_check_version) },
+ { "e_contact_field_name", reinterpret_cast<SymbolFunc *>(&e_contact_field_name) },
+ { "e_contact_get", reinterpret_cast<SymbolFunc *>(&e_contact_get) },
+ { "e_contact_get_type", reinterpret_cast<SymbolFunc *>(&e_contact_get_type) },
+ { "e_contact_field_id", reinterpret_cast<SymbolFunc *>(&e_contact_field_id) },
+ { "e_book_new", reinterpret_cast<SymbolFunc *>(&e_book_new) },
+ { "e_book_open", reinterpret_cast<SymbolFunc *>(&e_book_open) },
+ { "e_book_get_source", reinterpret_cast<SymbolFunc *>(&e_book_get_source) },
+ { "e_book_get_contacts", reinterpret_cast<SymbolFunc *>(&e_book_get_contacts) },
+ { "e_book_query_field_test", reinterpret_cast<SymbolFunc *>(&e_book_query_field_test) },
+ { "e_book_query_and", reinterpret_cast<SymbolFunc *>(&e_book_query_and) },
+ { "e_book_query_or", reinterpret_cast<SymbolFunc *>(&e_book_query_or) },
+ { "e_book_query_not", reinterpret_cast<SymbolFunc *>(&e_book_query_not) },
+ { "e_book_query_ref", reinterpret_cast<SymbolFunc *>(&e_book_query_ref) },
+ { "e_book_query_unref", reinterpret_cast<SymbolFunc *>(&e_book_query_unref) },
+ { "e_book_query_from_string", reinterpret_cast<SymbolFunc *>(&e_book_query_from_string) },
+ { "e_book_query_to_string", reinterpret_cast<SymbolFunc *>(&e_book_query_to_string) },
+ { "e_book_query_field_exists", reinterpret_cast<SymbolFunc *>(&e_book_query_field_exists) }
};
-//>= 3.6 api
const ApiMap aNewApiMap[] =
{
- SYM_MAP( e_source_registry_list_sources ),
- SYM_MAP( e_source_registry_new_sync ),
- SYM_MAP( e_source_has_extension ),
- SYM_MAP( e_source_get_extension ),
- SYM_MAP( e_source_backend_get_backend_name ),
- SYM_MAP( e_source_get_display_name ),
- SYM_MAP( e_source_get_uid ),
- SYM_MAP( e_source_registry_ref_source),
- SYM_MAP( e_client_open_sync ),
- SYM_MAP( e_client_get_source ),
- SYM_MAP( e_book_client_get_contacts_sync ),
- SYM_MAP( e_client_util_free_object_slist )
-};
-
-//== indirect read access (3.6 only)
-const ApiMap aClientApiMap36[] =
-{
- SYM_MAP( e_book_client_new )
+ { "e_source_registry_list_sources", reinterpret_cast<SymbolFunc *>(&e_source_registry_list_sources) },
+ { "e_source_registry_new_sync", reinterpret_cast<SymbolFunc *>(&e_source_registry_new_sync) },
+ { "e_source_has_extension", reinterpret_cast<SymbolFunc *>(&e_source_has_extension) },
+ { "e_source_get_extension", reinterpret_cast<SymbolFunc *>(&e_source_get_extension) },
+ { "e_source_backend_get_backend_name", reinterpret_cast<SymbolFunc *>(&e_source_backend_get_backend_name) },
+ { "e_source_get_display_name", reinterpret_cast<SymbolFunc *>(&e_source_get_display_name) },
+ { "e_source_get_uid", reinterpret_cast<SymbolFunc *>(&e_source_get_uid) },
+ { "e_source_registry_ref_source", reinterpret_cast<SymbolFunc *>(&e_source_registry_ref_source) },
+ { "e_client_open_sync", reinterpret_cast<SymbolFunc *>(&e_client_open_sync) },
+ { "e_client_get_source", reinterpret_cast<SymbolFunc *>(&e_client_get_source) },
+ { "e_book_client_get_contacts_sync", reinterpret_cast<SymbolFunc *>(&e_book_client_get_contacts_sync) },
+ { "e_client_util_free_object_slist", reinterpret_cast<SymbolFunc *>(&e_client_util_free_object_slist) }
};
//>= direct read access API (>= 3.8)
const ApiMap aClientApiMap38[] =
{
- SYM_MAP( e_book_client_connect_direct_sync )
+ { "e_book_client_connect_direct_sync", reinterpret_cast<SymbolFunc *>(&e_book_client_connect_direct_sync) }
};
-#undef SYM_MAP
-
template<size_t N> static bool
tryLink( osl::Module &rModule, const char *pName, const ApiMap (&pMap)[N])
{
@@ -144,33 +112,14 @@ bool EApiInit()
if (tryLink( aModule, eBookLibNames[ j ], aCommonApiMap))
{
- if (eds_check_version( 3, 6, 0 ) != nullptr)
+ if (tryLink( aModule, eBookLibNames[ j ], aNewApiMap))
{
- if (tryLink( aModule, eBookLibNames[ j ], aOldApiMap))
+ if (tryLink( aModule, eBookLibNames[ j ], aClientApiMap38))
{
aModule.release();
return true;
}
}
- else if (tryLink( aModule, eBookLibNames[ j ], aNewApiMap))
- {
- if (eds_check_version( 3, 7, 6 ) != nullptr)
- {
- if (tryLink( aModule, eBookLibNames[ j ], aClientApiMap36))
- {
- aModule.release();
- return true;
- }
- }
- else
- {
- if (tryLink( aModule, eBookLibNames[ j ], aClientApiMap38))
- {
- aModule.release();
- return true;
- }
- }
- }
}
}
fprintf( stderr, "Can find no compliant libebook client libraries\n" );
diff --git a/connectivity/source/drivers/evoab2/EApi.h b/connectivity/source/drivers/evoab2/EApi.h
index 8c05f95fa2ce..a33bf9721de6 100644
--- a/connectivity/source/drivers/evoab2/EApi.h
+++ b/connectivity/source/drivers/evoab2/EApi.h
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_EAPI_H
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_EAPI_H
+#pragma once
#include <glib-object.h>
// Initializes the API below, returns false if not available
@@ -147,7 +146,7 @@ EAPI_EXTERN const gchar* (*eds_check_version) (guint required_major, guint requi
EAPI_EXTERN const gchar* (*e_source_get_uid) (ESource *source);
EAPI_EXTERN ESource* (*e_source_registry_ref_source) (ESourceRegistry *registry, const gchar *uid);
EAPI_EXTERN EBookClient* (*e_book_client_new) (ESource *source, GError **error);
-EAPI_EXTERN EBookClient* (*e_book_client_connect_direct_sync) (ESourceRegistry *registry, ESource *source, GCancellable *cancellable, GError **error);
+EAPI_EXTERN EBookClient* (*e_book_client_connect_direct_sync) (ESourceRegistry *registry, ESource *source, guint32 wait_for_connected_seconds, GCancellable *cancellable, GError **error);
EAPI_EXTERN gboolean (*e_client_open_sync) (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GError **error);
EAPI_EXTERN ESource* (*e_client_get_source) (EClient *client);
EAPI_EXTERN gboolean (*e_book_client_get_contacts_sync) (EBookClient *client, const gchar *sexp, GSList **contacts, GCancellable *cancellable, GError **error);
@@ -157,6 +156,7 @@ ESourceRegistry *get_e_source_registry();
bool isSourceBackend(ESource *pSource, const char *backendname);
G_END_DECLS
-#endif
+
+inline void object_unref(gpointer data, gpointer) { g_object_unref(data); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NCatalog.cxx b/connectivity/source/drivers/evoab2/NCatalog.cxx
index fb010b8dce5d..42c66f7f4542 100644
--- a/connectivity/source/drivers/evoab2/NCatalog.cxx
+++ b/connectivity/source/drivers/evoab2/NCatalog.cxx
@@ -26,11 +26,8 @@
using namespace connectivity::evoab;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OEvoabCatalog::OEvoabCatalog(OEvoabConnection* _pCon) :
connectivity::sdbcx::OCatalog(_pCon)
@@ -40,9 +37,9 @@ OEvoabCatalog::OEvoabCatalog(OEvoabConnection* _pCon) :
void OEvoabCatalog::refreshTables()
{
::std::vector< OUString> aVector;
- Sequence< OUString > aTypes { "TABLE" };
+ Sequence< OUString > aTypes { u"TABLE"_ustr };
Reference< XResultSet > xResult = m_xMetaData->getTables(
- Any(), "%", "%", aTypes);
+ Any(), u"%"_ustr, u"%"_ustr, aTypes);
if(xResult.is())
{
@@ -67,9 +64,8 @@ Reference< XNameAccess > SAL_CALL OEvoabCatalog::getTables( )
try
{
- if (!m_pTables) {
- refreshTables();
- }
+ if (!m_pTables)
+ refreshTables();
}
catch( const RuntimeException& )
{
diff --git a/connectivity/source/drivers/evoab2/NCatalog.hxx b/connectivity/source/drivers/evoab2/NCatalog.hxx
index d54ad68a2a9a..2b794c81202e 100644
--- a/connectivity/source/drivers/evoab2/NCatalog.hxx
+++ b/connectivity/source/drivers/evoab2/NCatalog.hxx
@@ -17,30 +17,27 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCATALOG_HXX
+#pragma once
#include <sdbcx/VCatalog.hxx>
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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCATALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NColumns.cxx b/connectivity/source/drivers/evoab2/NColumns.cxx
index 378e2af77634..a07e12d764d7 100644
--- a/connectivity/source/drivers/evoab2/NColumns.cxx
+++ b/connectivity/source/drivers/evoab2/NColumns.cxx
@@ -25,16 +25,12 @@
using namespace connectivity::sdbcx;
using namespace connectivity;
-using namespace ::comphelper;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace connectivity::evoab;
-sdbcx::ObjectType OEvoabColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OEvoabColumns::createObject(const OUString& _rName)
{
const Any aCatalog;
const OUString sCatalogName;
@@ -46,34 +42,32 @@ sdbcx::ObjectType OEvoabColumns::createObject(const OUString& _rName)
sTableName,
_rName);
- sdbcx::ObjectType xRet;
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
+ if (!xResult.is())
+ return nullptr;
- while (xResult->next())
+ rtl::Reference< OColumn > xRet;
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while (xResult->next())
+ {
+ if (xRow->getString(4) == _rName)
{
- if (xRow->getString(4) == _rName)
- {
- OColumn* pRet = new OColumn(
- _rName,
- xRow->getString(6),
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- xRow->getInt(7),
- xRow->getInt(9),
- xRow->getInt(5),
- false,
- false,
- false,
- true,
- sCatalogName,
- sSchemaName,
- sTableName);
- xRet = pRet;
- break;
- }
+ xRet = new OColumn(
+ _rName,
+ xRow->getString(6),
+ xRow->getString(13),
+ xRow->getString(12),
+ xRow->getInt(11),
+ xRow->getInt(7),
+ xRow->getInt(9),
+ xRow->getInt(5),
+ false,
+ false,
+ false,
+ true,
+ sCatalogName,
+ sSchemaName,
+ sTableName);
+ break;
}
}
diff --git a/connectivity/source/drivers/evoab2/NColumns.hxx b/connectivity/source/drivers/evoab2/NColumns.hxx
index be5996c6ebec..0f070e5ca8c8 100644
--- a/connectivity/source/drivers/evoab2/NColumns.hxx
+++ b/connectivity/source/drivers/evoab2/NColumns.hxx
@@ -17,31 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCOLUMNS_HXX
+#pragma once
#include "NTable.hxx"
#include <connectivity/sdbcx/VCollection.hxx>
namespace connectivity::evoab
{
- class OEvoabColumns final : public sdbcx::OCollection
- {
- OEvoabTable* m_pTable;
+ class OEvoabColumns final : public sdbcx::OCollection
+ {
+ OEvoabTable* m_pTable;
- virtual sdbcx::ObjectType 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)
+ { }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCOLUMNS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NConnection.cxx b/connectivity/source/drivers/evoab2/NConnection.cxx
index d586d6ba2df1..4c4d46e63fd8 100644
--- a/connectivity/source/drivers/evoab2/NConnection.cxx
+++ b/connectivity/source/drivers/evoab2/NConnection.cxx
@@ -24,6 +24,7 @@
#include "NPreparedStatement.hxx"
#include "NStatement.hxx"
#include <connectivity/dbexception.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <sal/log.hxx>
@@ -35,7 +36,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
OEvoabConnection::OEvoabConnection(OEvoabDriver const & _rDriver)
: m_rDriver(_rDriver)
@@ -56,7 +56,7 @@ OEvoabConnection::~OEvoabConnection()
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(OEvoabConnection, "com.sun.star.sdbc.drivers.evoab.Connection", "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(OEvoabConnection, u"com.sun.star.sdbc.drivers.evoab.Connection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
void OEvoabConnection::construct(const OUString& url, const Sequence< PropertyValue >& info)
@@ -117,8 +117,7 @@ css::uno::Reference< XTablesSupplier > OEvoabConnection::createCatalog()
Reference< XTablesSupplier > xTab = m_xCatalog;
if(!xTab.is())
{
- OEvoabCatalog *pCat = new OEvoabCatalog(this);
- xTab = pCat;
+ xTab = new OEvoabCatalog(this);
m_xCatalog = xTab;
}
return xTab;
@@ -129,10 +128,8 @@ Reference< XStatement > SAL_CALL OEvoabConnection::createStatement( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OStatement* pStmt = new OStatement(this);
-
- Reference< XStatement > xStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
+ Reference< XStatement > xStmt = new OStatement(this);
+ m_aStatements.push_back(WeakReferenceHelper(xStmt));
return xStmt;
}
@@ -141,17 +138,16 @@ Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareStatement( con
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OEvoabPreparedStatement* pStmt = new OEvoabPreparedStatement( this );
- Reference< XPreparedStatement > xStmt = pStmt;
+ rtl::Reference<OEvoabPreparedStatement> pStmt = new OEvoabPreparedStatement( this );
pStmt->construct( sql );
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xStmt;
+ return pStmt;
}
Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareCall( const OUString& /*sql*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::prepareCall"_ustr, *this );
return nullptr;
}
sal_Bool SAL_CALL OEvoabConnection::isClosed( )
@@ -193,7 +189,7 @@ void OEvoabConnection::disposing()
// -------------------------------- stubbed methods ------------------------------------------------
void SAL_CALL OEvoabConnection::setAutoCommit( sal_Bool /*autoCommit*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setAutoCommit", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setAutoCommit"_ustr, *this );
}
sal_Bool SAL_CALL OEvoabConnection::getAutoCommit( )
{
@@ -207,7 +203,7 @@ void SAL_CALL OEvoabConnection::rollback( )
}
void SAL_CALL OEvoabConnection::setReadOnly( sal_Bool /*readOnly*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setReadOnly", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setReadOnly"_ustr, *this );
}
sal_Bool SAL_CALL OEvoabConnection::isReadOnly( )
{
@@ -215,7 +211,7 @@ sal_Bool SAL_CALL OEvoabConnection::isReadOnly( )
}
void SAL_CALL OEvoabConnection::setCatalog( const OUString& /*catalog*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setCatalog", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setCatalog"_ustr, *this );
}
OUString SAL_CALL OEvoabConnection::getCatalog( )
@@ -224,7 +220,7 @@ OUString SAL_CALL OEvoabConnection::getCatalog( )
}
void SAL_CALL OEvoabConnection::setTransactionIsolation( sal_Int32 /*level*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setTransactionIsolation", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setTransactionIsolation"_ustr, *this );
}
sal_Int32 SAL_CALL OEvoabConnection::getTransactionIsolation( )
@@ -234,12 +230,12 @@ sal_Int32 SAL_CALL OEvoabConnection::getTransactionIsolation( )
Reference< css::container::XNameAccess > SAL_CALL OEvoabConnection::getTypeMap( )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::getTypeMap", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::getTypeMap"_ustr, *this );
return nullptr;
}
void SAL_CALL OEvoabConnection::setTypeMap( const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setTypeMap", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setTypeMap"_ustr, *this );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx
index ccd9fa7bc04c..77e3ea30b335 100644
--- a/connectivity/source/drivers/evoab2/NConnection.hxx
+++ b/connectivity/source/drivers/evoab2/NConnection.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCONNECTION_HXX
+#pragma once
#include "NDriver.hxx"
#include <com/sun/star/sdbc/SQLWarning.hpp>
@@ -33,77 +32,74 @@
namespace connectivity::evoab {
- 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
-
- 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;
-
- public:
- explicit OEvoabConnection( OEvoabDriver const & _rDriver );
- /// @throws css::sdbc::SQLException
- void construct(const OUString& _rUrl,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo );
-
- OString const & getPassword() const { return m_aPassword; }
- 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;}
-
- // OComponentHelper
- virtual void SAL_CALL disposing() override;
-
- // 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;
-
- // XCloseable
- virtual void SAL_CALL close( ) override;
- // XWarningsSupplier
- virtual css::uno::Any SAL_CALL getWarnings( ) override;
- virtual void SAL_CALL clearWarnings( ) override;
- };
+ 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
+
+ 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;
+
+ 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; }
+
+ 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;
+
+ // 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;
+
+ // XCloseable
+ virtual void SAL_CALL close( ) override;
+ // XWarningsSupplier
+ virtual css::uno::Any SAL_CALL getWarnings( ) override;
+ virtual void SAL_CALL clearWarnings( ) override;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NCONNECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index 5e84a27e13fb..060c4480bd87 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -23,6 +23,7 @@
#include <connectivity/dbexception.hxx>
#include <connectivity/FValue.hxx>
#include <com/sun/star/sdbc/ColumnSearch.hpp>
+#include <rtl/ref.hxx>
#include <cstddef>
#include <string.h>
@@ -33,10 +34,7 @@
using namespace connectivity::evoab;
using namespace connectivity;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
namespace
{
@@ -192,9 +190,9 @@ namespace connectivity::evoab
switch( getFieldType( nCol ) )
{
case DataType::BIT:
- return "BIT";
+ return u"BIT"_ustr;
case DataType::VARCHAR:
- return "VARCHAR";
+ return u"VARCHAR"_ustr;
default:
break;
}
@@ -252,8 +250,14 @@ OEvoabDatabaseMetaData::~OEvoabDatabaseMetaData()
}
-ODatabaseMetaDataResultSet::ORows OEvoabDatabaseMetaData::getColumnRows( const OUString& columnNamePattern )
+Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
+ const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*tableNamePattern*/,
+ const OUString& columnNamePattern )
{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
+
ODatabaseMetaDataResultSet::ORows aRows;
ODatabaseMetaDataResultSet::ORow aRow(19);
@@ -286,14 +290,14 @@ ODatabaseMetaDataResultSet::ORows OEvoabDatabaseMetaData::getColumnRows( const O
// CHAR_OCTET_LENGTH, refer to [5]
aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH);
// IS_NULLABLE
- aRow[18] = new ORowSetValueDecorator(OUString("YES"));
+ aRow[18] = new ORowSetValueDecorator(u"YES"_ustr);
- aRow[3] = new ORowSetValueDecorator(OUString("TABLE"));
+ aRow[3] = new ORowSetValueDecorator(u"TABLE"_ustr);
::osl::MutexGuard aGuard( m_aMutex );
initFields();
- for (sal_Int32 i = 0; i < static_cast<sal_Int32>(nFields); i++)
+ for (guint i = 0; i < nFields; i++)
{
if( match( columnNamePattern, getFieldName( i ), '\0' ) )
{
@@ -303,12 +307,14 @@ ODatabaseMetaDataResultSet::ORows OEvoabDatabaseMetaData::getColumnRows( const O
// COLUMN_NAME
aRow[4] = new ORowSetValueDecorator( getFieldName( i ) );
// ORDINAL_POSITION
- aRow[17] = new ORowSetValueDecorator( i );
+ aRow[17] = new ORowSetValueDecorator( sal_Int32(i) );
aRows.push_back( aRow );
}
}
- return aRows ;
+ pResultSet->setRows(std::move(aRows));
+
+ return pResultSet;
}
OUString OEvoabDatabaseMetaData::impl_getCatalogSeparator_throw( )
@@ -441,7 +447,7 @@ OUString SAL_CALL OEvoabDatabaseMetaData::getCatalogTerm( )
OUString OEvoabDatabaseMetaData::impl_getIdentifierQuoteString_throw( )
{
// normally this is "
- return "\"";
+ return u"\""_ustr;
}
OUString SAL_CALL OEvoabDatabaseMetaData::getExtraNameCharacters( )
@@ -797,12 +803,12 @@ OUString SAL_CALL OEvoabDatabaseMetaData::getDriverName( )
OUString SAL_CALL OEvoabDatabaseMetaData::getDriverVersion()
{
- return "1";
+ return u"1"_ustr;
}
OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductVersion( )
{
- return "0";
+ return u"0"_ustr;
}
OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductName( )
@@ -984,23 +990,19 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( )
{
u"TABLE" // Currently we only support a 'TABLE' nothing more complex
};
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
// here we fill the rows which should be visible when ask for data from the resultset returned here
+ auto nNbTypes = std::size(sTableTypes);
ODatabaseMetaDataResultSet::ORows aRows;
- for(std::size_t i=0;i < SAL_N_ELEMENTS(sTableTypes);++i)
+ for(std::size_t i=0;i < nNbTypes;++i)
{
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(OUString(sTableTypes[i])));
-
// bound row
- aRows.push_back(aRow);
+ aRows.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(OUString(sTableTypes[i])) });
}
// here we set the rows at the resultset
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( )
@@ -1009,60 +1011,46 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( )
* Return the proper type information required by evo driver
*/
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xResultSet = pResultSet;
static ODatabaseMetaDataResultSet::ORows aRows = []()
{
ODatabaseMetaDataResultSet::ORows tmp;
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.reserve(19);
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(OUString("VARCHAR")));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(s_nCHAR_OCTET_LENGTH)));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(10)));
+ ODatabaseMetaDataResultSet::ORow aRow
+ {
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ new ORowSetValueDecorator(u"VARCHAR"_ustr) ,
+ new ORowSetValueDecorator(DataType::VARCHAR) ,
+ new ORowSetValueDecorator(sal_Int32(s_nCHAR_OCTET_LENGTH)) ,
+ ODatabaseMetaDataResultSet::getQuoteValue() ,
+ ODatabaseMetaDataResultSet::getQuoteValue() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ ODatabaseMetaDataResultSet::get1Value() ,
+ ODatabaseMetaDataResultSet::get1Value() ,
+ new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)) ,
+ ODatabaseMetaDataResultSet::get1Value() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ new ORowSetValueDecorator(sal_Int32(10))
+ };
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR"));
+ aRow[1] = new ORowSetValueDecorator(u"VARCHAR"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
aRow[3] = new ORowSetValueDecorator(sal_Int32(65535));
tmp.push_back(aRow);
return tmp;
}();
- pResultSet->setRows(aRows);
- return xResultSet;
-}
-
-Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
- const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*tableNamePattern*/,
- const OUString& columnNamePattern )
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
- Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( getColumnRows( columnNamePattern ) );
- return xResultSet;
+ pResultSet->setRows(std::move(aRows));
+ return pResultSet;
}
-
bool isSourceBackend(ESource *pSource, const char *backendname)
{
if (!pSource || !e_source_has_extension (pSource, E_SOURCE_EXTENSION_ADDRESS_BOOK))
@@ -1078,141 +1066,87 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
// check if any type is given
// when no types are given then we have to return all tables e.g. TABLE
- const OUString aTable("TABLE");
+ static constexpr OUString aTable(u"TABLE"_ustr);
bool bTableFound = true;
sal_Int32 nLength = types.getLength();
if(nLength)
- {
- bTableFound = false;
-
- const OUString* pBegin = types.getConstArray();
- const OUString* pEnd = pBegin + nLength;
- for(;pBegin != pEnd;++pBegin)
- {
- if(*pBegin == aTable)
- {
- bTableFound = true;
- break;
- }
- }
- }
- if(!bTableFound)
- return xRef;
-
- ODatabaseMetaDataResultSet::ORows aRows;
-
- if (eds_check_version(3, 6, 0) == nullptr)
{
- GList *pSources = e_source_registry_list_sources(get_e_source_registry(), E_SOURCE_EXTENSION_ADDRESS_BOOK);
+ bTableFound = false;
- for (GList* liter = pSources; liter; liter = liter->next)
+ const OUString* pBegin = types.getConstArray();
+ const OUString* pEnd = pBegin + nLength;
+ for(;pBegin != pEnd;++pBegin)
{
- ESource *pSource = E_SOURCE (liter->data);
- bool can = false;
- switch (m_pConnection->getSDBCAddressType())
+ if(*pBegin == aTable)
{
- case SDBCAddress::EVO_GWISE:
- can = isSourceBackend( pSource, "groupwise"); // not supported in evo/eds 3.6.x+, somehow
- break;
- case SDBCAddress::EVO_LOCAL:
- can = isSourceBackend( pSource, "local");
- break;
- case SDBCAddress::EVO_LDAP:
- can = isSourceBackend( pSource, "ldap");
- break;
- case SDBCAddress::Unknown:
- can = true;
- break;
+ bTableFound = true;
+ break;
}
- if (!can)
- continue;
-
- OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ),
- RTL_TEXTENCODING_UTF8 );
- OUString aUID = OStringToOUString( e_source_get_uid( pSource ),
- RTL_TEXTENCODING_UTF8 );
- ODatabaseMetaDataResultSet::ORow aRow{
- ORowSetValueDecoratorRef(),
- ORowSetValueDecoratorRef(),
- ORowSetValueDecoratorRef(),
- new ORowSetValueDecorator(aHumanName), //tablename
- new ORowSetValueDecorator(aTable),
- new ORowSetValueDecorator(aUID)}; //comment
- //I'd prefer to swap the comment and the human name and
- //just use e_source_registry_ref_source(get_e_source_registry(), aUID);
- //in open book rather than search for the name again
- aRows.push_back(aRow);
}
-
- g_list_foreach (pSources, reinterpret_cast<GFunc>(g_object_unref), nullptr);
- g_list_free (pSources);
}
- else
- {
- ESourceList *pSourceList;
- if( !e_book_get_addressbooks (&pSourceList, nullptr) )
- pSourceList = nullptr;
+ if(!bTableFound)
+ return pResult;
- GSList *g;
- for( g = e_source_list_peek_groups( pSourceList ); g; g = g->next)
- {
- GSList *s;
- const char *p = e_source_group_peek_base_uri(E_SOURCE_GROUP(g->data));
+ ODatabaseMetaDataResultSet::ORows aRows;
- switch (m_pConnection->getSDBCAddressType()) {
+ GList *pSources = e_source_registry_list_sources(get_e_source_registry(), E_SOURCE_EXTENSION_ADDRESS_BOOK);
+
+ for (GList* liter = pSources; liter; liter = liter->next)
+ {
+ ESource *pSource = E_SOURCE (liter->data);
+ bool can = false;
+ switch (m_pConnection->getSDBCAddressType())
+ {
case SDBCAddress::EVO_GWISE:
- if ( !strncmp( "groupwise://", p, 11 ))
- break;
- else
- continue;
+ can = isSourceBackend( pSource, "groupwise"); // not supported in evo/eds 3.6.x+, somehow
+ break;
case SDBCAddress::EVO_LOCAL:
- if ( !strncmp( "file://", p, 6 ) ||
- !strncmp( "local://", p, 6 ) )
- break;
- else
- continue;
+ can = isSourceBackend( pSource, "local");
+ break;
case SDBCAddress::EVO_LDAP:
- if ( !strncmp( "ldap://", p, 6 ))
- break;
- else
- continue;
+ can = isSourceBackend( pSource, "ldap");
+ break;
case SDBCAddress::Unknown:
+ can = true;
break;
- }
- for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); s; s = s->next)
- {
- ESource *pSource = E_SOURCE (s->data);
-
- OUString aName = OStringToOUString( e_source_peek_name( pSource ),
- RTL_TEXTENCODING_UTF8 );
-
- ODatabaseMetaDataResultSet::ORow aRow{
- ORowSetValueDecoratorRef(),
- ORowSetValueDecoratorRef(),
- ORowSetValueDecoratorRef(),
- new ORowSetValueDecorator(aName),
- new ORowSetValueDecorator(aTable),
- ODatabaseMetaDataResultSet::getEmptyValue()};
- aRows.push_back(aRow);
- }
}
+ if (!can)
+ continue;
+
+ OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ),
+ RTL_TEXTENCODING_UTF8 );
+ OUString aUID = OStringToOUString( e_source_get_uid( pSource ),
+ RTL_TEXTENCODING_UTF8 );
+ ODatabaseMetaDataResultSet::ORow aRow{
+ ORowSetValueDecoratorRef(),
+ ORowSetValueDecoratorRef(),
+ ORowSetValueDecoratorRef(),
+ new ORowSetValueDecorator(aHumanName), //tablename
+ new ORowSetValueDecorator(ORowSetValue(aTable)),
+ new ORowSetValueDecorator(aUID)}; //comment
+ //I'd prefer to swap the comment and the human name and
+ //just use e_source_registry_ref_source(get_e_source_registry(), aUID);
+ //in open book rather than search for the name again
+ aRows.push_back(aRow);
}
- pResult->setRows(aRows);
+ g_list_foreach (pSources, object_unref, nullptr);
+ g_list_free (pSources);
+
+ pResult->setRows(std::move(aRows));
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XDatabaseMetaDaza::getUDTs", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XDatabaseMetaDaza::getUDTs"_ustr, *this );
return nullptr;
}
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
index cbfed176fabc..333594bf3741 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NDATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NDATABASEMETADATA_HXX
+#pragma once
#include <sal/config.h>
@@ -32,192 +31,188 @@
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;
-
- ODatabaseMetaDataResultSet::ORows getColumnRows( const OUString& columnNamePattern );
-
- 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NDATABASEMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx
index b8e3c4d4ff88..83934b6b3e1a 100644
--- a/connectivity/source/drivers/evoab2/NDriver.cxx
+++ b/connectivity/source/drivers/evoab2/NDriver.cxx
@@ -23,6 +23,7 @@
#include <connectivity/dbexception.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <rtl/ref.hxx>
#include <strings.hrc>
#include <resource/sharedresources.hxx>
@@ -30,10 +31,8 @@ using namespace osl;
using namespace connectivity::evoab;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ucb;
OEvoabDriver::OEvoabDriver(const Reference< XComponentContext >& _rxContext) :
@@ -52,7 +51,7 @@ void OEvoabDriver::disposing()
// when driver will be destroyed so all our connections have to be destroyed as well
for (const auto& rxConnection : m_xConnections)
{
- Reference< XComponent > xComp(rxConnection.get(), UNO_QUERY);
+ rtl::Reference< OEvoabConnection > xComp(rxConnection);
if (xComp.is())
{
try
@@ -66,7 +65,6 @@ void OEvoabDriver::disposing()
}
}
m_xConnections.clear();
- connectivity::OWeakRefArray().swap(m_xConnections); // this really clears
ODriver_BASE::disposing();
}
@@ -90,7 +88,7 @@ Sequence< OUString > SAL_CALL OEvoabDriver::getSupportedServiceNames( )
{
// which service is supported
// for more information @see com.sun.star.sdbc.Driver
- return { "com.sun.star.sdbc.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr };
}
@@ -103,12 +101,11 @@ Reference< XConnection > SAL_CALL OEvoabDriver::connect( const OUString& url, co
if ( ! acceptsURL(url) )
return nullptr;
- OEvoabConnection* pCon = new OEvoabConnection( *this );
+ rtl::Reference<OEvoabConnection> pCon = new OEvoabConnection( *this );
pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon);
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL OEvoabDriver::acceptsURL( const OUString& url )
diff --git a/connectivity/source/drivers/evoab2/NDriver.hxx b/connectivity/source/drivers/evoab2/NDriver.hxx
index 2780a05ec34d..e144e61d2987 100644
--- a/connectivity/source/drivers/evoab2/NDriver.hxx
+++ b/connectivity/source/drivers/evoab2/NDriver.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NDRIVER_HXX
+#pragma once
#include <sal/config.h>
@@ -28,50 +27,51 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/compbase.hxx>
#include <connectivity/CommonTools.hxx>
+#include <unotools/weakref.hxx>
-#define EVOAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.evoab.OEvoabDriver"
+inline constexpr OUString EVOAB_DRIVER_IMPL_NAME = u"com.sun.star.comp.sdbc.evoab.OEvoabDriver"_ustr;
namespace connectivity::evoab
- {
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver,
- css::lang::XServiceInfo > ODriver_BASE;
+{
+ class OEvoabConnection;
+
+ typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver,
+ css::lang::XServiceInfo > ODriver_BASE;
- class OEvoabDriver final : public ODriver_BASE
- {
- ::osl::Mutex m_aMutex;
- connectivity::OWeakRefArray 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:
- 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 );
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NDRIVER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
index 57981e95e82d..f518122ebfcd 100644
--- a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
+++ b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
@@ -21,26 +21,24 @@
#include "NPreparedStatement.hxx"
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
+#include <rtl/ref.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <strings.hrc>
using namespace connectivity::evoab;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
-IMPLEMENT_SERVICE_INFO(OEvoabPreparedStatement,"com.sun.star.sdbcx.evoab.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(OEvoabPreparedStatement,u"com.sun.star.sdbcx.evoab.PreparedStatement"_ustr,u"com.sun.star.sdbc.PreparedStatement"_ustr);
OEvoabPreparedStatement::OEvoabPreparedStatement( OEvoabConnection* _pConnection )
:OCommonStatement(_pConnection)
- ,m_sSqlStatement()
- ,m_xMetaData()
{
}
@@ -54,7 +52,8 @@ void OEvoabPreparedStatement::construct( const OUString& _sql )
ENSURE_OR_THROW( m_aQueryData.xSelectColumns.is(), "no SelectColumn" );
// create our meta data
- OEvoabResultSetMetaData* pMeta = new OEvoabResultSetMetaData( m_aQueryData.sTable );
+ rtl::Reference<OEvoabResultSetMetaData> pMeta
+ = new OEvoabResultSetMetaData( m_aQueryData.sTable );
m_xMetaData = pMeta;
pMeta->setEvoabFields( m_aQueryData.xSelectColumns );
}
@@ -65,13 +64,13 @@ OEvoabPreparedStatement::~OEvoabPreparedStatement()
}
-void SAL_CALL OEvoabPreparedStatement::acquire() throw()
+void SAL_CALL OEvoabPreparedStatement::acquire() noexcept
{
OCommonStatement::acquire();
}
-void SAL_CALL OEvoabPreparedStatement::release() throw()
+void SAL_CALL OEvoabPreparedStatement::release() noexcept
{
OCommonStatement::release();
}
@@ -134,14 +133,14 @@ sal_Int32 SAL_CALL OEvoabPreparedStatement::executeUpdate( )
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XStatement::executeUpdate", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XStatement::executeUpdate"_ustr, *this );
return 0;
}
void SAL_CALL OEvoabPreparedStatement::setString( sal_Int32 /*parameterIndex*/, const OUString& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setString", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setString"_ustr, *this );
}
@@ -165,97 +164,97 @@ Reference< XResultSet > SAL_CALL OEvoabPreparedStatement::executeQuery( )
void SAL_CALL OEvoabPreparedStatement::setBoolean( sal_Int32 /*parameterIndex*/, sal_Bool /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setBoolean", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBoolean"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setByte( sal_Int32 /*parameterIndex*/, sal_Int8 /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setByte", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setByte"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setDate( sal_Int32 /*parameterIndex*/, const Date& /*aData*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setDate", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setDate"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setTime( sal_Int32 /*parameterIndex*/, const css::util::Time& /*aVal*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setTime", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setTime"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setTimestamp( sal_Int32 /*parameterIndex*/, const DateTime& /*aVal*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setTimestamp", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setTimestamp"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setDouble( sal_Int32 /*parameterIndex*/, double /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setDouble", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setDouble"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setFloat( sal_Int32 /*parameterIndex*/, float /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setFloat", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setFloat"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setInt( sal_Int32 /*parameterIndex*/, sal_Int32 /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setInt", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setInt"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setLong", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setLong"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setNull( sal_Int32 /*parameterIndex*/, sal_Int32 /*sqlType*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setNull", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setNull"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setClob", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setClob"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setBlob", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBlob"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setArray", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setArray"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setRef", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setRef"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setObjectWithInfo( sal_Int32 /*parameterIndex*/, const Any& /*x*/, sal_Int32 /*sqlType*/, sal_Int32 /*scale*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setObjectWithInfo", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setObjectWithInfo"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setObjectNull( sal_Int32 /*parameterIndex*/, sal_Int32 /*sqlType*/, const OUString& /*typeName*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setObjectNull", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setObjectNull"_ustr, *this );
}
@@ -274,25 +273,25 @@ void SAL_CALL OEvoabPreparedStatement::setObject( sal_Int32 parameterIndex, cons
void SAL_CALL OEvoabPreparedStatement::setShort( sal_Int32 /*parameterIndex*/, sal_Int16 /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setShort", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setShort"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, const Sequence< sal_Int8 >& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setBytes", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBytes"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setCharacterStream", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setCharacterStream"_ustr, *this );
}
void SAL_CALL OEvoabPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setBinaryStream", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBinaryStream"_ustr, *this );
}
diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
index 62e79cb335f4..22463c0ee2d4 100644
--- a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
+++ b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NPREPAREDSTATEMENT_HXX
+#pragma once
#include "NStatement.hxx"
#include "NConnection.hxx"
@@ -34,79 +33,76 @@
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
- css::uno::Reference< css::sdbc::XResultSetMetaData > 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 );
- private:
- DECLARE_SERVICE_INFO();
- //XInterface
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NPREPAREDSTATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
index a9c73a65b740..95a25d664602 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -36,7 +36,7 @@
#include <connectivity/sqlerror.hxx>
#include <rtl/string.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/intlwrapper.hxx>
#include <unotools/collatorwrapper.hxx>
@@ -51,7 +51,6 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition;
@@ -59,12 +58,12 @@ namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition;
OUString SAL_CALL OEvoabResultSet::getImplementationName( )
{
- return "com.sun.star.sdbcx.evoab.ResultSet";
+ return u"com.sun.star.sdbcx.evoab.ResultSet"_ustr;
}
Sequence< OUString > SAL_CALL OEvoabResultSet::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.ResultSet" };
+ return { u"com.sun.star.sdbc.ResultSet"_ustr };
}
sal_Bool SAL_CALL OEvoabResultSet::supportsService( const OUString& _rServiceName )
@@ -88,7 +87,7 @@ static OUString
valueToOUString( GValue& _rValue )
{
const char *pStr = g_value_get_string( &_rValue );
- OString aStr( pStr ? pStr : "" );
+ std::string_view aStr( pStr ? pStr : "" );
OUString sResult( OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 ) );
g_value_unset( &_rValue );
return sResult;
@@ -308,6 +307,10 @@ static int CompareContacts( gconstpointer _lhs, gconstpointer _rhs, gpointer _us
for ( const auto& sortCol : rCompData.rSortOrder )
{
sal_Int32 nField = sortCol.nField;
+ int nOrder = 1;
+ // if descending sort, reverse order
+ if (!sortCol.bAscending)
+ nOrder = -1;
GType eFieldType = evoab::getGFieldType( nField );
bool success = getValue( lhs, nField, eFieldType, &aLhsValue, bLhsNull )
@@ -317,9 +320,9 @@ static int CompareContacts( gconstpointer _lhs, gconstpointer _rhs, gpointer _us
return 0;
if ( bLhsNull && !bRhsNull )
- return -1;
+ return -1 * nOrder;
if ( !bLhsNull && bRhsNull )
- return 1;
+ return 1 * nOrder;
if ( bLhsNull && bRhsNull )
continue;
@@ -329,16 +332,16 @@ static int CompareContacts( gconstpointer _lhs, gconstpointer _rhs, gpointer _us
sRhs = valueToOUString( aRhsValue );
sal_Int32 nCompResult = rCompData.aIntlWrapper.getCaseCollator()->compareString( sLhs, sRhs );
if ( nCompResult != 0 )
- return nCompResult;
+ return nCompResult * nOrder;
continue;
}
bLhs = valueToBool( aLhsValue );
bRhs = valueToBool( aRhsValue );
if ( bLhs && !bRhs )
- return -1;
+ return -1 * nOrder;
if ( !bLhs && bRhs )
- return 1;
+ return 1 * nOrder;
continue;
}
@@ -398,7 +401,7 @@ public:
break;
}
}
- g_list_foreach (pSources, reinterpret_cast<GFunc>(g_object_unref), nullptr);
+ g_list_foreach (pSources, object_unref, nullptr);
g_list_free (pSources);
if (!id)
return nullptr;
@@ -431,7 +434,7 @@ public:
m_pContacts = nullptr;
}
- virtual void executeQuery (EBook* pBook, EBookQuery* pQuery, OString &/*rPassword*/) override
+ virtual void executeQuery (EBook* pBook, EBookQuery* pQuery) override
{
freeContacts();
char *sexp = e_book_query_to_string( pQuery );
@@ -476,123 +479,7 @@ class OEvoabVersion38Helper : public OEvoabVersion36Helper
protected:
virtual EBookClient * createClient( ESource *pSource ) override
{
- return e_book_client_connect_direct_sync (get_e_source_registry (), pSource, nullptr, nullptr);
- }
-};
-
-ESource * findSource( const char *id )
-{
- ESourceList *pSourceList = nullptr;
-
- g_return_val_if_fail (id != nullptr, nullptr);
-
- if (!e_book_get_addressbooks (&pSourceList, nullptr))
- pSourceList = nullptr;
-
- for ( GSList *g = e_source_list_peek_groups (pSourceList); g; g = g->next)
- {
- for (GSList *s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); s; s = s->next)
- {
- ESource *pSource = E_SOURCE (s->data);
- if (!strcmp (e_source_peek_name (pSource), id))
- return pSource;
- }
- }
- return nullptr;
-}
-
-bool isAuthRequired( EBook *pBook )
-{
- return e_source_get_property( e_book_get_source( pBook ),
- "auth" ) != nullptr;
-}
-
-class OEvoabVersion35Helper : public OEvoabVersionHelper
-{
-private:
- GList *m_pContacts;
-
-public:
- OEvoabVersion35Helper()
- : m_pContacts(nullptr)
- {
- }
-
- virtual ~OEvoabVersion35Helper() override
- {
- freeContacts();
- }
-
- virtual EBook* openBook(const char *abname) override
- {
- ESource *pSource = findSource (abname);
- EBook *pBook = pSource ? e_book_new (pSource, nullptr) : nullptr;
- if (pBook && !e_book_open (pBook, true, nullptr))
- {
- g_object_unref (G_OBJECT (pBook));
- pBook = nullptr;
- }
- return pBook;
- }
-
- virtual bool isLDAP( EBook *pBook ) override
- {
- return pBook && !strncmp( "ldap://", e_book_get_uri( pBook ), 6 );
- }
-
- virtual bool isLocal( EBook *pBook ) override
- {
- return pBook && ( !strncmp( "file://", e_book_get_uri( pBook ), 6 ) ||
- !strncmp( "local:", e_book_get_uri( pBook ), 6 ) );
- }
-
- virtual void freeContacts() override final
- {
- g_list_free(m_pContacts);
- m_pContacts = nullptr;
- }
-
- virtual void executeQuery (EBook* pBook, EBookQuery* pQuery, OString &rPassword) override
- {
- freeContacts();
-
- ESource *pSource = e_book_get_source( pBook );
- bool bAuthSuccess = true;
-
- if( isAuthRequired( pBook ) )
- {
- OString aUser( getUserName( pBook ) );
- const char *pAuth = e_source_get_property( pSource, "auth" );
- bAuthSuccess = e_book_authenticate_user( pBook, aUser.getStr(), rPassword.getStr(), pAuth, nullptr );
- }
-
- if (bAuthSuccess)
- e_book_get_contacts( pBook, pQuery, &m_pContacts, nullptr );
- }
-
- virtual EContact *getContact(sal_Int32 nIndex) override
- {
- gpointer pData = g_list_nth_data (m_pContacts, nIndex);
- return pData ? E_CONTACT (pData) : nullptr;
- }
-
- virtual sal_Int32 getNumContacts() override
- {
- return g_list_length( m_pContacts );
- }
-
- virtual bool hasContacts() override
- {
- return m_pContacts != nullptr;
- }
-
- virtual void sortContacts( const ComparisonData& _rCompData ) override
- {
- OSL_ENSURE( !_rCompData.rSortOrder.empty(), "sortContacts: no need to call this without any sort order!" );
- ENSURE_OR_THROW( _rCompData.aIntlWrapper.getCaseCollator(), "no collator for comparing strings" );
-
- m_pContacts = g_list_sort_with_data( m_pContacts, &CompareContacts,
- const_cast< gpointer >( static_cast< gconstpointer >( &_rCompData ) ) );
+ return e_book_client_connect_direct_sync (get_e_source_registry (), pSource, 10, nullptr, nullptr);
}
};
@@ -611,26 +498,36 @@ OEvoabResultSet::OEvoabResultSet( OCommonStatement* pStmt, OEvoabConnection *pCo
,m_nIndex(-1)
,m_nLength(0)
{
- if (eds_check_version( 3, 7, 6 ) == nullptr)
- m_pVersionHelper = std::make_unique<OEvoabVersion38Helper>();
- else if (eds_check_version( 3, 6, 0 ) == nullptr)
- m_pVersionHelper = std::make_unique<OEvoabVersion36Helper>();
- else
- m_pVersionHelper = std::make_unique<OEvoabVersion35Helper>();
+ m_pVersionHelper = std::make_unique<OEvoabVersion38Helper>();
- #define REGISTER_PROP( id, member ) \
- registerProperty( \
- OMetaConnection::getPropMap().getNameByIndex( id ), \
- id, \
- PropertyAttribute::READONLY, \
- &member, \
- cppu::UnoType<decltype(member)>::get() \
- );
-
- REGISTER_PROP( PROPERTY_ID_FETCHSIZE, m_nFetchSize );
- REGISTER_PROP( PROPERTY_ID_RESULTSETTYPE, m_nResultSetType );
- REGISTER_PROP( PROPERTY_ID_FETCHDIRECTION, m_nFetchDirection );
- REGISTER_PROP( PROPERTY_ID_RESULTSETCONCURRENCY, m_nResultSetConcurrency );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ PropertyAttribute::READONLY,
+ &m_nFetchSize,
+ cppu::UnoType<decltype(m_nFetchSize)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ PropertyAttribute::READONLY,
+ &m_nResultSetType,
+ cppu::UnoType<decltype(m_nResultSetType)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ PropertyAttribute::READONLY,
+ &m_nFetchDirection,
+ cppu::UnoType<decltype(m_nFetchDirection)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ PropertyAttribute::READONLY,
+ &m_nResultSetConcurrency,
+ cppu::UnoType<decltype(m_nResultSetConcurrency)>::get()
+ );
}
OEvoabResultSet::~OEvoabResultSet()
@@ -672,9 +569,7 @@ void OEvoabResultSet::construct( const QueryData& _rData )
}
if ( bExecuteQuery )
{
- OString aPassword = m_pConnection->getPassword();
- m_pVersionHelper->executeQuery(pBook, _rData.getQuery(), aPassword);
- m_pConnection->setPassword( aPassword );
+ m_pVersionHelper->executeQuery(pBook, _rData.getQuery());
if ( m_pVersionHelper->hasContacts() && !_rData.aSortOrder.empty() )
{
@@ -762,103 +657,103 @@ sal_Bool SAL_CALL OEvoabResultSet::getBoolean( sal_Int32 nColumnNum )
sal_Int64 SAL_CALL OEvoabResultSet::getLong( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getLong", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getLong"_ustr, *this );
return sal_Int64();
}
Reference< XArray > SAL_CALL OEvoabResultSet::getArray( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getArray", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getArray"_ustr, *this );
return nullptr;
}
Reference< XClob > SAL_CALL OEvoabResultSet::getClob( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getClob", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getClob"_ustr, *this );
return nullptr;
}
Reference< XBlob > SAL_CALL OEvoabResultSet::getBlob( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBlob", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBlob"_ustr, *this );
return nullptr;
}
Reference< XRef > SAL_CALL OEvoabResultSet::getRef( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getRef", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getRef"_ustr, *this );
return nullptr;
}
Any SAL_CALL OEvoabResultSet::getObject( sal_Int32 /*nColumnNum*/, const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getObject", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getObject"_ustr, *this );
return Any();
}
sal_Int16 SAL_CALL OEvoabResultSet::getShort( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getShort", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getShort"_ustr, *this );
return 0;
}
css::util::Time SAL_CALL OEvoabResultSet::getTime( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getTime", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getTime"_ustr, *this );
return css::util::Time();
}
util::DateTime SAL_CALL OEvoabResultSet::getTimestamp( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getTimestamp", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getTimestamp"_ustr, *this );
return css::util::DateTime();
}
Reference< XInputStream > SAL_CALL OEvoabResultSet::getBinaryStream( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBinaryStream", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBinaryStream"_ustr, *this );
return nullptr;
}
Reference< XInputStream > SAL_CALL OEvoabResultSet::getCharacterStream( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getCharacterStream", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getCharacterStream"_ustr, *this );
return nullptr;
}
sal_Int8 SAL_CALL OEvoabResultSet::getByte( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getByte", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getByte"_ustr, *this );
return 0;
}
Sequence< sal_Int8 > SAL_CALL OEvoabResultSet::getBytes( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBytes", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBytes"_ustr, *this );
return Sequence< sal_Int8 >();
}
css::util::Date SAL_CALL OEvoabResultSet::getDate( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getDate", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getDate"_ustr, *this );
return css::util::Date();
}
double SAL_CALL OEvoabResultSet::getDouble( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getDouble", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getDouble"_ustr, *this );
return 0;
}
float SAL_CALL OEvoabResultSet::getFloat( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getFloat", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getFloat"_ustr, *this );
return 0;
}
sal_Int32 SAL_CALL OEvoabResultSet::getInt( sal_Int32 /*nColumnNum*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getInt", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getInt"_ustr, *this );
return 0;
}
// XRow Interface Ends
@@ -872,7 +767,7 @@ Reference< XResultSetMetaData > SAL_CALL OEvoabResultSet::getMetaData( )
// the meta data should have been created at construction time
ENSURE_OR_THROW( m_xMetaData.is(), "internal error: no meta data" );
- return m_xMetaData.get();
+ return m_xMetaData;
}
// XResultSetMetaDataSupplier Interface Ends
@@ -1016,8 +911,7 @@ Reference< XInterface > SAL_CALL OEvoabResultSet::getStatement( )
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- css::uno::WeakReferenceHelper aStatement(static_cast<OWeakObject*>(m_pStatement));
- return aStatement.get();
+ return cppu::getXWeak(m_pStatement);
}
@@ -1119,12 +1013,12 @@ sal_Int32 SAL_CALL OEvoabResultSet::findColumn( const OUString& columnName )
return *getArrayHelper();
}
-void SAL_CALL OEvoabResultSet::acquire() throw()
+void SAL_CALL OEvoabResultSet::acquire() noexcept
{
OResultSet_BASE::acquire();
}
-void SAL_CALL OEvoabResultSet::release() throw()
+void SAL_CALL OEvoabResultSet::release() noexcept
{
OResultSet_BASE::release();
}
diff --git a/connectivity/source/drivers/evoab2/NResultSet.hxx b/connectivity/source/drivers/evoab2/NResultSet.hxx
index 034dcc439de0..659fa4ff4b20 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.hxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NRESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NRESULTSET_HXX
+#pragma once
#include <memory>
@@ -44,142 +43,140 @@
namespace connectivity::evoab
{
- struct ComparisonData;
-
- class OEvoabVersionHelper
- {
- public:
- virtual EBook* openBook(const char *abname) = 0;
- virtual void executeQuery (EBook* pBook, EBookQuery* pQuery, OString &rPassword) = 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NRESULTSET_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
index 7f196bed35e7..a828b127fe68 100644
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
@@ -21,15 +21,14 @@
#include "NDatabaseMetaData.hxx"
#include <connectivity/dbexception.hxx>
#include <strings.hrc>
+#include <utility>
using namespace connectivity::evoab;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
using namespace com::sun::star::sdbc;
-OEvoabResultSetMetaData::OEvoabResultSetMetaData(const OUString& _aTableName)
- : m_aTableName(_aTableName),
- m_aEvoabFields()
+OEvoabResultSetMetaData::OEvoabResultSetMetaData(OUString _aTableName)
+ : m_aTableName(std::move(_aTableName))
{
}
@@ -102,15 +101,7 @@ OUString SAL_CALL OEvoabResultSetMetaData::getColumnTypeName( sal_Int32 nColumnN
OUString SAL_CALL OEvoabResultSetMetaData::getColumnLabel( sal_Int32 nColumnNum )
{
- sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
- const ColumnProperty *pSpecs = getField(nField);
- GParamSpec *pSpec = pSpecs->pField;
- OUString aLabel;
-
- if( pSpec )
- aLabel = OStringToOUString( g_param_spec_get_nick( pSpec ),
- RTL_TEXTENCODING_UTF8 );
- return aLabel;
+ return getColumnName(nColumnNum);
}
OUString SAL_CALL OEvoabResultSetMetaData::getColumnServiceName( sal_Int32 /*nColumnNum*/ )
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
index 9d8dc6db3e23..e79d347b1c4d 100644
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
+++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NRESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NRESULTSETMETADATA_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <cppuhelper/implbase.hxx>
@@ -41,13 +40,13 @@ namespace connectivity::evoab
protected:
virtual ~OEvoabResultSetMetaData() override;
public:
- explicit OEvoabResultSetMetaData(const OUString& _aTableName);
+ explicit OEvoabResultSetMetaData(OUString _aTableName);
/// @throws css::sdbc::SQLException
void setEvoabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns);
sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const
{ return m_aEvoabFields[columnIndex - 1]; }
/// Avoid ambiguous cast error from the compiler.
- operator css::uno::Reference< css::sdbc::XResultSetMetaData > () throw()
+ operator css::uno::Reference< css::sdbc::XResultSetMetaData > () noexcept
{ return this; }
virtual sal_Int32 SAL_CALL getColumnCount( ) override;
@@ -75,6 +74,4 @@ namespace connectivity::evoab
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NRESULTSETMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx
index 80b02d82f0a5..8fee66699b3d 100644
--- a/connectivity/source/drivers/evoab2/NStatement.cxx
+++ b/connectivity/source/drivers/evoab2/NStatement.cxx
@@ -22,6 +22,7 @@
#include <string_view>
#include <osl/diagnose.h>
+#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <sal/log.hxx>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
@@ -37,7 +38,7 @@
#include <sqlbison.hxx>
#include <strings.hrc>
#include <connectivity/dbexception.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace connectivity::evoab {
@@ -48,7 +49,6 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
-using namespace com::sun::star::io;
using namespace com::sun::star::util;
namespace {
@@ -88,24 +88,69 @@ OCommonStatement::OCommonStatement(OEvoabConnection* _pConnection)
, m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
, m_bEscapeProcessing(true)
{
-#define REGISTER_PROP( id, member ) \
- registerProperty( \
- OMetaConnection::getPropMap().getNameByIndex( id ), \
- id, \
- 0, \
- &member, \
- cppu::UnoType<decltype(member)>::get() \
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ 0,
+ &m_aCursorName,
+ cppu::UnoType<decltype(m_aCursorName)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
+ PROPERTY_ID_MAXFIELDSIZE,
+ 0,
+ &m_nMaxFieldSize,
+ cppu::UnoType<decltype(m_nMaxFieldSize)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
+ PROPERTY_ID_MAXROWS,
+ 0,
+ &m_nMaxRows,
+ cppu::UnoType<decltype(m_nMaxRows)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
+ PROPERTY_ID_QUERYTIMEOUT,
+ 0,
+ &m_nQueryTimeOut,
+ cppu::UnoType<decltype(m_nQueryTimeOut)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ 0,
+ &m_nFetchSize,
+ cppu::UnoType<decltype(m_nFetchSize)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ 0,
+ &m_nResultSetType,
+ cppu::UnoType<decltype(m_nResultSetType)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ 0,
+ &m_nFetchDirection,
+ cppu::UnoType<decltype(m_nFetchDirection)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
+ PROPERTY_ID_ESCAPEPROCESSING,
+ 0,
+ &m_bEscapeProcessing,
+ cppu::UnoType<decltype(m_bEscapeProcessing)>::get()
+ );
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ 0,
+ &m_nResultSetConcurrency,
+ cppu::UnoType<decltype(m_nResultSetConcurrency)>::get()
);
-
- REGISTER_PROP( PROPERTY_ID_CURSORNAME, m_aCursorName );
- REGISTER_PROP( PROPERTY_ID_MAXFIELDSIZE, m_nMaxFieldSize );
- REGISTER_PROP( PROPERTY_ID_MAXROWS, m_nMaxRows );
- REGISTER_PROP( PROPERTY_ID_QUERYTIMEOUT, m_nQueryTimeOut );
- REGISTER_PROP( PROPERTY_ID_FETCHSIZE, m_nFetchSize );
- REGISTER_PROP( PROPERTY_ID_RESULTSETTYPE, m_nResultSetType );
- REGISTER_PROP( PROPERTY_ID_FETCHDIRECTION, m_nFetchDirection );
- REGISTER_PROP( PROPERTY_ID_ESCAPEPROCESSING, m_bEscapeProcessing );
- REGISTER_PROP( PROPERTY_ID_RESULTSETCONCURRENCY, m_nResultSetConcurrency );
}
OCommonStatement::~OCommonStatement()
@@ -115,7 +160,7 @@ OCommonStatement::~OCommonStatement()
void OCommonStatement::disposeResultSet()
{
// free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
+ rtl::Reference< OEvoabResultSet > xComp(m_xResultSet);
if (xComp.is())
xComp->dispose();
m_xResultSet.clear();
@@ -222,8 +267,11 @@ void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, So
ENSURE_OR_THROW(
( pColumnRef != nullptr )
&& ( pAscDesc != nullptr )
- && SQL_ISRULE( pAscDesc, opt_asc_desc )
- && ( pAscDesc->count() < 2 ),
+ && ( pAscDesc->isLeaf() )
+ && ( SQL_ISRULE( pAscDesc, opt_asc_desc )
+ || SQL_ISTOKEN(pAscDesc, ASC)
+ || SQL_ISTOKEN(pAscDesc, DESC)
+ ),
"ordering_spec structure error" );
// column name -> column field
@@ -232,11 +280,7 @@ void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, So
const OUString sColumnName( impl_getColumnRefColumnName_throw( *pColumnRef ) );
guint nField = evoab::findEvoabField( sColumnName );
// ascending/descending?
- bool bAscending = true;
- if ( ( pAscDesc->count() == 1 )
- && SQL_ISTOKEN( pAscDesc->getChild( 0 ), DESC )
- )
- bAscending = false;
+ bool bAscending = !SQL_ISTOKEN(pAscDesc, DESC);
_out_rSort.push_back( FieldSort( nField, bAscending ) );
}
@@ -460,6 +504,7 @@ void OCommonStatement::parseSql( const OUString& sql, QueryData& _out_rQueryData
pOrderByClause->showParseTree( sTreeDebug );
SAL_INFO( "connectivity.evoab2", "found order-by tree:\n" << sTreeDebug );
#endif
+
orderByAnalysis( pOrderByClause, _out_rQueryData.aSortOrder );
}
@@ -503,7 +548,7 @@ Any SAL_CALL OCommonStatement::getWarnings( )
checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- return makeAny(SQLWarning());
+ return Any(SQLWarning());
}
@@ -527,12 +572,12 @@ void SAL_CALL OCommonStatement::clearWarnings( )
}
-void SAL_CALL OCommonStatement::acquire() throw()
+void SAL_CALL OCommonStatement::acquire() noexcept
{
OCommonStatement_IBase::acquire();
}
-void SAL_CALL OCommonStatement::release() throw()
+void SAL_CALL OCommonStatement::release() noexcept
{
OCommonStatement_IBase::release();
}
@@ -564,13 +609,12 @@ QueryData OCommonStatement::impl_getEBookQuery_throw( const OUString& _rSql )
Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryData& _rQueryData )
{
// create result set
- OEvoabResultSet* pResult = new OEvoabResultSet( this, m_xConnection.get() );
- Reference< XResultSet > xRS = pResult;
+ rtl::Reference<OEvoabResultSet> pResult = new OEvoabResultSet( this, m_xConnection.get() );
pResult->construct( _rQueryData );
// done
- m_xResultSet = xRS;
- return xRS;
+ m_xResultSet = pResult.get();
+ return pResult;
}
@@ -596,7 +640,7 @@ Reference< XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( )
// = OStatement
-IMPLEMENT_SERVICE_INFO( OStatement, "com.sun.star.comp.sdbcx.evoab.OStatement", "com.sun.star.sdbc.Statement" );
+IMPLEMENT_SERVICE_INFO( OStatement, u"com.sun.star.comp.sdbcx.evoab.OStatement"_ustr, u"com.sun.star.sdbc.Statement"_ustr );
IMPLEMENT_FORWARD_XINTERFACE2( OStatement, OCommonStatement, OStatement_IBase )
@@ -628,7 +672,7 @@ sal_Int32 SAL_CALL OStatement::executeUpdate( const OUString& /*sql*/ )
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XStatement::executeUpdate", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XStatement::executeUpdate"_ustr, *this );
return 0;
}
diff --git a/connectivity/source/drivers/evoab2/NStatement.hxx b/connectivity/source/drivers/evoab2/NStatement.hxx
index a5d739eb14a1..302c6d8ac1ad 100644
--- a/connectivity/source/drivers/evoab2/NStatement.hxx
+++ b/connectivity/source/drivers/evoab2/NStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NSTATEMENT_HXX
+#pragma once
#include <com/sun/star/sdbc/XStatement.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
@@ -37,6 +36,7 @@
#include <com/sun/star/util/XCancellable.hpp>
#include <cppuhelper/compbase.hxx>
#include <comphelper/propertycontainer.hxx>
+#include <unotools/weakref.hxx>
#include "EApi.h"
#include "NConnection.hxx"
@@ -45,232 +45,232 @@
namespace connectivity::evoab
{
- 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)
{
- 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
+ rhs.mpQuery = nullptr;
+ }
+ void reset(EBookQuery* pQuery)
{
- 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 = pQuery;
+ if (mpQuery)
+ e_book_query_ref(mpQuery);
+ }
+ EBookQueryWrapper& operator=(const EBookQueryWrapper& rhs)
{
- private:
- css::uno::WeakReference< css::sdbc::XResultSet> 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() throw() override;
- virtual void SAL_CALL acquire() throw() 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.get() ); }
-
- 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 (this != &rhs)
+ reset(rhs.mpQuery);
+ return *this;
+ }
+ EBookQueryWrapper& operator=(EBookQueryWrapper&& rhs)
{
- 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() throw() override;
- virtual void SAL_CALL release() throw() 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 ;
- };
-}
+ 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
+ {
+ 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 ;
+ };
+}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NTable.cxx b/connectivity/source/drivers/evoab2/NTable.cxx
index b5c652a8ff67..94a20480f8d2 100644
--- a/connectivity/source/drivers/evoab2/NTable.cxx
+++ b/connectivity/source/drivers/evoab2/NTable.cxx
@@ -24,13 +24,8 @@
#include <com/sun/star/sdbc/XRow.hpp>
using namespace connectivity;
-using namespace ::comphelper;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace connectivity::evoab;
OEvoabTable::OEvoabTable( sdbcx::OCollection* _pTables,
@@ -58,19 +53,19 @@ void OEvoabTable::refreshColumns()
if (!isNew())
{
Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(
- Any(), m_SchemaName, m_Name, "%");
+ Any(), m_SchemaName, m_Name, u"%"_ustr);
if (xResult.is())
{
- Reference< XRow > xRow(xResult, UNO_QUERY);
- while (xResult->next())
- aVector.push_back(xRow->getString(4));
+ Reference< XRow > xRow(xResult, UNO_QUERY);
+ while (xResult->next())
+ aVector.push_back(xRow->getString(4));
}
}
if (m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = new OEvoabColumns(this,m_aMutex,aVector);
+ m_xColumns.reset(new OEvoabColumns(this,m_aMutex,aVector));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NTable.hxx b/connectivity/source/drivers/evoab2/NTable.hxx
index 2b38171b398f..d28f55404799 100644
--- a/connectivity/source/drivers/evoab2/NTable.hxx
+++ b/connectivity/source/drivers/evoab2/NTable.hxx
@@ -17,40 +17,37 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NTABLE_HXX
+#pragma once
#include "NConnection.hxx"
#include <connectivity/sdbcx/VTable.hxx>
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; }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NTABLE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NTables.cxx b/connectivity/source/drivers/evoab2/NTables.cxx
index b7a844fac15d..f124f6dbf92a 100644
--- a/connectivity/source/drivers/evoab2/NTables.cxx
+++ b/connectivity/source/drivers/evoab2/NTables.cxx
@@ -29,35 +29,29 @@ using namespace ::cppu;
using namespace connectivity::evoab;
using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-ObjectType OEvoabTables::createObject(const OUString& aName)
+css::uno::Reference< css::beans::XPropertySet > OEvoabTables::createObject(const OUString& aName)
{
- Sequence< OUString > aTypes { "TABLE" };
+ Sequence< OUString > aTypes { u"TABLE"_ustr };
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),"%",aName,aTypes);
+ Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),u"%"_ustr,aName,aTypes);
- ObjectType xRet;
- if(xResult.is())
+ rtl::Reference< OEvoabTable > xRet;
+ if(!xResult.is())
+ return nullptr;
+
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ if(xResult->next()) // there can be only one table with this name
{
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if(xResult->next()) // there can be only one table with this name
- {
- OEvoabTable* pRet = new OEvoabTable(
- this,
- static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
- aName,
- xRow->getString(4),
- xRow->getString(5),
- "",
- "");
- xRet = pRet;
- }
+ xRet = new OEvoabTable(
+ this,
+ static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
+ aName,
+ xRow->getString(4),
+ xRow->getString(5),
+ u""_ustr,
+ u""_ustr);
}
::comphelper::disposeComponent(xResult);
diff --git a/connectivity/source/drivers/evoab2/NTables.hxx b/connectivity/source/drivers/evoab2/NTables.hxx
index 593367c73a86..3e81e4d0497a 100644
--- a/connectivity/source/drivers/evoab2/NTables.hxx
+++ b/connectivity/source/drivers/evoab2/NTables.hxx
@@ -16,31 +16,29 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NTABLES_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <utility>
namespace connectivity::evoab
{
- class OEvoabTables : public sdbcx::OCollection
- {
- css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
- protected:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- public:
- OEvoabTables(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;
- };
+ 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_EVOAB2_NTABLES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx
index eedda26efba2..2a33bded28fe 100644
--- a/connectivity/source/drivers/file/FCatalog.cxx
+++ b/connectivity/source/drivers/file/FCatalog.cxx
@@ -24,10 +24,8 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
using namespace connectivity::file;
@@ -56,7 +54,7 @@ void OFileCatalog::refreshTables()
::std::vector< OUString> aVector;
Sequence< OUString > aTypes;
Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- "%", "%", aTypes);
+ u"%"_ustr, u"%"_ustr, aTypes);
fillNames(xResult,aVector);
if(m_pTables)
diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx
index e703112f71c4..dbe95ed16d55 100644
--- a/connectivity/source/drivers/file/FColumns.cxx
+++ b/connectivity/source/drivers/file/FColumns.cxx
@@ -25,14 +25,10 @@
using namespace connectivity::file;
using namespace connectivity;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-sdbcx::ObjectType OColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OColumns::createObject(const OUString& _rName)
{
const OUString sCatalogName;
const OUString sSchemaName(m_pTable->getSchema());
@@ -40,32 +36,31 @@ sdbcx::ObjectType OColumns::createObject(const OUString& _rName)
Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(),
sSchemaName, sTableName, _rName);
- sdbcx::ObjectType xRet;
- if(xResult.is())
+ if(!xResult.is())
+ return nullptr;
+
+ rtl::Reference< sdbcx::OColumn > xRet;
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while(xResult->next())
{
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
+ if(xRow->getString(4) == _rName)
{
- if(xRow->getString(4) == _rName)
- {
- sdbcx::OColumn* pRet = new sdbcx::OColumn(_rName,
- xRow->getString(6),
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- xRow->getInt(7),
- xRow->getInt(9),
- xRow->getInt(5),
- false,
- false,
- false,
- m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),
- sCatalogName,
- sSchemaName,
- sTableName);
- xRet = pRet;
- break;
- }
+ xRet = new sdbcx::OColumn(_rName,
+ xRow->getString(6),
+ xRow->getString(13),
+ xRow->getString(12),
+ xRow->getInt(11),
+ xRow->getInt(7),
+ xRow->getInt(9),
+ xRow->getInt(5),
+ false,
+ false,
+ false,
+ m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(),
+ sCatalogName,
+ sSchemaName,
+ sTableName);
+ break;
}
}
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
index 5c56ce4d5e5d..fe43ed6477ed 100644
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ b/connectivity/source/drivers/file/FConnection.cxx
@@ -21,7 +21,6 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <file/FConnection.hxx>
#include <file/FDatabaseMetaData.hxx>
#include <file/FDriver.hxx>
@@ -33,6 +32,7 @@
#include <com/sun/star/ucb/XContentIdentifier.hpp>
#include <tools/urlobj.hxx>
#include <file/FCatalog.hxx>
+#include <comphelper/configuration.hxx>
#include <unotools/pathoptions.hxx>
#include <ucbhelper/content.hxx>
#include <connectivity/dbcharset.hxx>
@@ -132,6 +132,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
OUString aFileName = aDSN;
INetURLObject aURL;
aURL.SetSmartProtocol(INetProtocol::File);
+ if (!comphelper::IsFuzzing())
{
SvtPathOptions aPathOptions;
aFileName = aPathOptions.SubstituteVariable(aFileName);
@@ -165,7 +166,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
}
// set fields to fetch
- Sequence< OUString > aProps { "Title" };
+ Sequence< OUString > aProps { u"Title"_ustr };
try
{
@@ -178,7 +179,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
{
Reference<XContent> xParent(Reference<XChild>(aFile.get(),UNO_QUERY_THROW)->getParent(),UNO_QUERY_THROW);
Reference<XContentIdentifier> xIdent = xParent->getIdentifier();
- m_xContent = xParent;
+ m_xContent = std::move(xParent);
::ucbhelper::Content aParent(xIdent->getContentIdentifier(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
m_xDir = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
@@ -209,7 +210,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.file.Connection", "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(OConnection, u"com.sun.star.sdbc.drivers.file.Connection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
Reference< XStatement > SAL_CALL OConnection::createStatement( )
@@ -229,8 +230,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const OU
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OPreparedStatement* pStmt = new OPreparedStatement(this);
- Reference< XPreparedStatement > xHoldAlive = pStmt;
+ rtl::Reference<OPreparedStatement> pStmt = new OPreparedStatement(this);
pStmt->construct(sql);
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
return pStmt;
@@ -238,8 +238,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const OU
Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const OUString& /*sql*/ )
{
- throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
- return nullptr;
+ throwFeatureNotImplementedSQLException( u"XConnection::prepareCall"_ustr, *this );
}
OUString SAL_CALL OConnection::nativeSQL( const OUString& sql )
@@ -314,7 +313,7 @@ sal_Bool SAL_CALL OConnection::isReadOnly( )
void SAL_CALL OConnection::setCatalog( const OUString& /*catalog*/ )
{
- throwFeatureNotImplementedSQLException( "XConnection::setCatalog", *this );
+ throwFeatureNotImplementedSQLException( u"XConnection::setCatalog"_ustr, *this );
}
OUString SAL_CALL OConnection::getCatalog( )
@@ -324,7 +323,7 @@ OUString SAL_CALL OConnection::getCatalog( )
void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 /*level*/ )
{
- throwFeatureNotImplementedSQLException( "XConnection::setTransactionIsolation", *this );
+ throwFeatureNotImplementedSQLException( u"XConnection::setTransactionIsolation"_ustr, *this );
}
sal_Int32 SAL_CALL OConnection::getTransactionIsolation( )
@@ -369,17 +368,17 @@ void OConnection::disposing()
m_xDir.clear();
m_xContent.clear();
- m_xCatalog = WeakReference< XTablesSupplier>();
+ m_xCatalog.clear();
}
Reference< XTablesSupplier > OConnection::createCatalog()
{
::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
+ rtl::Reference< connectivity::sdbcx::OCatalog > xTab = m_xCatalog.get();
if(!xTab.is())
{
xTab = new OFileCatalog(this);
- m_xCatalog = xTab;
+ m_xCatalog = xTab.get();
}
return xTab;
}
@@ -387,7 +386,7 @@ Reference< XTablesSupplier > OConnection::createCatalog()
Reference< XDynamicResultSet > OConnection::getDir() const
{
Reference<XDynamicResultSet> xContent;
- Sequence< OUString > aProps { "Title" };
+ Sequence< OUString > aProps { u"Title"_ustr };
try
{
Reference<XContentIdentifier> xIdent = getContent()->getIdentifier();
@@ -402,31 +401,24 @@ Reference< XDynamicResultSet > OConnection::getDir() const
sal_Int64 SAL_CALL OConnection::getSomething( const Sequence< sal_Int8 >& rId )
{
- return (isUnoTunnelId<OConnection>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : sal_Int64(0);
+ return comphelper::getSomethingImpl(rId, this);
}
-Sequence< sal_Int8 > OConnection::getUnoTunnelId()
+const Sequence< sal_Int8 > & OConnection::getUnoTunnelId()
{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
}
void OConnection::throwUrlNotValid(const OUString & _rsUrl,const OUString & _rsMessage)
{
- SQLException aError;
- aError.Message = getResources().getResourceStringWithSubstitution(
- STR_NO_VALID_FILE_URL,
- "$URL$", _rsUrl
- );
-
- aError.SQLState = "S1000";
- aError.ErrorCode = 0;
- aError.Context = static_cast< XConnection* >(this);
+ XConnection* context = this;
+ css::uno::Any next;
if (!_rsMessage.isEmpty())
- aError.NextException <<= SQLException(_rsMessage, aError.Context, OUString(), 0, Any());
+ next <<= SQLException(_rsMessage, context, OUString(), 0, Any());
+ SQLException aError(
+ getResources().getResourceStringWithSubstitution(STR_NO_VALID_FILE_URL, "$URL$", _rsUrl),
+ context, u"S1000"_ustr, 0, next);
throw aError;
}
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index 2fffb76f78e3..efc8f8149f08 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_fuzzers.h>
+
#include <file/FDatabaseMetaData.hxx>
#include <FDatabaseMetaDataResultSet.hxx>
#include <com/sun/star/sdbc/ResultSetType.hpp>
@@ -28,14 +30,13 @@
#include <file/FTable.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <ucbhelper/content.hxx>
using namespace com::sun::star::ucb;
using namespace connectivity::file;
using namespace connectivity;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
@@ -71,7 +72,8 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
namespace
{
- sal_Int16 isCaseSensitiveParentFolder( const OUString& _rFolderOrDoc, const OUString& _rDocName )
+#if !ENABLE_FUZZERS
+ sal_Int16 isCaseSensitiveParentFolder( const OUString& _rFolderOrDoc, std::u16string_view _rDocName )
{
sal_Int16 nIsCS = 1;
try
@@ -82,7 +84,7 @@ namespace
{
::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
if ( aFolderOrDoc.isDocument() )
- aContent1 = aFolderOrDoc;
+ aContent1 = std::move(aFolderOrDoc);
else
{
aContentURL = INetURLObject( _rFolderOrDoc, INetURLObject::EncodeMechanism::WasEncoded );
@@ -149,6 +151,7 @@ namespace
return nIsCS;
}
+#endif
}
@@ -158,14 +161,12 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
{
::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTables );
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTables );
// check if any type is given
// when no types are given then we have to return all tables e.g. TABLE
- static constexpr OUStringLiteral aTable = u"TABLE";
+ static constexpr OUString aTable = u"TABLE"_ustr;
bool bTableFound = true;
sal_Int32 nLength = types.getLength();
@@ -185,7 +186,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
}
}
if(!bTableFound)
- return xRef;
+ return pResult;
Reference<XDynamicResultSet> xContent = m_pConnection->getDir();
Reference < XSortedDynamicResultSetFactory > xSRSFac =
@@ -229,7 +230,11 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
if ( !bKnowCaseSensitivity )
{
bKnowCaseSensitivity = true;
+#if ENABLE_FUZZERS
+ sal_Int16 nCase = 1;
+#else
sal_Int16 nCase = isCaseSensitiveParentFolder( m_pConnection->getURL(), aURL.getName() );
+#endif
switch( nCase )
{
case 1:
@@ -293,16 +298,16 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
}
if(bNewRow)
{
- aRow.push_back(new ORowSetValueDecorator(OUString(aTable)));
+ aRow.push_back(new ORowSetValueDecorator(aTable));
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
aRows.push_back(aRow);
}
}
- pResult->setRows(aRows);
+ pResult->setRows(std::move(aRows));
- return xRef;
+ return pResult;
}
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( )
@@ -370,11 +375,9 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
ODatabaseMetaDataResultSet::ORows aRows;
-
Reference< XTablesSupplier > xTabSup = m_pConnection->createCatalog();
if( xTabSup.is())
{
@@ -390,14 +393,14 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
aRow[2] = new ORowSetValueDecorator(*pBegin);
aRow[6] = ODatabaseMetaDataResultSet::getSelectValue();
- aRow[7] = new ORowSetValueDecorator(OUString("NO"));
+ aRow[7] = new ORowSetValueDecorator(u"NO"_ustr);
aRows.push_back(aRow);
Reference< XPropertySet> xTable(
xNames->getByName(*pBegin), css::uno::UNO_QUERY);
if(xTable.is())
{
- auto pTable = comphelper::getUnoTunnelImplementation<OFileTable>(xTable);
+ auto pTable = dynamic_cast<OFileTable*>(xTable.get());
if(pTable && !pTable->isReadOnly())
{
aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
@@ -423,8 +426,8 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
}
}
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( )
@@ -489,7 +492,7 @@ OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( )
OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
{
- return "\"";
+ return u"\""_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( )
@@ -614,20 +617,11 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( )
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes );
- Reference< XResultSet > xRef = pResult;
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(OUString("TABLE")));
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes );
+ ODatabaseMetaDataResultSet::ORows aRows;
+ aRows.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(u"TABLE"_ustr) } );
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( )
@@ -842,7 +836,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( )
OUString SAL_CALL ODatabaseMetaData::getURL( )
{
- return "sdbc:file:";
+ return u"sdbc:file:"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getUserName( )
@@ -907,12 +901,12 @@ OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( )
OUString SAL_CALL ODatabaseMetaData::getStringFunctions( )
{
- return "UCASE,LCASE,ASCII,LENGTH,OCTET_LENGTH,CHAR_LENGTH,CHARACTER_LENGTH,CHAR,CONCAT,LOCATE,SUBSTRING,LTRIM,RTRIM,SPACE,REPLACE,REPEAT,INSERT,LEFT,RIGHT";
+ return u"UCASE,LCASE,ASCII,LENGTH,OCTET_LENGTH,CHAR_LENGTH,CHARACTER_LENGTH,CHAR,CONCAT,LOCATE,SUBSTRING,LTRIM,RTRIM,SPACE,REPLACE,REPEAT,INSERT,LEFT,RIGHT"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( )
{
- return "DAYOFWEEK,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,CURDATE,CURTIME,NOW";
+ return u"DAYOFWEEK,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,CURDATE,CURTIME,NOW"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( )
@@ -922,7 +916,7 @@ OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( )
OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( )
{
- return "ABS,SIGN,MOD,FLOOR,CEILING,ROUND,EXP,LN,LOG,LOG10,POWER,SQRT,PI,COS,SIN,TAN,ACOS,ASIN,ATAN,ATAN2,DEGREES,RADIANS";
+ return u"ABS,SIGN,MOD,FLOOR,CEILING,ROUND,EXP,LN,LOG,LOG10,POWER,SQRT,PI,COS,SIN,TAN,ACOS,ASIN,ATAN,ATAN2,DEGREES,RADIANS"_ustr;
}
sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( )
diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx
index d5b7c48c0dcc..1be992d4b672 100644
--- a/connectivity/source/drivers/file/FDateFunctions.cxx
+++ b/connectivity/source/drivers/file/FDateFunctions.cxx
@@ -32,7 +32,7 @@ ORowSetValue OOp_DayOfWeek::operate(const ORowSetValue& lhs) const
return lhs;
sal_Int32 nRet = 0;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
Date aDate(aD.Day, aD.Month, aD.Year);
DayOfWeek eDayOfWeek = aDate.GetDayOfWeek();
switch (eDayOfWeek)
@@ -69,7 +69,7 @@ ORowSetValue OOp_DayOfMonth::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
return static_cast<sal_Int16>(aD.Day);
}
@@ -78,7 +78,7 @@ ORowSetValue OOp_DayOfYear::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
Date aDate(aD.Day, aD.Month, aD.Year);
return static_cast<sal_Int16>(aDate.GetDayOfYear());
}
@@ -88,7 +88,7 @@ ORowSetValue OOp_Month::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
return static_cast<sal_Int16>(aD.Month);
}
@@ -98,7 +98,7 @@ ORowSetValue OOp_DayName::operate(const ORowSetValue& lhs) const
return lhs;
OUString sRet;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
Date aDate(aD.Day, aD.Month, aD.Year);
DayOfWeek eDayOfWeek = aDate.GetDayOfWeek();
switch (eDayOfWeek)
@@ -136,7 +136,7 @@ ORowSetValue OOp_MonthName::operate(const ORowSetValue& lhs) const
return lhs;
OUString sRet;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
switch (aD.Month)
{
case 1:
@@ -185,7 +185,7 @@ ORowSetValue OOp_Quarter::operate(const ORowSetValue& lhs) const
return lhs;
sal_Int32 nRet = 1;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
if (aD.Month >= 4 && aD.Month < 7)
nRet = 2;
else if (aD.Month >= 7 && aD.Month < 10)
@@ -202,12 +202,12 @@ ORowSetValue OOp_Week::operate(const std::vector<ORowSetValue>& lhs) const
size_t nSize = lhs.size();
- css::util::Date aD = lhs[nSize - 1];
+ css::util::Date aD = lhs[nSize - 1].getDate();
Date aDate(aD.Day, aD.Month, aD.Year);
sal_Int16 nStartDay = SUNDAY;
if (nSize == 2 && !lhs[0].isNull())
- nStartDay = lhs[0];
+ nStartDay = lhs[0].getInt16();
return static_cast<sal_Int16>(aDate.GetWeekOfYear(static_cast<DayOfWeek>(nStartDay)));
}
@@ -217,7 +217,7 @@ ORowSetValue OOp_Year::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- css::util::Date aD = lhs;
+ css::util::Date aD = lhs.getDate();
return aD.Year;
}
@@ -226,7 +226,7 @@ ORowSetValue OOp_Hour::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- css::util::Time aT = lhs;
+ css::util::Time aT = lhs.getTime();
return static_cast<sal_Int16>(aT.Hours);
}
@@ -235,7 +235,7 @@ ORowSetValue OOp_Minute::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- css::util::Time aT = lhs;
+ css::util::Time aT = lhs.getTime();
return static_cast<sal_Int16>(aT.Minutes);
}
@@ -244,7 +244,7 @@ ORowSetValue OOp_Second::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- css::util::Time aT = lhs;
+ css::util::Time aT = lhs.getTime();
return static_cast<sal_Int16>(aT.Seconds);
}
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index 16cf60e02cb4..e5788a257ddb 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -20,11 +20,13 @@
#include <file/FDriver.hxx>
#include <file/FConnection.hxx>
#include <file/fcode.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <connectivity/dbexception.hxx>
#include <strings.hrc>
#include <resource/sharedresources.hxx>
+#include <utility>
using namespace connectivity::file;
@@ -35,9 +37,9 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
-OFileDriver::OFileDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
+OFileDriver::OFileDriver(css::uno::Reference< css::uno::XComponentContext > _xContext)
: ODriver_BASE(m_aMutex)
- ,m_xContext(_rxContext)
+ ,m_xContext(std::move(_xContext))
{
}
@@ -48,7 +50,7 @@ void OFileDriver::disposing()
for (auto const& connection : m_xConnections)
{
- Reference< XComponent > xComp(connection.get(), UNO_QUERY);
+ rtl::Reference< OConnection > xComp(connection);
if (xComp.is())
xComp->dispose();
}
@@ -61,7 +63,7 @@ void OFileDriver::disposing()
OUString SAL_CALL OFileDriver::getImplementationName( )
{
- return "com.sun.star.sdbc.driver.file.Driver";
+ return u"com.sun.star.sdbc.driver.file.Driver"_ustr;
}
sal_Bool SAL_CALL OFileDriver::supportsService( const OUString& _rServiceName )
@@ -72,7 +74,7 @@ sal_Bool SAL_CALL OFileDriver::supportsService( const OUString& _rServiceName )
Sequence< OUString > SAL_CALL OFileDriver::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr, u"com.sun.star.sdbcx.Driver"_ustr };
}
@@ -81,12 +83,11 @@ Reference< XConnection > SAL_CALL OFileDriver::connect( const OUString& url, con
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(ODriver_BASE::rBHelper.bDisposed);
- OConnection* pCon = new OConnection(this);
- Reference< XConnection > xCon = pCon;
+ rtl::Reference<OConnection> pCon = new OConnection(this);
pCon->construct(url,info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon);
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL OFileDriver::acceptsURL( const OUString& url )
@@ -98,62 +99,60 @@ Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const OUSt
{
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence< OUString > aBoolean { u"0"_ustr, u"1"_ustr };
- aDriverInfo.push_back(DriverPropertyInfo(
- "CharSet"
- ,"CharSet of the database."
+ return
+ {
+ {
+ u"CharSet"_ustr
+ ,u"CharSet of the database."_ustr
,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "Extension"
- ,"Extension of the file format."
+ ,{}
+ ,{}
+ },
+ {
+ u"Extension"_ustr
+ ,u"Extension of the file format."_ustr
,false
- ,".*"
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "ShowDeleted"
- ,"Display inactive records."
+ ,u".*"_ustr
+ ,{}
+ },
+ {
+ u"ShowDeleted"_ustr
+ ,u"Display inactive records."_ustr
,false
- ,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "EnableSQL92Check"
- ,"Use SQL92 naming constraints."
+ ,u"0"_ustr
+ ,aBoolean
+ },
+ {
+ u"EnableSQL92Check"_ustr
+ ,u"Use SQL92 naming constraints."_ustr
,false
- ,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "UseRelativePath"
- ,"Handle the connection url as relative path."
+ ,u"0"_ustr
+ ,aBoolean
+ },
+ {
+ u"UseRelativePath"_ustr
+ ,u"Handle the connection url as relative path."_ustr
,false
- ,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "URL"
- ,"The URL of the database document which is used to create an absolute path."
+ ,u"0"_ustr
+ ,aBoolean
+ },
+ {
+ u"URL"_ustr
+ ,u"The URL of the database document which is used to create an absolute path."_ustr
,false
- ,OUString()
- ,Sequence< OUString >())
- );
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ ,{}
+ ,{}
+ }
+ };
} // if ( acceptsURL(url) )
{
::connectivity::SharedResources aResources;
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
::dbtools::throwGenericSQLException(sMessage ,*this);
} // if ( ! acceptsURL(url) )
- return Sequence< DriverPropertyInfo >();
}
sal_Int32 SAL_CALL OFileDriver::getMajorVersion( )
@@ -173,25 +172,15 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(ODriver_BASE::rBHelper.bDisposed);
- Reference< XTablesSupplier > xTab;
- Reference< css::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if(xTunnel.is())
+ if (OConnection* pSearchConnection = comphelper::getFromUnoTunnel<OConnection>(connection))
{
- OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelId()) );
- OConnection* pConnection = nullptr;
for (auto const& elem : m_xConnections)
{
- if (static_cast<OConnection*>( Reference< XConnection >::query(elem.get().get()).get() ) == pSearchConnection)
- {
- pConnection = pSearchConnection;
- break;
- }
+ if (elem.get().get() == pSearchConnection)
+ return pSearchConnection->createCatalog();
}
-
- if(pConnection)
- xTab = pConnection->createCatalog();
}
- return xTab;
+ return {};
}
diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx
index 7c26081da12e..c2cd9d9579d6 100644
--- a/connectivity/source/drivers/file/FNoException.cxx
+++ b/connectivity/source/drivers/file/FNoException.cxx
@@ -65,7 +65,7 @@ void OSQLAnalyzer::bindParameterRow(OValueRefRow const & _pRow)
void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,std::vector< OSQLParseNode*>& _rParaNodes)
{
- DBG_ASSERT(pParseNode != nullptr,"OResultSet: internal error: invalid ParseNode");
+ assert(pParseNode && "OResultSet: internal error: invalid ParseNode");
// found parameter Name-Rule?
if (SQL_ISRULE(pParseNode,parameter))
@@ -85,7 +85,7 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,std::vector< OS
std::unique_ptr<OKeyValue> OResultSet::GetOrderbyKeyValue(OValueRefRow const & _rRow)
{
- sal_uInt32 nBookmarkValue = std::abs(static_cast<sal_Int32>((*_rRow)[0]->getValue()));
+ sal_uInt32 nBookmarkValue = std::abs((*_rRow)[0]->getValue().getInt32());
std::unique_ptr<OKeyValue> pKeyValue = OKeyValue::createKeyValue(nBookmarkValue);
diff --git a/connectivity/source/drivers/file/FNumericFunctions.cxx b/connectivity/source/drivers/file/FNumericFunctions.cxx
index a6784a55c140..7c7fdc75425f 100644
--- a/connectivity/source/drivers/file/FNumericFunctions.cxx
+++ b/connectivity/source/drivers/file/FNumericFunctions.cxx
@@ -19,20 +19,19 @@
#include <cmath>
+#include <basegfx/numeric/ftools.hxx>
#include <file/FNumericFunctions.hxx>
#include <rtl/math.hxx>
using namespace connectivity;
using namespace connectivity::file;
-const double fPi = 3.14159265358979323846;
-
ORowSetValue OOp_Abs::operate(const ORowSetValue& lhs) const
{
if ( lhs.isNull() )
return lhs;
- double nVal(lhs);
+ double nVal = lhs.getDouble();
if ( nVal < 0 )
nVal *= -1.0;
return fabs(nVal);
@@ -44,7 +43,7 @@ ORowSetValue OOp_Sign::operate(const ORowSetValue& lhs) const
return lhs;
sal_Int32 nRet = 0;
- double nVal(lhs);
+ double nVal = lhs.getDouble();
if ( nVal < 0 )
nRet = -1;
else if ( nVal > 0 )
@@ -58,7 +57,7 @@ ORowSetValue OOp_Mod::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) c
if ( lhs.isNull() || rhs.isNull() )
return ORowSetValue();
- return fmod(static_cast<double>(lhs),static_cast<double>(rhs));
+ return fmod(lhs.getDouble(), rhs.getDouble());
}
ORowSetValue OOp_Floor::operate(const ORowSetValue& lhs) const
@@ -66,7 +65,7 @@ ORowSetValue OOp_Floor::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- return floor(static_cast<double>(lhs));
+ return floor(lhs.getDouble());
}
ORowSetValue OOp_Ceiling::operate(const ORowSetValue& lhs) const
@@ -74,7 +73,7 @@ ORowSetValue OOp_Ceiling::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- double nVal(lhs);
+ double nVal = lhs.getDouble();
return ceil(nVal);
}
@@ -84,11 +83,11 @@ ORowSetValue OOp_Round::operate(const std::vector<ORowSetValue>& lhs) const
return ORowSetValue();
size_t nSize = lhs.size();
- double nVal = lhs[nSize-1];
+ double nVal = lhs[nSize-1].getDouble();
sal_Int32 nDec = 0;
if ( nSize == 2 && !lhs[0].isNull() )
- nDec = lhs[0];
+ nDec = lhs[0].getDouble();
return ::rtl::math::round(nVal,nDec);
}
@@ -97,16 +96,16 @@ ORowSetValue OOp_Exp::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- double nVal(lhs);
+ double nVal = lhs.getDouble();
return exp(nVal);
}
ORowSetValue OOp_Ln::operate(const ORowSetValue& lhs) const
{
- if ( lhs.isNull() || static_cast<double>(lhs) < 0.0 )
+ if ( lhs.isNull() || lhs.getDouble() < 0.0 )
return lhs;
- double nVal(lhs);
+ double nVal = lhs.getDouble();
nVal = log(nVal);
if ( std::isnan(nVal) )
return ORowSetValue();
@@ -118,11 +117,11 @@ ORowSetValue OOp_Log::operate(const std::vector<ORowSetValue>& lhs) const
if ( lhs.empty() || lhs.size() > 2 )
return ORowSetValue();
size_t nSize = lhs.size();
- double nVal = log( static_cast<double>(lhs[nSize-1]) );
+ double nVal = log( lhs[nSize-1].getDouble() );
if ( nSize == 2 && !lhs[0].isNull() )
- nVal /= log(static_cast<double>(lhs[0]));
+ nVal /= log(lhs[0].getDouble());
if ( std::isnan(nVal) )
return ORowSetValue();
@@ -131,10 +130,10 @@ ORowSetValue OOp_Log::operate(const std::vector<ORowSetValue>& lhs) const
ORowSetValue OOp_Log10::operate(const ORowSetValue& lhs) const
{
- if ( lhs.isNull() || static_cast<double>(lhs) < 0.0 )
+ if ( lhs.isNull() || lhs.getDouble() < 0.0 )
return lhs;
- double nVal = log(static_cast<double>(lhs));
+ double nVal = log(lhs.getDouble());
if ( std::isnan(nVal) )
return ORowSetValue();
nVal /= log(10.0);
@@ -146,7 +145,7 @@ ORowSetValue OOp_Pow::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) c
if ( lhs.isNull() || rhs.isNull() )
return lhs;
- return pow(static_cast<double>(lhs),static_cast<double>(rhs));
+ return pow(lhs.getDouble(), rhs.getDouble());
}
ORowSetValue OOp_Sqrt::operate(const ORowSetValue& lhs) const
@@ -154,7 +153,7 @@ ORowSetValue OOp_Sqrt::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- double nVal = sqrt(static_cast<double>(lhs));
+ double nVal = sqrt(lhs.getDouble());
if ( std::isnan(nVal) )
return ORowSetValue();
return nVal;
@@ -162,7 +161,7 @@ ORowSetValue OOp_Sqrt::operate(const ORowSetValue& lhs) const
ORowSetValue OOp_Pi::operate(const std::vector<ORowSetValue>& /*lhs*/) const
{
- return fPi;
+ return M_PI;
}
ORowSetValue OOp_Cos::operate(const ORowSetValue& lhs) const
@@ -170,7 +169,7 @@ ORowSetValue OOp_Cos::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- return cos(static_cast<double>(lhs));
+ return cos(lhs.getDouble());
}
ORowSetValue OOp_Sin::operate(const ORowSetValue& lhs) const
@@ -178,7 +177,7 @@ ORowSetValue OOp_Sin::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- return sin(static_cast<double>(lhs));
+ return sin(lhs.getDouble());
}
ORowSetValue OOp_Tan::operate(const ORowSetValue& lhs) const
@@ -186,7 +185,7 @@ ORowSetValue OOp_Tan::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- return tan(static_cast<double>(lhs));
+ return tan(lhs.getDouble());
}
ORowSetValue OOp_ACos::operate(const ORowSetValue& lhs) const
@@ -194,7 +193,7 @@ ORowSetValue OOp_ACos::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- return acos(static_cast<double>(lhs));
+ return acos(lhs.getDouble());
}
ORowSetValue OOp_ASin::operate(const ORowSetValue& lhs) const
@@ -202,7 +201,7 @@ ORowSetValue OOp_ASin::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- return asin(static_cast<double>(lhs));
+ return asin(lhs.getDouble());
}
ORowSetValue OOp_ATan::operate(const ORowSetValue& lhs) const
@@ -210,7 +209,7 @@ ORowSetValue OOp_ATan::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- return atan(static_cast<double>(lhs));
+ return atan(lhs.getDouble());
}
ORowSetValue OOp_ATan2::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const
@@ -218,7 +217,7 @@ ORowSetValue OOp_ATan2::operate(const ORowSetValue& lhs,const ORowSetValue& rhs)
if ( lhs.isNull() || rhs.isNull() )
return lhs;
- return atan2(static_cast<double>(lhs),static_cast<double>(rhs));
+ return atan2(lhs.getDouble(), rhs.getDouble());
}
ORowSetValue OOp_Degrees::operate(const ORowSetValue& lhs) const
@@ -226,8 +225,8 @@ ORowSetValue OOp_Degrees::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- double nLhs = lhs;
- return nLhs*180*(1.0/fPi);
+ double nLhs = lhs.getDouble();
+ return basegfx::rad2deg(nLhs);
}
ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const
@@ -235,8 +234,8 @@ ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const
if ( lhs.isNull() )
return lhs;
- double nLhs = lhs;
- return nLhs*fPi*(1.0/180.0);
+ double nLhs = lhs.getDouble();
+ return basegfx::deg2rad(nLhs);
}
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index fc5b81923cb4..5a3f09adb920 100644
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/file/FPreparedStatement.cxx
@@ -18,6 +18,7 @@
*/
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <file/FPreparedStatement.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
@@ -45,7 +46,7 @@ using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
using namespace com::sun::star;
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbc.driver.file.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(OPreparedStatement,u"com.sun.star.sdbc.driver.file.PreparedStatement"_ustr,u"com.sun.star.sdbc.PreparedStatement"_ustr);
OPreparedStatement::OPreparedStatement( OConnection* _pConnection)
: OStatement_BASE2( _pConnection )
@@ -127,13 +128,18 @@ css::uno::Sequence< css::uno::Type > SAL_CALL OPreparedStatement::getTypes( )
Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( )
{
+ return getMetaDataImpl();
+}
+
+const rtl::Reference< OResultSetMetaData > & OPreparedStatement::getMetaDataImpl( )
+{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
if(!m_xMetaData.is())
m_xMetaData = new OResultSetMetaData(m_aSQLIterator.getSelectColumns(),m_aSQLIterator.getTables().begin()->first,m_pTable.get());
- return m_xMetaData.get();
+ return m_xMetaData;
}
@@ -189,7 +195,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
@@ -198,7 +204,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return makeResultSet().get();
+ return makeResultSet();
}
@@ -250,7 +256,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x
void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ )
{
- throwFeatureNotImplementedSQLException( "XParameters::setLong", *this );
+ throwFeatureNotImplementedSQLException( u"XParameters::setLong"_ustr, *this );
}
@@ -268,25 +274,25 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /
void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ )
{
- throwFeatureNotImplementedSQLException( "XParameters::setClob", *this );
+ throwFeatureNotImplementedSQLException( u"XParameters::setClob"_ustr, *this );
}
void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ )
{
- throwFeatureNotImplementedSQLException( "XParameters::setBlob", *this );
+ throwFeatureNotImplementedSQLException( u"XParameters::setBlob"_ustr, *this );
}
void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ )
{
- throwFeatureNotImplementedSQLException( "XParameters::setArray", *this );
+ throwFeatureNotImplementedSQLException( u"XParameters::setArray"_ustr, *this );
}
void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ )
{
- throwFeatureNotImplementedSQLException( "XParameters::setRef", *this );
+ throwFeatureNotImplementedSQLException( u"XParameters::setRef"_ustr, *this );
}
@@ -363,7 +369,7 @@ void SAL_CALL OPreparedStatement::clearParameters( )
m_aParameterRow->push_back(new ORowSetValueDecorator(sal_Int32(0)) );
}
-OResultSet* OPreparedStatement::createResultSet()
+rtl::Reference<OResultSet> OPreparedStatement::createResultSet()
{
return new OResultSet(this,m_aSQLIterator);
}
@@ -376,15 +382,15 @@ void OPreparedStatement::initResultSet(OResultSet *pResultSet)
m_pConnection->throwGenericSQLException(STR_INVALID_PARA_COUNT,*this);
pResultSet->OpenImpl();
- pResultSet->setMetaData(getMetaData());
+ pResultSet->setMetaData(getMetaDataImpl());
}
-void SAL_CALL OPreparedStatement::acquire() throw()
+void SAL_CALL OPreparedStatement::acquire() noexcept
{
OStatement_BASE2::acquire();
}
-void SAL_CALL OPreparedStatement::release() throw()
+void SAL_CALL OPreparedStatement::release() noexcept
{
OStatement_BASE2::release();
}
@@ -392,7 +398,7 @@ void SAL_CALL OPreparedStatement::release() throw()
void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
{
::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- if ( m_aAssignValues.is() && (parameterIndex < 1 || parameterIndex >= static_cast<sal_Int32>(m_aParameterIndexes.size())) )
+ if ( m_aAssignValues.is() && (parameterIndex < 1 || o3tl::make_unsigned(parameterIndex) >= m_aParameterIndexes.size()) )
throwInvalidIndexException(*this);
else if ( static_cast<sal_Int32>(m_aParameterRow->size()) <= parameterIndex )
{
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 5cf5d1ae862d..56ca7ed0063a 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -29,6 +29,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/propshlp.hxx>
+#include <o3tl/safeint.hxx>
#include <sal/log.hxx>
#include <iterator>
#include <com/sun/star/sdbc/ResultSetType.hpp>
@@ -41,7 +42,7 @@
#include <comphelper/types.hxx>
#include <resource/sharedresources.hxx>
#include <strings.hrc>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::comphelper;
using namespace connectivity;
@@ -57,7 +58,7 @@ using namespace com::sun::star::container;
namespace
{
- void lcl_throwError(const char* pErrorId, const css::uno::Reference< css::uno::XInterface>& _xContext)
+ void lcl_throwError(TranslateId pErrorId, const css::uno::Reference< css::uno::XInterface>& _xContext)
{
::connectivity::SharedResources aResources;
const OUString sMessage = aResources.getResourceString(pErrorId);
@@ -65,7 +66,7 @@ namespace
}
}
-IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet");
+IMPLEMENT_SERVICE_INFO(OResultSet,u"com.sun.star.sdbcx.drivers.file.ResultSet"_ustr,u"com.sun.star.sdbc.ResultSet"_ustr);
OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIterator) : OResultSet_BASE(m_aMutex)
,::comphelper::OPropertyContainer(OResultSet_BASE::rBHelper)
@@ -133,9 +134,8 @@ void OResultSet::disposing()
m_xColumns = nullptr;
m_xColsIdx.clear();
- Reference<XComponent> xComp = m_pTable.get();
- if ( xComp.is() )
- xComp->removeEventListener(this);
+ if ( m_pTable.is() )
+ m_pTable->removeEventListener(this);
m_pTable.clear();
m_pFileSet = nullptr;
@@ -182,8 +182,6 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName )
}
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
- return 0; // Never reached
}
const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex)
@@ -218,43 +216,43 @@ Reference< css::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_
sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex )
{
- return bool(getValue(columnIndex));
+ return getValue(columnIndex).getBool();
}
sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt8();
}
Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getSequence();
}
css::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDate();
}
double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDouble();
}
float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getFloat();
}
sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt32();
}
@@ -265,13 +263,13 @@ sal_Int32 SAL_CALL OResultSet::getRow( )
OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getRow called for deleted row");
- return m_aSkipDeletedSet.getMappedPosition((*m_aRow)[0]->getValue());
+ return m_aSkipDeletedSet.getMappedPosition((*m_aRow)[0]->getValue().getInt32());
}
sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getLong();
}
@@ -317,22 +315,22 @@ Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< css:
sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt16();
}
OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getString();
}
css::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex )
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDateTime();
}
@@ -519,12 +517,12 @@ void SAL_CALL OResultSet::insertRow( )
m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, m_xColsIdx);
if(m_bRowInserted && m_pFileSet.is())
{
- sal_Int32 nPos = (*m_aInsertRow)[0]->getValue();
+ sal_Int32 nPos = (*m_aInsertRow)[0]->getValue().getInt32();
m_pFileSet->push_back(nPos);
*(*m_aInsertRow)[0] = sal_Int32(m_pFileSet->size());
clearInsertRow();
- m_aSkipDeletedSet.insertNewPosition((*m_aRow)[0]->getValue());
+ m_aSkipDeletedSet.insertNewPosition((*m_aRow)[0]->getValue().getInt32());
}
}
@@ -537,7 +535,7 @@ void SAL_CALL OResultSet::updateRow( )
lcl_throwError(STR_TABLE_READONLY,*this);
m_bRowUpdated = m_pTable->UpdateRow(*m_aInsertRow, m_aRow,m_xColsIdx);
- *(*m_aInsertRow)[0] = static_cast<sal_Int32>((*m_aRow)[0]->getValue());
+ *(*m_aInsertRow)[0] = (*m_aRow)[0]->getValue().getInt32();
clearInsertRow();
}
@@ -554,7 +552,7 @@ void SAL_CALL OResultSet::deleteRow()
if(m_aRow->isDeleted())
lcl_throwError(STR_ROW_ALREADY_DELETED,*this);
- sal_Int32 nPos = static_cast<sal_Int32>((*m_aRow)[0]->getValue());
+ sal_Int32 nPos = (*m_aRow)[0]->getValue().getInt32();
m_bRowDeleted = m_pTable->DeleteRow(*m_xColumns);
if(m_bRowDeleted && m_pFileSet.is())
{
@@ -653,7 +651,7 @@ void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x )
void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateLong", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XRowUpdate::updateLong"_ustr, *this );
}
void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x )
@@ -838,7 +836,7 @@ again:
}
else if (m_pFileSet.is())
{
- sal_uInt32 nBookmarkValue = std::abs(static_cast<sal_Int32>((*m_aEvaluateRow)[0]->getValue()));
+ sal_uInt32 nBookmarkValue = std::abs((*m_aEvaluateRow)[0]->getValue().getInt32());
m_pFileSet->push_back(nBookmarkValue);
}
}
@@ -922,7 +920,7 @@ bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOff
// The FileCursor is outside of the valid range, if:
// a.) m_nRowPos < 1
// b.) a KeySet exists and m_nRowPos > m_pFileSet->size()
- if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= static_cast<sal_Int32>(m_pFileSet->size()) )) // && m_pFileSet->IsFrozen()
+ if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && o3tl::make_unsigned(m_nRowPos) >= m_pFileSet->size() )) // && m_pFileSet->IsFrozen()
{
goto Error;
}
@@ -995,8 +993,6 @@ bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOff
--m_nRowPos;
break;
case IResultSetHelper::FIRST:
- m_nRowPos = 0;
- break;
case IResultSetHelper::LAST:
m_nRowPos = 0;
break;
@@ -1137,14 +1133,14 @@ void OResultSet::sortRows()
++i;
}
- m_pSortIndex.reset(new OSortIndex(eKeyType,m_aOrderbyAscending));
+ m_pSortIndex.reset(new OSortIndex(std::move(eKeyType), std::vector(m_aOrderbyAscending)));
while ( ExecuteRow( IResultSetHelper::NEXT, 1, false ) )
{
(*m_aSelectRow)[0]->setValue( (*m_aRow)[0]->getValue() );
if ( m_pSQLAnalyzer->hasFunctions() )
m_pSQLAnalyzer->setSelectionEvaluationResult( m_aSelectRow, m_aColMapping );
- const sal_Int32 nBookmark = (*m_aRow->begin())->getValue();
+ const sal_Int32 nBookmark = (*m_aRow->begin())->getValue().getInt32();
ExecuteRow( IResultSetHelper::BOOKMARK, nBookmark, true, false );
}
@@ -1330,8 +1326,7 @@ void OResultSet::OpenImpl()
#endif
}
- m_pFileSet->erase(std::remove(m_pFileSet->begin(),m_pFileSet->end(),0)
- ,m_pFileSet->end());
+ std::erase(*m_pFileSet, 0);
}
}
}
@@ -1381,22 +1376,6 @@ void OResultSet::OpenImpl()
m_nFilePos = 0;
}
-Sequence< sal_Int8 > OResultSet::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OResultSet>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : 0;
-}
-
void OResultSet::setBoundedColumns(const OValueRefRow& _rRow,
const OValueRefRow& _rSelectRow,
const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
@@ -1514,12 +1493,12 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow,
}
}
-void SAL_CALL OResultSet::acquire() throw()
+void SAL_CALL OResultSet::acquire() noexcept
{
OResultSet_BASE::acquire();
}
-void SAL_CALL OResultSet::release() throw()
+void SAL_CALL OResultSet::release() noexcept
{
OResultSet_BASE::release();
}
@@ -1531,8 +1510,7 @@ Reference< css::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInf
void OResultSet::doTableSpecials(const OSQLTable& _xTable)
{
- Reference<css::lang::XUnoTunnel> xTunnel(_xTable, UNO_QUERY_THROW);
- m_pTable = reinterpret_cast< OFileTable* >(xTunnel->getSomething(OFileTable::getUnoTunnelId()));
+ m_pTable = dynamic_cast<OFileTable*>(_xTable.get());
assert(m_pTable.is());
}
@@ -1575,7 +1553,7 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO
sal_Int32 OResultSet::getDriverPos() const
{
- return (*m_aRow)[0]->getValue();
+ return (*m_aRow)[0]->getValue().getInt32();
}
bool OResultSet::isRowDeleted() const
@@ -1585,8 +1563,7 @@ bool OResultSet::isRowDeleted() const
void SAL_CALL OResultSet::disposing( const EventObject& Source )
{
- Reference<XPropertySet> xProp = m_pTable.get();
- if(m_pTable.is() && Source.Source == xProp)
+ if(m_pTable.is() && Source.Source == Reference<XPropertySet>(m_pTable))
{
m_pTable.clear();
}
diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx
index f68a06532bb7..44898d88242b 100644
--- a/connectivity/source/drivers/file/FResultSetMetaData.cxx
+++ b/connectivity/source/drivers/file/FResultSetMetaData.cxx
@@ -22,6 +22,8 @@
#include <comphelper/extract.hxx>
#include <connectivity/dbexception.hxx>
#include <comphelper/types.hxx>
+#include <o3tl/safeint.hxx>
+#include <utility>
using namespace ::comphelper;
@@ -33,12 +35,11 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-OResultSetMetaData::OResultSetMetaData(const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,const OUString& _aTableName,OFileTable* _pTable)
- :m_aTableName(_aTableName)
- ,m_xColumns(_rxColumns)
+OResultSetMetaData::OResultSetMetaData(::rtl::Reference<connectivity::OSQLColumns> _xColumns, OUString _aTableName, OFileTable* _pTable)
+ :m_aTableName(std::move(_aTableName))
+ ,m_xColumns(std::move(_xColumns))
,m_pTable(_pTable)
{
}
@@ -51,7 +52,7 @@ OResultSetMetaData::~OResultSetMetaData()
void OResultSetMetaData::checkColumnIndex(sal_Int32 column)
{
- if(column <= 0 || column > static_cast<sal_Int32>(m_xColumns->size()))
+ if(column <= 0 || o3tl::make_unsigned(column) > m_xColumns->size())
throwInvalidIndexException(*this);
}
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index 08c4f7fdd844..ee260fdb33e5 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -32,11 +32,13 @@
#include <com/sun/star/sdbc/FetchDirection.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
#include <strings.hrc>
#include <algorithm>
+#include <cstddef>
namespace connectivity::file
{
@@ -91,7 +93,7 @@ void OStatement_Base::disposeResultSet()
{
SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OStatement_Base::disposeResultSet" );
// free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
+ rtl::Reference< OResultSet > xComp(m_xResultSet.get());
assert(xComp.is() || !m_xResultSet.get().is());
if (xComp.is())
xComp->dispose();
@@ -128,12 +130,12 @@ void OStatement_BASE2::disposing()
OStatement_Base::disposing();
}
-void SAL_CALL OStatement_Base::acquire() throw()
+void SAL_CALL OStatement_Base::acquire() noexcept
{
OStatement_BASE::acquire();
}
-void SAL_CALL OStatement_BASE2::release() throw()
+void SAL_CALL OStatement_BASE2::release() noexcept
{
OStatement_BASE::release();
}
@@ -173,7 +175,7 @@ void OStatement_Base::closeResultSet()
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- Reference< XCloseable > xCloseable(m_xResultSet.get(), UNO_QUERY);
+ rtl::Reference< OResultSet > xCloseable(m_xResultSet.get());
assert(xCloseable.is() || !m_xResultSet.get().is());
if (xCloseable.is())
{
@@ -192,7 +194,7 @@ Any SAL_CALL OStatement_Base::getWarnings( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return makeAny(m_aLastWarning);
+ return Any(m_aLastWarning);
}
void SAL_CALL OStatement_Base::clearWarnings( )
@@ -216,19 +218,19 @@ void SAL_CALL OStatement_Base::clearWarnings( )
return *getArrayHelper();
}
-OResultSet* OStatement::createResultSet()
+rtl::Reference<OResultSet> OStatement::createResultSet()
{
return new OResultSet(this,m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbc.driver.file.Statement","com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(OStatement,u"com.sun.star.sdbc.driver.file.Statement"_ustr,u"com.sun.star.sdbc.Statement"_ustr);
-void SAL_CALL OStatement::acquire() throw()
+void SAL_CALL OStatement::acquire() noexcept
{
OStatement_BASE2::acquire();
}
-void SAL_CALL OStatement::release() throw()
+void SAL_CALL OStatement::release() noexcept
{
OStatement_BASE2::release();
}
@@ -250,20 +252,18 @@ Reference< XResultSet > SAL_CALL OStatement::executeQuery( const OUString& sql )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
construct(sql);
- Reference< XResultSet > xRS;
- OResultSet* pResult = createResultSet();
- xRS = pResult;
- initializeResultSet(pResult);
- m_xResultSet = xRS;
+ rtl::Reference<OResultSet> pResult = createResultSet();
+ initializeResultSet(pResult.get());
+ m_xResultSet = pResult.get();
pResult->OpenImpl();
- return xRS;
+ return pResult;
}
Reference< XConnection > SAL_CALL OStatement::getConnection( )
{
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
sal_Int32 SAL_CALL OStatement::executeUpdate( const OUString& sql )
@@ -302,9 +302,9 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType )
return aRet.hasValue() ? aRet : OStatement_BASE2::queryInterface( rType);
}
-void OStatement_Base::anylizeSQL()
+void OStatement_Base::analyzeSQL()
{
- OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::anylizeSQL: Analyzer isn't set!");
+ OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::analyzeSQL: Analyzer isn't set!");
// start analysing the statement
m_pSQLAnalyzer->setOrigColumns(m_xColNames);
m_pSQLAnalyzer->start(m_pParseTree);
@@ -394,16 +394,19 @@ void OStatement_Base::construct(const OUString& sql)
case OSQLStatementType::Unknown:
m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
break;
+ case OSQLStatementType::Select:
+ if(SQL_ISRULE(m_aSQLIterator.getParseTree(), union_statement))
+ {
+ m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX, *this);
+ }
+ assert(SQL_ISRULE(m_aSQLIterator.getParseTree(), select_statement));
+ break;
default:
break;
}
// at this moment we support only one table per select statement
- Reference< css::lang::XUnoTunnel> xTunnel(rTabs.begin()->second,UNO_QUERY);
- if(xTunnel.is())
- {
- m_pTable = reinterpret_cast<OFileTable*>(xTunnel->getSomething(OFileTable::getUnoTunnelId()));
- }
+ m_pTable = dynamic_cast<OFileTable*>(rTabs.begin()->second.get());
OSL_ENSURE(m_pTable.is(),"No table!");
if ( m_pTable.is() )
m_xColNames = m_pTable->getColumns();
@@ -428,7 +431,7 @@ void OStatement_Base::construct(const OUString& sql)
m_pSQLAnalyzer.reset( new OSQLAnalyzer(m_pConnection.get()) );
- anylizeSQL();
+ analyzeSQL();
}
void OStatement_Base::createColumnMapping()
@@ -436,7 +439,7 @@ void OStatement_Base::createColumnMapping()
// initialize the column index map (mapping select columns to table columns)
::rtl::Reference<connectivity::OSQLColumns> xColumns = m_aSQLIterator.getSelectColumns();
m_aColMapping.resize(xColumns->size() + 1);
- for (sal_Int32 i=0; i<static_cast<sal_Int32>(m_aColMapping.size()); ++i)
+ for (std::size_t i=0; i<m_aColMapping.size(); ++i)
m_aColMapping[i] = i;
Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
@@ -449,10 +452,10 @@ void OStatement_Base::initializeResultSet(OResultSet* _pResult)
GetAssignValues();
_pResult->setSqlAnalyzer(m_pSQLAnalyzer.get());
- _pResult->setOrderByColumns(m_aOrderbyColumnNumber);
- _pResult->setOrderByAscending(m_aOrderbyAscending);
+ _pResult->setOrderByColumns(std::vector(m_aOrderbyColumnNumber));
+ _pResult->setOrderByAscending(std::vector(m_aOrderbyAscending));
_pResult->setBindingRow(m_aRow);
- _pResult->setColumnMapping(m_aColMapping);
+ _pResult->setColumnMapping(std::vector(m_aColMapping));
_pResult->setEvaluationRow(m_aEvaluateRow);
_pResult->setAssignValues(m_aAssignValues);
_pResult->setSelectRow(m_aSelectRow);
@@ -494,11 +497,8 @@ void OStatement_Base::GetAssignValues()
OSL_ENSURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Error in Parse Tree");
if (pOptColumnCommalist->count() == 0)
{
- const Sequence< OUString>& aNames = m_xColNames->getElementNames();
- const OUString* pBegin = aNames.getConstArray();
- const OUString* pEnd = pBegin + aNames.getLength();
- for (; pBegin != pEnd; ++pBegin)
- aColumnNameList.push_back(*pBegin);
+ const Sequence< OUString> aNames = m_xColNames->getElementNames();
+ aColumnNameList.insert(aColumnNameList.end(), aNames.begin(), aNames.end());
}
else
{
@@ -574,7 +574,7 @@ void OStatement_Base::GetAssignValues()
OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Error in Parse Tree");
OSQLParseNode * pAssignmentCommalist = m_pParseTree->getChild(3);
- OSL_ENSURE(pAssignmentCommalist != nullptr,"OResultSet: pAssignmentCommalist == NULL");
+ assert(pAssignmentCommalist && "OResultSet: pAssignmentCommalist == NULL");
OSL_ENSURE(SQL_ISRULE(pAssignmentCommalist,assignment_commalist),"OResultSet: Error in Parse Tree");
OSL_ENSURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0");
@@ -583,15 +583,15 @@ void OStatement_Base::GetAssignValues()
for (size_t i = 0; i < pAssignmentCommalist->count(); i++)
{
OSQLParseNode * pAssignment = pAssignmentCommalist->getChild(i);
- OSL_ENSURE(pAssignment != nullptr,"OResultSet: pAssignment == NULL");
+ assert(pAssignment && "OResultSet: pAssignment == NULL");
OSL_ENSURE(SQL_ISRULE(pAssignment,assignment),"OResultSet: Error in Parse Tree");
OSL_ENSURE(pAssignment->count() == 3,"OResultSet: pAssignment->count() != 3");
OSQLParseNode * pCol = pAssignment->getChild(0);
- OSL_ENSURE(pCol != nullptr,"OResultSet: pCol == NULL");
+ assert(pCol && "OResultSet: pCol == NULL");
OSQLParseNode * pComp = pAssignment->getChild(1);
- OSL_ENSURE(pComp != nullptr,"OResultSet: pComp == NULL");
+ assert(pComp && "OResultSet: pComp == NULL");
OSL_ENSURE(pComp->getNodeType() == SQLNodeType::Equal,"OResultSet: pComp->getNodeType() != SQLNodeType::Comparison");
if (pComp->getTokenValue().toChar() != '=')
{
@@ -610,9 +610,9 @@ void OStatement_Base::GetAssignValues()
void OStatement_Base::ParseAssignValues(const std::vector< OUString>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem, sal_Int32 nIndex)
{
OSL_ENSURE(o3tl::make_unsigned(nIndex) <= aColumnNameList.size(),"SdbFileCursor::ParseAssignValues: nIndex > aColumnNameList.GetTokenCount()");
- OUString aColumnName(aColumnNameList[nIndex]);
+ const OUString& aColumnName(aColumnNameList[nIndex]);
OSL_ENSURE(aColumnName.getLength() > 0,"OResultSet: Column-Name not found");
- OSL_ENSURE(pRow_Value_Constructor_Elem != nullptr,"OResultSet: pRow_Value_Constructor_Elem must not be NULL!");
+ assert(pRow_Value_Constructor_Elem != nullptr && "OResultSet: pRow_Value_Constructor_Elem must not be NULL!");
if (pRow_Value_Constructor_Elem->getNodeType() == SQLNodeType::String ||
pRow_Value_Constructor_Elem->getNodeType() == SQLNodeType::IntNum ||
@@ -659,14 +659,6 @@ void OStatement_Base::SetAssignValue(const OUString& aColumnName,
{
switch (::comphelper::getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))))
{
- // put criteria depending on the Type as String or double in the variable
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- *(*m_aAssignValues)[nId] = ORowSetValue(aValue);
- //Characterset is already converted, since the entire statement was converted
- break;
-
case DataType::BIT:
if (aValue.equalsIgnoreAsciiCase("TRUE") || aValue[0] == '1')
*(*m_aAssignValues)[nId] = true;
@@ -675,6 +667,10 @@ void OStatement_Base::SetAssignValue(const OUString& aColumnName,
else
throwFunctionSequenceException(*this);
break;
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ //Characterset is already converted, since the entire statement was converted
case DataType::TINYINT:
case DataType::SMALLINT:
case DataType::INTEGER:
diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx
index 8bac436e07be..d02c7cce1737 100644
--- a/connectivity/source/drivers/file/FStringFunctions.cxx
+++ b/connectivity/source/drivers/file/FStringFunctions.cxx
@@ -18,6 +18,8 @@
*/
#include <file/FStringFunctions.hxx>
+
+#include <comphelper/string.hxx>
#include <rtl/ustrbuf.hxx>
using namespace connectivity;
@@ -61,14 +63,14 @@ ORowSetValue OOp_Char::operate(const std::vector<ORowSetValue>& lhs) const
if (lhs.empty())
return ORowSetValue();
- OUStringBuffer sRet;
+ OUStringBuffer sRet(static_cast<sal_Int32>(lhs.size()));
std::vector<ORowSetValue>::const_reverse_iterator aIter = lhs.rbegin();
std::vector<ORowSetValue>::const_reverse_iterator aEnd = lhs.rend();
for (; aIter != aEnd; ++aIter)
{
if (!aIter->isNull())
{
- char c = static_cast<char>(static_cast<sal_Int32>(*aIter));
+ char c = static_cast<char>(aIter->getInt32());
sRet.appendAscii(&c, 1);
}
@@ -90,7 +92,7 @@ ORowSetValue OOp_Concat::operate(const std::vector<ORowSetValue>& lhs) const
if (aIter->isNull())
return ORowSetValue();
- sRet.append(aIter->operator OUString());
+ sRet.append(aIter->getString());
}
return sRet.makeStringAndClear();
@@ -108,7 +110,7 @@ ORowSetValue OOp_Locate::operate(const std::vector<ORowSetValue>& lhs) const
else if (lhs.size() != 3)
return ORowSetValue();
- return lhs[1].getString().indexOf(lhs[2].getString(), lhs[0]) + 1;
+ return lhs[1].getString().indexOf(lhs[2].getString(), lhs[0].getInt32()) + 1;
}
ORowSetValue OOp_SubString::operate(const std::vector<ORowSetValue>& lhs) const
@@ -117,13 +119,13 @@ ORowSetValue OOp_SubString::operate(const std::vector<ORowSetValue>& lhs) const
[](const ORowSetValue& rValue) { return rValue.isNull(); }))
return ORowSetValue();
- if (lhs.size() == 2 && static_cast<sal_Int32>(lhs[0]) >= sal_Int32(0))
- return lhs[1].getString().copy(static_cast<sal_Int32>(lhs[0]) - 1);
+ if (lhs.size() == 2 && lhs[0].getInt32() >= sal_Int32(0))
+ return lhs[1].getString().copy(lhs[0].getInt32() - 1);
- else if (lhs.size() != 3 || static_cast<sal_Int32>(lhs[1]) < sal_Int32(0))
+ else if (lhs.size() != 3 || lhs[1].getInt32() < sal_Int32(0))
return ORowSetValue();
- return lhs[2].getString().copy(static_cast<sal_Int32>(lhs[1]) - 1, lhs[0]);
+ return lhs[2].getString().copy(lhs[1].getInt32() - 1, lhs[0].getInt32());
}
ORowSetValue OOp_LTrim::operate(const ORowSetValue& lhs) const
@@ -131,7 +133,7 @@ ORowSetValue OOp_LTrim::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- OUString sRet = lhs;
+ OUString sRet = lhs.getString();
OUString sNew = sRet.trim();
return sRet.copy(sRet.indexOf(sNew));
}
@@ -141,7 +143,7 @@ ORowSetValue OOp_RTrim::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- OUString sRet = lhs;
+ OUString sRet = lhs.getString();
OUString sNew = sRet.trim();
return sRet.copy(0, sRet.lastIndexOf(sNew[sNew.getLength() - 1]) + 1);
}
@@ -151,13 +153,9 @@ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const
if (lhs.isNull())
return lhs;
- const char c = ' ';
- OUStringBuffer sRet;
- sal_Int32 nCount = lhs;
- for (sal_Int32 i = 0; i < nCount; ++i)
- {
- sRet.appendAscii(&c, 1);
- }
+ sal_Int32 nCount = std::max(lhs.getInt32(), sal_Int32(0));
+ OUStringBuffer sRet(nCount);
+ comphelper::string::padToLength(sRet, nCount, ' ');
return sRet.makeStringAndClear();
}
@@ -166,17 +164,10 @@ ORowSetValue OOp_Replace::operate(const std::vector<ORowSetValue>& lhs) const
if (lhs.size() != 3)
return ORowSetValue();
- OUString sStr = lhs[2];
- OUString sFrom = lhs[1];
- OUString sTo = lhs[0];
- sal_Int32 nIndexOf = sStr.indexOf(sFrom);
- while (nIndexOf != -1)
- {
- sStr = sStr.replaceAt(nIndexOf, sFrom.getLength(), sTo);
- nIndexOf = sStr.indexOf(sFrom, nIndexOf + sTo.getLength());
- }
-
- return sStr;
+ OUString sStr = lhs[2].getString();
+ OUString sFrom = lhs[1].getString();
+ OUString sTo = lhs[0].getString();
+ return sStr.replaceAll(sFrom, sTo);
}
ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs, const ORowSetValue& rhs) const
@@ -184,11 +175,12 @@ ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs, const ORowSetValue& rh
if (lhs.isNull() || rhs.isNull())
return lhs;
- OUStringBuffer sRet;
- sal_Int32 nCount = rhs;
+ const OUString s = lhs.getString();
+ const sal_Int32 nCount = std::max(rhs.getInt32(), sal_Int32(0));
+ OUStringBuffer sRet(s.getLength() * nCount);
for (sal_Int32 i = 0; i < nCount; ++i)
{
- sRet.append(lhs.operator OUString());
+ sRet.append(s);
}
return sRet.makeStringAndClear();
}
@@ -198,12 +190,12 @@ ORowSetValue OOp_Insert::operate(const std::vector<ORowSetValue>& lhs) const
if (lhs.size() != 4)
return ORowSetValue();
- OUString sStr = lhs[3];
+ OUString sStr = lhs[3].getString();
- sal_Int32 nStart = static_cast<sal_Int32>(lhs[2]);
+ sal_Int32 nStart = lhs[2].getInt32();
if (nStart < 1)
nStart = 1;
- return sStr.replaceAt(nStart - 1, static_cast<sal_Int32>(lhs[1]), lhs[0]);
+ return sStr.replaceAt(nStart - 1, lhs[1].getInt32(), lhs[0].getString());
}
ORowSetValue OOp_Left::operate(const ORowSetValue& lhs, const ORowSetValue& rhs) const
@@ -211,8 +203,8 @@ ORowSetValue OOp_Left::operate(const ORowSetValue& lhs, const ORowSetValue& rhs)
if (lhs.isNull() || rhs.isNull())
return lhs;
- OUString sRet = lhs;
- sal_Int32 nCount = rhs;
+ OUString sRet = lhs.getString();
+ sal_Int32 nCount = rhs.getInt32();
if (nCount < 0)
return ORowSetValue();
return sRet.copy(0, nCount);
@@ -223,8 +215,8 @@ ORowSetValue OOp_Right::operate(const ORowSetValue& lhs, const ORowSetValue& rhs
if (lhs.isNull() || rhs.isNull())
return lhs;
- sal_Int32 nCount = rhs;
- OUString sRet = lhs;
+ sal_Int32 nCount = rhs.getInt32();
+ OUString sRet = lhs.getString();
if (nCount < 0 || nCount >= sRet.getLength())
return ORowSetValue();
diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx
index b47bfb811a1f..120af8a61a11 100644
--- a/connectivity/source/drivers/file/FTable.cxx
+++ b/connectivity/source/drivers/file/FTable.cxx
@@ -23,7 +23,6 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <unotools/ucbstreamhelper.hxx>
using namespace connectivity;
@@ -75,7 +74,7 @@ void OFileTable::refreshColumns()
{
::std::vector< OUString> aVector;
Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(),
- m_SchemaName,m_Name, "%");
+ m_SchemaName,m_Name, u"%"_ustr);
if(xResult.is())
{
@@ -87,7 +86,7 @@ void OFileTable::refreshColumns()
if(m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = new OColumns(this,m_aMutex,aVector);
+ m_xColumns.reset(new OColumns(this,m_aMutex,aVector));
}
void OFileTable::refreshKeys()
@@ -119,29 +118,10 @@ void SAL_CALL OFileTable::disposing()
FileClose();
}
-Sequence< sal_Int8 > OFileTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId s_Id;
-
- return s_Id.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return isUnoTunnelId<OFileTable>(rId)
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
-
void OFileTable::FileClose()
{
::osl::MutexGuard aGuard(m_aMutex);
- if (m_pFileStream && m_pFileStream->IsWritable())
- m_pFileStream->Flush();
-
m_pFileStream.reset();
m_pBuffer.reset();
}
diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx
index c063f4a890e6..25321b1721af 100644
--- a/connectivity/source/drivers/file/FTables.cxx
+++ b/connectivity/source/drivers/file/FTables.cxx
@@ -23,14 +23,12 @@
using namespace connectivity;
using namespace connectivity::file;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-sdbcx::ObjectType OTables::createObject(const OUString& /*_rName*/)
+css::uno::Reference< css::beans::XPropertySet > OTables::createObject(const OUString& /*_rName*/)
{
- return sdbcx::ObjectType();
+ return nullptr;
}
void OTables::impl_refresh( )
diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx
index a0d1305f6f89..0a749cc3b22d 100644
--- a/connectivity/source/drivers/file/fanalyzer.cxx
+++ b/connectivity/source/drivers/file/fanalyzer.cxx
@@ -28,7 +28,6 @@ using namespace ::connectivity;
using namespace ::connectivity::file;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
OSQLAnalyzer::OSQLAnalyzer(OConnection* _pConnection)
diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx
index 36cba4a73485..ec56032c8491 100644
--- a/connectivity/source/drivers/file/fcode.cxx
+++ b/connectivity/source/drivers/file/fcode.cxx
@@ -20,11 +20,10 @@
#include <file/fcode.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
-#include <connectivity/sqlparse.hxx>
+#include <connectivity/sqlnode.hxx>
#include <sqlbison.hxx>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
-using namespace ::comphelper;
using namespace connectivity;
using namespace connectivity::file;
using namespace ::com::sun::star::sdbc;
@@ -63,32 +62,14 @@ void OOperandValue::setValue(const ORowSetValue& _rVal)
m_aValue = _rVal;
}
-OOperandParam::OOperandParam(OSQLParseNode const * pNode, sal_Int32 _nPos)
+OOperandParam::OOperandParam(sal_Int32 _nPos)
: OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR) // Standard-Type
{
- OSL_ENSURE(SQL_ISRULE(pNode,parameter),"Argument is not a parameter");
- OSL_ENSURE(pNode->count() > 0,"Error in Parse Tree");
- OSQLParseNode *pMark = pNode->getChild(0);
-
- OUString aParameterName;
- if (SQL_ISPUNCTUATION(pMark, "?"))
- aParameterName = "?";
- else if (SQL_ISPUNCTUATION(pMark, ":"))
- aParameterName = pNode->getChild(1)->getTokenValue();
- else
- {
- SAL_WARN( "connectivity.drivers","Error in Parse Tree");
- }
-
- // set up Parameter-Column with default type, can be specified more precisely later using Describe-Parameter
-
- // save Identity (not especially necessary here, just for the sake of symmetry)
-
- // todo
- // OColumn* pColumn = new OFILEColumn(aParameterName,eDBType,255,0,SQL_FLAGS_NULLALLOWED);
- // rParamColumns->AddColumn(pColumn);
-
- // the value will be set just before the evaluation
+ //TODO: Actually do something here (the current state of OOperandParam appears to be "the
+ // remains of the very beginnings of a never finished implementation of support for parameters
+ // in this code", as Lionel put it in the comments at <https://gerrit.libreoffice.org/c/core/+/
+ // 116839/1#message-7b2bbf3543f559a0b67dc35cd940e2ab8829c274> "-Werror,-Wunused-but-set-variable
+ // (Clang 13 trunk)").
}
@@ -249,7 +230,7 @@ bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
{
- OUString sLH = aLH, sRH = aRH;
+ OUString sLH = aLH.getString(), sRH = aRH.getString();
sal_Int32 nRes = sLH.compareToIgnoreAsciiCase(sRH);
switch(aPredicateType)
{
@@ -274,7 +255,7 @@ bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const
case DataType::DATE:
case DataType::TIME:
{
- double n = aLH ,m = aRH;
+ double n = aLH.getDouble(), m = aRH.getDouble();
switch (aPredicateType)
{
@@ -303,7 +284,7 @@ void ONumOperator::Exec(OCodeStack& rCodeStack)
OOperand *pLeft = rCodeStack.top();
rCodeStack.pop();
- rCodeStack.push(new OOperandResultNUM(operate(pLeft->getValue(), pRight->getValue())));
+ rCodeStack.push(new OOperandResultNUM(operate(pLeft->getValue().getDouble(), pRight->getValue().getDouble())));
if( typeid(OOperandResult) == typeid(*pLeft))
delete pLeft;
if( typeid(OOperandResult) == typeid(*pRight))
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index 982d0266b949..86ed7d4cf8c5 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -22,9 +22,6 @@
#include <connectivity/sqlparse.hxx>
#include <file/fanalyzer.hxx>
#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/util/Time.hpp>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbconversion.hxx>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
@@ -32,7 +29,7 @@
#include <file/FDateFunctions.hxx>
#include <file/FNumericFunctions.hxx>
#include <file/FConnection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sqlbison.hxx>
#include <strings.hrc>
@@ -78,7 +75,7 @@ void OPredicateCompiler::start(OSQLParseNode const * pSQLParseNode)
DBG_ASSERT(pSQLParseNode->count() >= 4,"OFILECursor: Error in Parse Tree");
OSQLParseNode * pTableExp = pSQLParseNode->getChild(3);
- DBG_ASSERT(pTableExp != nullptr,"Error in Parse Tree");
+ assert(pTableExp && "Error in Parse Tree");
DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Error in Parse Tree");
DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Error in Parse Tree");
@@ -333,12 +330,12 @@ void OPredicateCompiler::execute_BETWEEN(OSQLParseNode const * pPredicateNode)
OOperand* pColumnOp = execute(pColumn);
OOperand* pOb1 = execute(p1stValue);
- OBoolOperator* pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::LESS_EQUAL : SQLFilterOperator::GREATER);
+ OBoolOperator* pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::LESS : SQLFilterOperator::GREATER_EQUAL);
m_aCodeList.emplace_back(pOperator);
execute(pColumn);
OOperand* pOb2 = execute(p2ndtValue);
- pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::GREATER_EQUAL : SQLFilterOperator::LESS);
+ pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::GREATER : SQLFilterOperator::LESS_EQUAL);
m_aCodeList.emplace_back(pOperator);
if ( pColumnOp && pOb1 && pOb2 )
@@ -353,29 +350,26 @@ void OPredicateCompiler::execute_BETWEEN(OSQLParseNode const * pPredicateNode)
break;
case DataType::DECIMAL:
case DataType::NUMERIC:
- pOb1->setValue(static_cast<double>(pOb1->getValue()));
- pOb2->setValue(static_cast<double>(pOb2->getValue()));
- break;
- case DataType::FLOAT:
- pOb1->setValue(static_cast<float>(pOb1->getValue()));
- pOb2->setValue(static_cast<float>(pOb2->getValue()));
- break;
case DataType::DOUBLE:
case DataType::REAL:
- pOb1->setValue(static_cast<double>(pOb1->getValue()));
- pOb2->setValue(static_cast<double>(pOb2->getValue()));
+ pOb1->setValue(pOb1->getValue().getDouble());
+ pOb2->setValue(pOb2->getValue().getDouble());
+ break;
+ case DataType::FLOAT:
+ pOb1->setValue(pOb1->getValue().getFloat());
+ pOb2->setValue(pOb2->getValue().getFloat());
break;
case DataType::DATE:
- pOb1->setValue(static_cast<util::Date>(pOb1->getValue()));
- pOb2->setValue(static_cast<util::Date>(pOb2->getValue()));
+ pOb1->setValue(pOb1->getValue().getDate());
+ pOb2->setValue(pOb2->getValue().getDate());
break;
case DataType::TIME:
- pOb1->setValue(static_cast<util::Time>(pOb1->getValue()));
- pOb2->setValue(static_cast<util::Time>(pOb2->getValue()));
+ pOb1->setValue(pOb1->getValue().getTime());
+ pOb2->setValue(pOb2->getValue().getTime());
break;
case DataType::TIMESTAMP:
- pOb1->setValue(static_cast<util::DateTime>(pOb1->getValue()));
- pOb2->setValue(static_cast<util::DateTime>(pOb2->getValue()));
+ pOb1->setValue(pOb1->getValue().getDateTime());
+ pOb2->setValue(pOb2->getValue().getDateTime());
break;
}
}
@@ -457,7 +451,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode const * pPredicateNo
}
else if (SQL_ISRULE(pPredicateNode,parameter))
{
- pOperand = new OOperandParam(pPredicateNode, ++m_nParamCounter);
+ pOperand = new OOperandParam(++m_nParamCounter);
}
else if (pPredicateNode->getNodeType() == SQLNodeType::String ||
pPredicateNode->getNodeType() == SQLNodeType::IntNum ||
@@ -533,8 +527,6 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode const * pPredicateNo
bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
{
- static bool bResult;
-
if (!(rCodeList[0]))
return true; // no Predicate
@@ -551,9 +543,9 @@ bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
m_aStack.pop();
DBG_ASSERT(m_aStack.empty(), "Stack error");
- DBG_ASSERT(pOperand, "Stack error");
+ assert(pOperand && "Stack error");
- bResult = pOperand->isValid();
+ const bool bResult = pOperand->isValid();
if (typeid(OOperandResult) == typeid(*pOperand))
delete pOperand;
return bResult;
@@ -577,7 +569,7 @@ void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList, ORowSetValue
m_aStack.pop();
DBG_ASSERT(m_aStack.empty(), "Stack error");
- DBG_ASSERT(pOperand, "Stack error");
+ assert(pOperand && "Stack error");
(*_rVal) = pOperand->getValue();
if (typeid(OOperandResult) == typeid(*pOperand))
diff --git a/connectivity/source/drivers/firebird/Blob.cxx b/connectivity/source/drivers/firebird/Blob.cxx
index 8ed9fc4a8ac7..774246fa18d4 100644
--- a/connectivity/source/drivers/firebird/Blob.cxx
+++ b/connectivity/source/drivers/firebird/Blob.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -19,7 +19,7 @@
#include <connectivity/CommonTools.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::connectivity::firebird;
@@ -67,7 +67,7 @@ void Blob::ensureBlobIsOpened()
nullptr);
if (aErr)
- evaluateStatusVector(m_statusVector, "isc_open_blob2", *this);
+ evaluateStatusVector(m_statusVector, u"isc_open_blob2", *this);
m_bBlobOpened = true;
m_nBlobPosition = 0;
@@ -90,7 +90,7 @@ void Blob::ensureBlobIsOpened()
aResultBuffer);
if (aErr)
- evaluateStatusVector(m_statusVector, "isc_blob_info", *this);
+ evaluateStatusVector(m_statusVector, u"isc_blob_info", *this);
char* pIt = aResultBuffer;
while( *pIt != isc_info_end ) // info is in clusters
@@ -122,28 +122,31 @@ sal_uInt16 Blob::getMaximumSegmentSize()
return m_nMaxSegmentSize;
}
-bool Blob::readOneSegment(uno::Sequence< sal_Int8 >& rDataOut)
+bool Blob::readOneSegment(std::vector<char>& rDataOut)
{
checkDisposed(Blob_BASE::rBHelper.bDisposed);
ensureBlobIsOpened();
sal_uInt16 nMaxSize = getMaximumSegmentSize();
- if(rDataOut.getLength() < nMaxSize)
- rDataOut.realloc(nMaxSize);
+ if(rDataOut.size() < nMaxSize)
+ rDataOut.resize(nMaxSize);
sal_uInt16 nActualSize = 0;
ISC_STATUS aRet = isc_get_segment(m_statusVector,
&m_blobHandle,
&nActualSize,
nMaxSize,
- reinterpret_cast<char*>(rDataOut.getArray()) );
+ rDataOut.data() );
if (aRet && aRet != isc_segstr_eof && IndicatesError(m_statusVector))
{
- OUString sError(StatusVectorToString(m_statusVector, "isc_get_segment"));
+ OUString sError(StatusVectorToString(m_statusVector, u"isc_get_segment"));
throw IOException(sError, *this);
}
+
+ if (rDataOut.size() > nActualSize)
+ rDataOut.resize(nActualSize);
m_nBlobPosition += nActualSize;
return aRet == isc_segstr_eof; // last segment read
}
@@ -160,7 +163,7 @@ void Blob::closeBlob()
aErr = isc_close_blob(m_statusVector,
&m_blobHandle);
if (aErr)
- evaluateStatusVector(m_statusVector, "isc_close_blob", *this);
+ evaluateStatusVector(m_statusVector, u"isc_close_blob", *this);
m_bBlobOpened = false;
#if SAL_TYPES_SIZEOFPOINTER == 8
@@ -202,7 +205,7 @@ uno::Sequence< sal_Int8 > SAL_CALL Blob::getBytes(sal_Int64 nPosition,
ensureBlobIsOpened();
if (nPosition > m_nBlobLength || nPosition < 1)
- throw lang::IllegalArgumentException("nPosition out of range", *this, 0);
+ throw lang::IllegalArgumentException(u"nPosition out of range"_ustr, *this, 0);
// We only have to read as many bytes as are available, i.e. nPosition+nBytes
// can legally be greater than the total length, hence we don't bother to check.
@@ -231,15 +234,13 @@ uno::Reference< XInputStream > SAL_CALL Blob::getBinaryStream()
sal_Int64 SAL_CALL Blob::position(const uno::Sequence< sal_Int8 >& /*rPattern*/,
sal_Int64 /*nStart*/)
{
- ::dbtools::throwFeatureNotImplementedSQLException("Blob::position", *this);
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException(u"Blob::position"_ustr, *this);
}
sal_Int64 SAL_CALL Blob::positionOfBlob(const uno::Reference< XBlob >& /*rPattern*/,
sal_Int64 /*aStart*/)
{
- ::dbtools::throwFeatureNotImplementedSQLException("Blob::positionOfBlob", *this);
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException(u"Blob::positionOfBlob"_ustr, *this);
}
// ---- XInputStream ----------------------------------------------------------
@@ -299,7 +300,7 @@ sal_Int32 SAL_CALL Blob::readBytes(uno::Sequence< sal_Int8 >& rDataOut,
reinterpret_cast<char*>(rDataOut.getArray()) + nTotalBytesRead);
if (aErr && IndicatesError(m_statusVector))
{
- OUString sError(StatusVectorToString(m_statusVector, "isc_get_segment"));
+ OUString sError(StatusVectorToString(m_statusVector, u"isc_get_segment"));
throw IOException(sError, *this);
}
nTotalBytesRead += nBytesRead;
@@ -385,4 +386,4 @@ void SAL_CALL Blob::closeInput()
}
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Blob.hxx b/connectivity/source/drivers/firebird/Blob.hxx
index 9cad65a3c05f..80a23459288e 100644
--- a/connectivity/source/drivers/firebird/Blob.hxx
+++ b/connectivity/source/drivers/firebird/Blob.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_BLOB_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_BLOB_HXX
+#pragma once
#include <ibase.h>
@@ -17,84 +16,85 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/sdbc/XBlob.hpp>
+#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(css::uno::Sequence< sal_Int8 >& 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_BLOB_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Catalog.cxx b/connectivity/source/drivers/firebird/Catalog.cxx
index 47fedab60d59..aba0784662a7 100644
--- a/connectivity/source/drivers/firebird/Catalog.cxx
+++ b/connectivity/source/drivers/firebird/Catalog.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -10,6 +10,7 @@
#include "Catalog.hxx"
#include "Tables.hxx"
#include "Users.hxx"
+#include "Views.hxx"
#include <com/sun/star/sdbc/XRow.hpp>
@@ -27,13 +28,11 @@ Catalog::Catalog(const uno::Reference< XConnection >& rConnection):
//----- OCatalog -------------------------------------------------------------
void Catalog::refreshTables()
{
- Sequence< OUString > aTypes(2);
- aTypes[0] = "TABLE";
- aTypes[1] = "VIEW";
+ Sequence< OUString > aTypes {u"TABLE"_ustr, u"VIEW"_ustr};
uno::Reference< XResultSet > xTables = m_xMetaData->getTables(Any(),
- "%",
- "%",
+ u"%"_ustr,
+ u"%"_ustr,
aTypes);
if (!xTables.is())
@@ -55,8 +54,20 @@ void Catalog::refreshTables()
void Catalog::refreshViews()
{
- // TODO: implement me.
- // Sets m_pViews (OCatalog)
+ css::uno::Reference<css::sdbc::XResultSet> xViews
+ = m_xMetaData->getTables(css::uno::Any(), u"%"_ustr, u"%"_ustr, { u"VIEW"_ustr });
+
+ if (!xViews.is())
+ return;
+
+ ::std::vector<OUString> aViewNames;
+
+ fillNames(xViews, aViewNames);
+
+ if (!m_pViews)
+ m_pViews.reset(new Views(m_xConnection, *this, m_aMutex, aViewNames));
+ else
+ m_pViews->reFill(aViewNames);
}
//----- IRefreshableGroups ---------------------------------------------------
@@ -69,7 +80,7 @@ void Catalog::refreshGroups()
void Catalog::refreshUsers()
{
Reference<XStatement> xStmt= m_xMetaData->getConnection()->createStatement();
- uno::Reference< XResultSet > xUsers = xStmt->executeQuery("SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES");
+ uno::Reference< XResultSet > xUsers = xStmt->executeQuery(u"SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES"_ustr);
if (!xUsers.is())
return;
@@ -90,4 +101,5 @@ void Catalog::refreshUsers()
else
m_pUsers->reFill(aUserNames);
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Catalog.hxx b/connectivity/source/drivers/firebird/Catalog.hxx
index 1ac364bc845c..7ae15960546b 100644
--- a/connectivity/source/drivers/firebird/Catalog.hxx
+++ b/connectivity/source/drivers/firebird/Catalog.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,34 +7,34 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CATALOG_HXX
+#pragma once
#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;
-} // namespace connectivity::firebird
+ sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); }
+ sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); }
+ };
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CATALOG_HXX
+} // namespace connectivity::firebird
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Clob.cxx b/connectivity/source/drivers/firebird/Clob.cxx
index 2038dfc11350..95d14c11d08d 100644
--- a/connectivity/source/drivers/firebird/Clob.cxx
+++ b/connectivity/source/drivers/firebird/Clob.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -9,8 +9,6 @@
#include <sal/config.h>
-#include <string_view>
-
#include "Clob.hxx"
#include "Blob.hxx"
@@ -54,13 +52,11 @@ sal_Int64 SAL_CALL Clob::length()
// Read each segment, and calculate it's size by interpreting it as a
// character stream. Assume that no characters are split by the segments.
bool bLastSegmRead = false;
+ std::vector<char> aSegmentBytes;
do
{
- uno::Sequence < sal_Int8 > aSegmentBytes;
bLastSegmRead = m_aBlob->readOneSegment( aSegmentBytes );
- OUString sSegment ( reinterpret_cast< char *>( aSegmentBytes.getArray() ),
- aSegmentBytes.getLength(),
- RTL_TEXTENCODING_UTF8 );
+ OUString sSegment(aSegmentBytes.data(), aSegmentBytes.size(), RTL_TEXTENCODING_UTF8);
if( !bLastSegmRead)
m_nCharCount += sSegment.getLength();
@@ -73,60 +69,51 @@ sal_Int64 SAL_CALL Clob::length()
OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition,
sal_Int32 nLength)
{
+ if (nPosition < 1) // XClob is indexed from 1
+ throw lang::IllegalArgumentException(u"nPosition < 1"_ustr, *this, 0);
+ --nPosition; // make 0-based
+
+ if (nLength < 0)
+ throw lang::IllegalArgumentException(u"nLength < 0"_ustr, *this, 0);
+
MutexGuard aGuard(m_aMutex);
checkDisposed(Clob_BASE::rBHelper.bDisposed);
// TODO do not reset position if it is not necessary
m_aBlob->closeInput(); // reset position
OUStringBuffer sSegmentBuffer;
- sal_Int64 nActPos = 1;
- sal_Int32 nActLen = 0;
+ std::vector<char> aSegmentBytes;
- // skip irrelevant parts
- while( nActPos < nPosition )
+ for (;;)
{
- uno::Sequence < sal_Int8 > aSegmentBytes;
bool bLastRead = m_aBlob->readOneSegment( aSegmentBytes );
- if( bLastRead )
- throw lang::IllegalArgumentException("nPosition out of range", *this, 0);
-
- OUString sSegment ( reinterpret_cast< char *>( aSegmentBytes.getArray() ),
- aSegmentBytes.getLength(),
- RTL_TEXTENCODING_UTF8 );
- sal_Int32 nStrLen = sSegment.getLength();
- nActPos += nStrLen;
- if( nActPos > nPosition )
+ // TODO: handle possible case of split UTF-8 character
+ OUString sSegment(aSegmentBytes.data(), aSegmentBytes.size(), RTL_TEXTENCODING_UTF8);
+
+ // skip irrelevant parts
+ if (sSegment.getLength() < nPosition)
{
- sal_Int32 nCharsToCopy = static_cast<sal_Int32>(nActPos - nPosition);
- if( nCharsToCopy > nLength )
- nCharsToCopy = nLength;
- // append relevant part of first segment
- sSegmentBuffer.append( std::u16string_view(sSegment).substr(0, nCharsToCopy) );
- nActLen += sSegmentBuffer.getLength();
+ if (bLastRead)
+ throw lang::IllegalArgumentException(u"nPosition out of range"_ustr, *this, 0);
+ nPosition -= sSegment.getLength();
+ continue;
}
- }
- // read nLength characters
- while( nActLen < nLength )
- {
- uno::Sequence < sal_Int8 > aSegmentBytes;
- bool bLastRead = m_aBlob->readOneSegment( aSegmentBytes );
+ // Getting here for the first time, nPosition may be > 0, meaning copy start offset.
+ // This also handles sSegment.getLength() == nPosition case, including nLength == 0.
+ const sal_Int32 nCharsToCopy = std::min<sal_Int32>(sSegment.getLength() - nPosition,
+ nLength - sSegmentBuffer.getLength());
+ sSegmentBuffer.append(sSegment.subView(nPosition, nCharsToCopy));
+ if (sSegmentBuffer.getLength() == nLength)
+ return sSegmentBuffer.makeStringAndClear();
- OUString sSegment ( reinterpret_cast< char *>( aSegmentBytes.getArray() ),
- aSegmentBytes.getLength(),
- RTL_TEXTENCODING_UTF8 );
- sal_Int32 nStrLen = sSegment.getLength();
- if( nActLen + nStrLen > nLength )
- sSegmentBuffer.append(std::u16string_view(sSegment).substr(0, nLength - nActLen));
- else
- sSegmentBuffer.append(sSegment);
- nActLen += nStrLen;
-
- if( bLastRead && nActLen < nLength )
- throw lang::IllegalArgumentException("out of range", *this, 0);
- }
+ assert(sSegmentBuffer.getLength() < nLength);
+
+ if (bLastRead)
+ throw lang::IllegalArgumentException(u"out of range"_ustr, *this, 0);
- return sSegmentBuffer.makeStringAndClear();
+ nPosition = 0; // No offset after first append
+ }
}
uno::Reference< XInputStream > SAL_CALL Clob::getCharacterStream()
@@ -140,16 +127,13 @@ uno::Reference< XInputStream > SAL_CALL Clob::getCharacterStream()
sal_Int64 SAL_CALL Clob::position(const OUString& /*rPattern*/,
sal_Int32 /*nStart*/)
{
- ::dbtools::throwFeatureNotImplementedSQLException("Clob::position", *this);
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException(u"Clob::position"_ustr, *this);
}
sal_Int64 SAL_CALL Clob::positionOfClob(const Reference <XClob >& /*rPattern*/,
sal_Int64 /*aStart*/)
{
- ::dbtools::throwFeatureNotImplementedSQLException("Blob::positionOfBlob", *this);
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException(u"Clob::positionOfClob"_ustr, *this);
}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Clob.hxx b/connectivity/source/drivers/firebird/Clob.hxx
index 8ebc639f0bbb..385836627e68 100644
--- a/connectivity/source/drivers/firebird/Clob.hxx
+++ b/connectivity/source/drivers/firebird/Clob.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CLOB_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CLOB_HXX
+#pragma once
#include "Blob.hxx"
@@ -19,48 +18,47 @@
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CLOB_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Column.cxx b/connectivity/source/drivers/firebird/Column.cxx
index aa8abf9bb75c..5838456abaf7 100644
--- a/connectivity/source/drivers/firebird/Column.cxx
+++ b/connectivity/source/drivers/firebird/Column.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -45,7 +45,7 @@ void Column::construct()
css::uno::Sequence< OUString > SAL_CALL Column::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.Firebird" };
+ return { u"com.sun.star.sdbc.Firebird"_ustr };
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Column.hxx b/connectivity/source/drivers/firebird/Column.hxx
index ce0bfa217051..13a13052feeb 100644
--- a/connectivity/source/drivers/firebird/Column.hxx
+++ b/connectivity/source/drivers/firebird/Column.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -6,29 +6,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_HCOLUMN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_HCOLUMN_HXX
+#pragma once
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCOLUMNS_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Columns.cxx b/connectivity/source/drivers/firebird/Columns.cxx
index 293dac97dc5b..d36e25f9195b 100644
--- a/connectivity/source/drivers/firebird/Columns.cxx
+++ b/connectivity/source/drivers/firebird/Columns.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -12,13 +12,11 @@
using namespace ::connectivity;
using namespace ::connectivity::firebird;
-using namespace ::connectivity::sdbcx;
using namespace ::cppu;
using namespace ::osl;
using namespace ::com::sun::star;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
Columns::Columns(Table& rTable,
@@ -38,4 +36,4 @@ Reference< css::beans::XPropertySet > Columns::createDescriptor()
return new Column;
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Columns.hxx b/connectivity/source/drivers/firebird/Columns.hxx
index c7a22a2c245f..ef3b06bc6a4f 100644
--- a/connectivity/source/drivers/firebird/Columns.hxx
+++ b/connectivity/source/drivers/firebird/Columns.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_COLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_COLUMNS_HXX
+#pragma once
#include "Table.hxx"
@@ -16,19 +15,16 @@
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
-
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_COLUMNS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 05c24e9f73be..fc105a883e4e 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -22,7 +22,6 @@
#include "Clob.hxx"
#include "Connection.hxx"
#include "DatabaseMetaData.hxx"
-#include "Driver.hxx"
#include "PreparedStatement.hxx"
#include "Statement.hxx"
#include "Util.hxx"
@@ -44,11 +43,12 @@
#include <resource/sharedresources.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/storagehelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <unotools/tempfile.hxx>
-#include <unotools/localfilehelper.hxx>
+#include <osl/file.hxx>
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
@@ -72,21 +72,19 @@ using namespace ::com::sun::star::uno;
* Location within the .odb that an embedded .fdb will be stored.
* Only relevant for embedded dbs.
*/
-constexpr OUStringLiteral our_sFDBLocation( u"firebird.fdb" );
+constexpr OUString our_sFDBLocation( u"firebird.fdb"_ustr );
/**
* Older version of LO may store the database in a .fdb file
*/
-constexpr OUStringLiteral our_sFBKLocation( u"firebird.fbk" );
+constexpr OUString our_sFBKLocation( u"firebird.fbk"_ustr );
Connection::Connection()
: Connection_BASE(m_aMutex)
- , m_sConnectionURL()
- , m_sFirebirdURL()
, m_bIsEmbedded(false)
, m_bIsFile(false)
, m_bIsAutoCommit(true)
, m_bIsReadOnly(false)
- , m_aTransactionIsolation(TransactionIsolation::REPEATABLE_READ)
+ , m_aTransactionIsolation(TransactionIsolation::READ_COMMITTED)
#if SAL_TYPES_SIZEOFPOINTER == 8
, m_aDBHandle(0)
, m_aTransactionHandle(0)
@@ -96,7 +94,6 @@ Connection::Connection()
#endif
, m_xCatalog(nullptr)
, m_xMetaData(nullptr)
- , m_aStatements()
{
}
@@ -164,7 +161,7 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
bIsNewDatabase = !m_xEmbeddedStorage->hasElements();
- m_pDatabaseFileDir.reset(new ::utl::TempFile(nullptr, true));
+ m_pDatabaseFileDir.reset(new ::utl::TempFileNamed(nullptr, true));
m_pDatabaseFileDir->EnableKillingFile();
m_sFirebirdURL = m_pDatabaseFileDir->GetFileName() + "/firebird.fdb";
m_sFBKPath = m_pDatabaseFileDir->GetFileName() + "/firebird.fbk";
@@ -199,7 +196,7 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
// External file AND/OR remote connection
else if (url.startsWith("sdbc:firebird:"))
{
- m_sFirebirdURL = url.copy(OUString("sdbc:firebird:").getLength());
+ m_sFirebirdURL = url.copy(strlen("sdbc:firebird:"));
if (m_sFirebirdURL.startsWith("file://"))
{
m_bIsFile = true;
@@ -208,19 +205,19 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
if (!xFileAccess->exists(m_sFirebirdURL))
bIsNewDatabase = true;
- m_sFirebirdURL = m_sFirebirdURL.copy(OUString("file://").getLength());
+ osl::FileBase::getSystemPathFromFileURL(m_sFirebirdURL, m_sFirebirdURL);
}
}
std::string dpbBuffer;
{
- char userName[256] = "";
- char userPassword[256] = "";
+ OString userName;
+ OString userPassword;
dpbBuffer.push_back(isc_dpb_version1);
dpbBuffer.push_back(isc_dpb_sql_dialect);
dpbBuffer.push_back(1); // 1 byte long
- dpbBuffer.push_back(FIREBIRD_SQL_DIALECT);
+ dpbBuffer.push_back(SQL_DIALECT_CURRENT);
// set UTF8 as default character set of the database
const char sCharset[] = "UTF8";
@@ -236,45 +233,64 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
if (m_bIsEmbedded || m_bIsFile)
{
- strcpy(userName,"sysdba");
- strcpy(userPassword,"masterkey");
+ userName = "sysdba"_ostr;
+ userPassword = "masterkey"_ostr;
}
else
{
- // TODO: parse password from connection string as needed?
+ for (const auto& rIter : info)
+ {
+ if (rIter.Name == "user")
+ {
+ if (OUString value; rIter.Value >>= value)
+ userName = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
+ }
+ else if (rIter.Name == "password")
+ {
+ if (OUString value; rIter.Value >>= value)
+ userPassword = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
+ }
+ }
}
- if (strlen(userName))
+ if (!userName.isEmpty())
{
- int nUsernameLength = strlen(userName);
+ const sal_Int32 nMaxUsername = 255; //max size
+ int nUsernameLength = std::min(userName.getLength(), nMaxUsername);
dpbBuffer.push_back(isc_dpb_user_name);
dpbBuffer.push_back(nUsernameLength);
- dpbBuffer.append(userName);
+ dpbBuffer.append(userName.getStr(), nUsernameLength);
}
- if (strlen(userPassword))
+ if (!userPassword.isEmpty())
{
- int nPasswordLength = strlen(userPassword);
+ const sal_Int32 nMaxPassword = 255; //max size
+ int nPasswordLength = std::min(userPassword.getLength(), nMaxPassword);
dpbBuffer.push_back(isc_dpb_password);
dpbBuffer.push_back(nPasswordLength);
- dpbBuffer.append(userPassword);
+ dpbBuffer.append(userPassword.getStr(), nPasswordLength);
}
}
+ // use isc_dpb_utf8_filename to identify encoding of filenames
+ dpbBuffer.push_back(isc_dpb_utf8_filename);
+ dpbBuffer.push_back(0); // no filename here, it is passed to functions directly
+
ISC_STATUS_ARRAY status; /* status vector */
ISC_STATUS aErr;
+ const OString sFirebirdURL = OUStringToOString(m_sFirebirdURL, RTL_TEXTENCODING_UTF8);
if (bIsNewDatabase)
{
aErr = isc_create_database(status,
- m_sFirebirdURL.getLength(),
- OUStringToOString(m_sFirebirdURL,RTL_TEXTENCODING_UTF8).getStr(),
+ sFirebirdURL.getLength(),
+ sFirebirdURL.getStr(),
&m_aDBHandle,
dpbBuffer.size(),
dpbBuffer.c_str(),
0);
if (aErr)
{
- evaluateStatusVector(status, "isc_create_database", *this);
+ evaluateStatusVector(status, u"isc_create_database", *this);
}
}
else
@@ -285,14 +301,14 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
}
aErr = isc_attach_database(status,
- m_sFirebirdURL.getLength(),
- OUStringToOString(m_sFirebirdURL, RTL_TEXTENCODING_UTF8).getStr(),
+ sFirebirdURL.getLength(),
+ sFirebirdURL.getStr(),
&m_aDBHandle,
dpbBuffer.size(),
dpbBuffer.c_str());
if (aErr)
{
- evaluateStatusVector(status, "isc_attach_database", *this);
+ evaluateStatusVector(status, u"isc_attach_database", *this);
}
}
@@ -323,15 +339,9 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
}
}
-void Connection::notifyDatabaseModified()
-{
- if (m_xParentDocument.is()) // Only true in embedded mode
- m_xParentDocument->setModified(true);
-}
-
//----- XServiceInfo ---------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(Connection, "com.sun.star.sdbc.drivers.firebird.Connection",
- "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(Connection, u"com.sun.star.sdbc.drivers.firebird.Connection"_ustr,
+ u"com.sun.star.sdbc.Connection"_ustr)
Reference< XBlob> Connection::createBlob(ISC_QUAD const * pBlobId)
{
@@ -342,7 +352,7 @@ Reference< XBlob> Connection::createBlob(ISC_QUAD const * pBlobId)
&m_aTransactionHandle,
*pBlobId);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -355,10 +365,23 @@ Reference< XClob> Connection::createClob(ISC_QUAD const * pBlobId)
&m_aTransactionHandle,
*pBlobId);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
+//----- XUnoTunnel ----------------------------------------------------------
+// virtual
+sal_Int64 SAL_CALL Connection::getSomething(const css::uno::Sequence<sal_Int8>& rId)
+{
+ return comphelper::getSomethingImpl(rId, this);
+}
+
+// static
+const css::uno::Sequence<sal_Int8> & Connection::getUnoTunnelId()
+{
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
+}
//----- XConnection ----------------------------------------------------------
Reference< XStatement > SAL_CALL Connection::createStatement( )
@@ -373,7 +396,7 @@ Reference< XStatement > SAL_CALL Connection::createStatement( )
// create a statement
// the statement can only be executed once
Reference< XStatement > xReturn = new OStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -389,7 +412,7 @@ Reference< XPreparedStatement > SAL_CALL Connection::prepareStatement(
buildTypeInfo();
Reference< XPreparedStatement > xReturn = new OPreparedStatement(this, _sSql);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -411,7 +434,6 @@ Reference< XPreparedStatement > SAL_CALL Connection::prepareCall(
OUString SAL_CALL Connection::nativeSQL( const OUString& _sSql )
{
- MutexGuard aGuard( m_aMutex );
// We do not need to adapt the SQL for Firebird atm.
return _sSql;
}
@@ -461,8 +483,6 @@ void Connection::setupTransaction()
aTransactionIsolation = isc_tpb_read_committed;
break;
case TransactionIsolation::REPEATABLE_READ:
- aTransactionIsolation = isc_tpb_consistency;
- break;
case TransactionIsolation::SERIALIZABLE:
aTransactionIsolation = isc_tpb_consistency;
break;
@@ -490,7 +510,7 @@ void Connection::setupTransaction()
aTPB);
evaluateStatusVector(status_vector,
- "isc_start_transaction",
+ u"isc_start_transaction",
*this);
}
@@ -516,7 +536,7 @@ void SAL_CALL Connection::commit()
disposeStatements();
isc_commit_transaction(status_vector, &m_aTransactionHandle);
evaluateStatusVector(status_vector,
- "isc_commit_transaction",
+ u"isc_commit_transaction",
*this);
}
}
@@ -552,7 +572,7 @@ isc_svc_handle Connection::attachServiceManager()
*pSPB++ = isc_spb_version;
*pSPB++ = isc_spb_current_version;
*pSPB++ = isc_spb_user_name;
- OUString sUserName("SYSDBA");
+ OUString sUserName(u"SYSDBA"_ustr);
char aLength = static_cast<char>(sUserName.getLength());
*pSPB++ = aLength;
strncpy(pSPB,
@@ -569,7 +589,7 @@ isc_svc_handle Connection::attachServiceManager()
aSPBBuffer))
{
evaluateStatusVector(aStatusVector,
- "isc_service_attach",
+ u"isc_service_attach",
*this);
}
@@ -583,7 +603,7 @@ void Connection::detachServiceManager(isc_svc_handle aServiceHandle)
&aServiceHandle))
{
evaluateStatusVector(aStatusVector,
- "isc_service_detach",
+ u"isc_service_detach",
*this);
}
}
@@ -600,22 +620,18 @@ void Connection::runBackupService(const short nAction)
OString sFBKPath = OUStringToOString(m_sFBKPath, RTL_TEXTENCODING_UTF8);
- OStringBuffer aRequest; // byte array
-
-
- aRequest.append(static_cast<char>(nAction));
-
- aRequest.append(char(isc_spb_dbname)); // .fdb
sal_uInt16 nFDBLength = sFDBPath.getLength();
- aRequest.append(static_cast<char>(nFDBLength & 0xFF)); // least significant byte first
- aRequest.append(static_cast<char>((nFDBLength >> 8) & 0xFF));
- aRequest.append(sFDBPath);
-
- aRequest.append(char(isc_spb_bkp_file)); // .fbk
sal_uInt16 nFBKLength = sFBKPath.getLength();
- aRequest.append(static_cast<char>(nFBKLength & 0xFF));
- aRequest.append(static_cast<char>((nFBKLength >> 8) & 0xFF));
- aRequest.append(sFBKPath);
+ OStringBuffer aRequest( // byte array
+ OStringChar(static_cast<char>(nAction))
+ + OStringChar(char(isc_spb_dbname)) // .fdb
+ + OStringChar(static_cast<char>(nFDBLength & 0xFF)) // least significant byte first
+ + OStringChar(static_cast<char>((nFDBLength >> 8) & 0xFF))
+ + sFDBPath
+ + OStringChar(char(isc_spb_bkp_file)) // .fbk
+ + OStringChar(static_cast<char>(nFBKLength & 0xFF))
+ + OStringChar(static_cast<char>((nFBKLength >> 8) & 0xFF))
+ + sFBKPath);
if (nAction == isc_action_svc_restore)
{
@@ -642,7 +658,7 @@ void Connection::runBackupService(const short nAction)
aRequest.getLength(),
aRequest.getStr()))
{
- evaluateStatusVector(aStatusVector, "isc_service_start", *this);
+ evaluateStatusVector(aStatusVector, u"isc_service_start", *this);
}
char aInfoSPB = isc_info_svc_line;
@@ -658,7 +674,7 @@ void Connection::runBackupService(const short nAction)
sizeof(aResults),
aResults))
{
- evaluateStatusVector(aStatusVector, "isc_service_query", *this);
+ evaluateStatusVector(aStatusVector, u"isc_service_query", *this);
}
detachServiceManager(aServiceHandle);
@@ -693,11 +709,11 @@ Reference< XDatabaseMetaData > SAL_CALL Connection::getMetaData( )
// here we have to create the class with biggest interface
// The answer is 42 :-)
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
+ rtl::Reference< ODatabaseMetaData > xMetaData = m_xMetaData.get();
if(!xMetaData.is())
{
xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it
- m_xMetaData = xMetaData;
+ m_xMetaData = xMetaData.get();
}
return xMetaData;
@@ -722,13 +738,12 @@ sal_Bool SAL_CALL Connection::isReadOnly()
void SAL_CALL Connection::setCatalog(const OUString& /*catalog*/)
{
- ::dbtools::throwFunctionNotSupportedSQLException("setCatalog", *this);
+ ::dbtools::throwFunctionNotSupportedSQLException(u"setCatalog"_ustr, *this);
}
OUString SAL_CALL Connection::getCatalog()
{
- ::dbtools::throwFunctionNotSupportedSQLException("getCatalog", *this);
- return OUString();
+ ::dbtools::throwFunctionNotSupportedSQLException(u"getCatalog"_ustr, *this);
}
void SAL_CALL Connection::setTransactionIsolation( sal_Int32 level )
@@ -750,13 +765,12 @@ sal_Int32 SAL_CALL Connection::getTransactionIsolation( )
Reference< XNameAccess > SAL_CALL Connection::getTypeMap()
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::getTypeMap", *this );
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::getTypeMap"_ustr, *this );
}
void SAL_CALL Connection::setTypeMap(const Reference< XNameAccess >&)
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setTypeMap", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setTypeMap"_ustr, *this );
}
//----- XCloseable -----------------------------------------------------------
@@ -798,42 +812,9 @@ void SAL_CALL Connection::documentEventOccured( const DocumentEvent& Event )
if ( !(m_bIsEmbedded && m_xEmbeddedStorage.is()) )
return;
- SAL_INFO("connectivity.firebird", "Writing .fbk from running db");
- try
- {
- runBackupService(isc_action_svc_backup);
- }
- catch (const SQLException& e)
- {
- auto a = cppu::getCaughtException();
- throw WrappedTargetRuntimeException(e.Message, e.Context, a);
- }
-
-
- Reference< XStream > xDBStream(m_xEmbeddedStorage->openStreamElement(our_sFBKLocation,
- ElementModes::WRITE));
-
- // TODO: verify the backup actually exists -- the backup service
- // can fail without giving any sane error messages / telling us
- // that it failed.
- using namespace ::comphelper;
- Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
- Reference< XInputStream > xInputStream;
- if (!xContext.is())
- return;
-
- xInputStream =
- OStorageHelper::GetInputStreamFromURL(m_sFBKPath, xContext);
- if (xInputStream.is())
- OStorageHelper::CopyInputToOutput( xInputStream,
- xDBStream->getOutputStream());
-
- // remove old fdb file if exists
- uno::Reference< ucb::XSimpleFileAccess > xFileAccess =
- ucb::SimpleFileAccess::create(xContext);
- if (xFileAccess->exists(m_sFirebirdURL))
- xFileAccess->kill(m_sFirebirdURL);
+ storeDatabase();
}
+
// XEventListener
void SAL_CALL Connection::disposing(const EventObject& /*rSource*/)
{
@@ -898,7 +879,7 @@ void Connection::disposing()
disposeStatements();
- m_xMetaData = css::uno::WeakReference< css::sdbc::XDatabaseMetaData>();
+ m_xMetaData.clear();
ISC_STATUS_ARRAY status; /* status vector */
if (m_aTransactionHandle)
@@ -911,20 +892,46 @@ void Connection::disposing()
{
if (isc_detach_database(status, &m_aDBHandle))
{
- evaluateStatusVector(status, "isc_detach_database", *this);
+ evaluateStatusVector(status, u"isc_detach_database", *this);
}
}
- // TODO: write to storage again?
+
+ storeDatabase();
cppu::WeakComponentImplHelperBase::disposing();
- if (m_pDatabaseFileDir)
+ m_pDatabaseFileDir.reset();
+}
+
+void Connection::storeDatabase()
+{
+ MutexGuard aGuard(m_aMutex);
+ if (m_bIsEmbedded && m_xEmbeddedStorage.is())
{
- ::utl::removeTree(m_pDatabaseFileDir->GetURL());
- m_pDatabaseFileDir.reset();
+ SAL_INFO("connectivity.firebird", "Writing .fbk from running db");
+ try
+ {
+ runBackupService(isc_action_svc_backup);
+ }
+ catch (const SQLException& e)
+ {
+ auto a = cppu::getCaughtException();
+ throw WrappedTargetRuntimeException(e.Message, e.Context, a);
+ }
+ Reference<XStream> xDBStream(
+ m_xEmbeddedStorage->openStreamElement(our_sFBKLocation, ElementModes::WRITE));
+ using namespace ::comphelper;
+ const Reference<XComponentContext>& xContext = comphelper::getProcessComponentContext();
+ Reference<XInputStream> xInputStream;
+ if (!xContext.is())
+ return;
+ xInputStream = OStorageHelper::GetInputStreamFromURL(m_sFBKPath, xContext);
+ if (xInputStream.is())
+ OStorageHelper::CopyInputToOutput(xInputStream, xDBStream->getOutputStream());
}
}
+
void Connection::disposeStatements()
{
MutexGuard aGuard(m_aMutex);
@@ -942,18 +949,13 @@ uno::Reference< XTablesSupplier > Connection::createCatalog()
MutexGuard aGuard(m_aMutex);
// m_xCatalog is a weak reference. Reuse it if it still exists.
- Reference< XTablesSupplier > xCatalog = m_xCatalog;
- if (xCatalog.is())
- {
- return xCatalog;
- }
- else
+ rtl::Reference< Catalog > xCatalog = m_xCatalog.get();
+ if (!xCatalog.is())
{
xCatalog = new Catalog(this);
- m_xCatalog = xCatalog;
- return m_xCatalog;
+ m_xCatalog = xCatalog.get();
}
-
+ return xCatalog;
}
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 9e2c9c24865d..524c0a7c476f 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CONNECTION_HXX
+#pragma once
#include <ibase.h>
@@ -28,12 +27,14 @@
#include <memory>
#include <OTypeInfo.hxx>
#include <unotools/tempfile.hxx>
+#include <unotools/weakref.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/document/DocumentEvent.hpp>
#include <com/sun/star/document/XDocumentEventListener.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/sdbc/XBlob.hpp>
#include <com/sun/star/sdbc/XClob.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -42,203 +43,202 @@
#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;
+ class Catalog;
- typedef ::cppu::WeakComponentImplHelper< css::document::XDocumentEventListener,
- css::lang::XServiceInfo,
- 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::TempFile > 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();
-
- /**
- * Must be called anytime the underlying database is likely to have
- * changed.
- *
- * This is used to notify the database document of any changes, so
- * that the user is informed of any pending changes needing to be
- * saved.
- */
- void notifyDatabaseModified();
-
- /**
- * 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();
-
- // 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;
- // 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;
+
+ unotools::WeakReference< Catalog >
+ m_xCatalog;
+ unotools::WeakReference< ODatabaseMetaData >
+ 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;
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_CONNECTION_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index fdea4e4026eb..948a39861d29 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -221,7 +221,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( )
// Only quoted identifiers are case sensitive, unquoted are case insensitive
OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString()
{
- return "\"";
+ return u"\""_ustr;
}
sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( )
@@ -600,7 +600,7 @@ OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( )
{
uno::Reference< XStatement > xSelect = m_pConnection->createStatement();
- uno::Reference< XResultSet > xRs = xSelect->executeQuery("SELECT rdb$get_context('SYSTEM', 'ENGINE_VERSION') as version from rdb$database");
+ uno::Reference< XResultSet > xRs = xSelect->executeQuery(u"SELECT rdb$get_context('SYSTEM', 'ENGINE_VERSION') as version from rdb$database"_ustr);
(void)xRs->next(); // first and only row
uno::Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
return xRow->getString(1);
@@ -608,7 +608,7 @@ OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( )
OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( )
{
- return "Firebird (engine12)";
+ return u"Firebird (engine12)"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( )
@@ -638,15 +638,15 @@ OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( )
OUString SAL_CALL ODatabaseMetaData::getStringFunctions( )
{
- return "ASCII_CHAR,ASCII_VAL,BIT_LENGTH,CHAR_LENGTH,CHAR_TO_UUID,CHARACTER_LENGTH,"
+ return u"ASCII_CHAR,ASCII_VAL,BIT_LENGTH,CHAR_LENGTH,CHAR_TO_UUID,CHARACTER_LENGTH,"
"GEN_UUID,HASH,LEFT,LOWER,LPAD,OCTET_LENGTH,OVERLAY,POSITION,REPLACE,REVERSE,"
- "RIGHT,RPAD,SUBSTRING,TRIM,UPPER,UUID_TO_CHAR";
+ "RIGHT,RPAD,SUBSTRING,TRIM,UPPER,UUID_TO_CHAR"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( )
{
- return "CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DATEADD, DATEDIFF,"
- "EXTRACT,'NOW','TODAY','TOMORROW','YESTERDAY'";
+ return u"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DATEADD, DATEDIFF,"
+ "EXTRACT,'NOW','TODAY','TOMORROW','YESTERDAY'"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( )
@@ -656,9 +656,9 @@ OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( )
OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( )
{
- return "ABS,ACOS,ASIN,ATAN,ATAN2,BIN_AND,BIN_NOT,BIN_OR,BIN_SHL,"
+ return u"ABS,ACOS,ASIN,ATAN,ATAN2,BIN_AND,BIN_NOT,BIN_OR,BIN_SHL,"
"BIN_SHR,BIN_XOR,CEIL,CEILING,COS,COSH,COT,EXP,FLOOR,LN,"
- "LOG,LOG10,MOD,PI,POWER,RAND,ROUND,SIGN,SIN,SINH,SQRT,TAN,TANH,TRUNC";
+ "LOG,LOG10,MOD,PI,POWER,RAND,ROUND,SIGN,SIN,SINH,SQRT,TAN,TANH,TRUNC"_ustr;
}
sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( )
@@ -771,7 +771,193 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates()
uno::Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection()
{
- return uno::Reference<XConnection>(m_pConnection.get());
+ return m_pConnection;
+}
+
+::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL ODatabaseMetaData::getConnectionInfo()
+{
+ // TODO IMPLEMENT
+ return Sequence< ::css::beans::PropertyValue >();
+}
+
+sal_Bool SAL_CALL ODatabaseMetaData::autoCommitFailureClosesAllResultSets()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+sal_Bool SAL_CALL ODatabaseMetaData::generatedKeyAlwaysReturned()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getAttributes( const ::rtl::OUString& /* catalog */,
+ const ::rtl::OUString& /* schemaPattern */,
+ const ::rtl::OUString& /* typeNamePattern */,
+ const ::rtl::OUString& /* attributeNamePattern */)
+{
+ // TODO IMPLEMENT
+ return nullptr;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getClientInfoProperties()
+{
+ // TODO IMPLEMENT
+ return nullptr;
+}
+
+::sal_Int32 SAL_CALL ODatabaseMetaData::getDatabaseMajorVersion()
+{
+ // TODO IMPLEMENT
+ return 0;
+}
+
+::sal_Int32 SAL_CALL ODatabaseMetaData::getDatabaseMinorVersion()
+{
+ // TODO IMPLEMENT
+ return 0;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getFunctions( const ::rtl::OUString& /* catalog */, const ::rtl::OUString& /* schemaPattern */, const ::rtl::OUString& functionNamePattern )
+{
+ OUString strQuery(
+ "SELECT "
+ " null as FUNCTION_CAT,"
+ "RDB$FUNCTION_NAME as FUNCTION_NAME,"
+ "RDB$DESCRIPTION as REMARKS,"
+ "cast(null as blob sub_type text) as JB_FUNCTION_SOURCE,"
+ "'UDF' as JB_FUNCTION_KIND,"
+ "trim(trailing from RDB$MODULE_NAME) as JB_MODULE_NAME,"
+ "trim(trailing from RDB$ENTRYPOINT) as JB_ENTRYPOINT,"
+ "cast(null as varchar(255)) as JB_ENGINE_NAME "
+ "FROM RDB$FUNCTIONS "
+ "WHERE RDB$FUNCTION_NAME = '" + functionNamePattern + "'");
+
+ uno::Reference< XStatement > statement = m_pConnection->createStatement();
+ uno::Reference< XResultSet > rs = statement->executeQuery(strQuery);
+ return rs;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getFunctionColumns( const ::rtl::OUString& /* catalog */, const ::rtl::OUString& /* schemaPattern */, const ::rtl::OUString& /* functionNamePattern */, const ::rtl::OUString& /* columnNamePattern */ )
+{
+ // TODO IMPLEMENT
+ return nullptr;
+}
+
+::sal_Int32 SAL_CALL ODatabaseMetaData::getMaxLogicalLobSize()
+{
+ // TODO IMPLEMENT
+ return 0;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPseudoColumns( const ::rtl::OUString& /* catalog */,
+ const ::rtl::OUString& /* schemaPattern */,
+ const ::rtl::OUString& /* tableNamePattern */,
+ const ::rtl::OUString& /* columnNamePattern */)
+{
+ // TODO IMPLEMENT
+ return nullptr;
+}
+
+::sal_Int32 SAL_CALL ODatabaseMetaData::getResultSetHoldability()
+{
+ // TODO IMPLEMENT
+ return 0;
+}
+
+::sal_Int32 SAL_CALL ODatabaseMetaData::getRowIdLifetime()
+{
+ // TODO IMPLEMENT
+ return 0;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemasFiltered( const ::css::beans::Optional< ::rtl::OUString >& /* catalog */,
+ const ::css::beans::Optional< ::rtl::OUString >& /* schemaPattern */)
+{
+ // TODO IMPLEMENT
+ return nullptr;
+}
+
+::sal_Int32 SAL_CALL ODatabaseMetaData::getSQLStateType()
+{
+ // TODO IMPLEMENT
+ return 0;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSuperTables( const ::rtl::OUString& /* catalog */,
+ const ::rtl::OUString& /* schemaPattern */, const ::rtl::OUString& /* tableNamePattern */)
+{
+ // TODO IMPLEMENT
+ return nullptr;
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSuperTypes( const ::rtl::OUString& /* catalog */,
+ const ::rtl::OUString& /* schemaPattern */,
+ const ::rtl::OUString& /* typeNamePattern */)
+{
+ // TODO IMPLEMENT
+ return nullptr;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::locatorsUpdateCopy()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsConvertInGeneral()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsGetGeneratedKeys()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleOpenResults()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsNamedParameters()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsRefCursors()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsSavepoints()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsSharding()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsStatementPooling()
+{
+ // TODO IMPLEMENT
+ return false;
+}
+
+::sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredFunctionsUsingCallSyntax()
+{
+ // TODO IMPLEMENT
+ return false;
}
// here follow all methods which return a resultset
@@ -781,9 +967,8 @@ uno::Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection()
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
{
- ODatabaseMetaDataResultSet* pResultSet = new
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- uno::Reference< XResultSet > xResultSet = pResultSet;
ODatabaseMetaDataResultSet::ORows aResults;
ODatabaseMetaDataResultSet::ORow aRow(2);
@@ -793,17 +978,17 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
// TODO Put these statics to one place
// like postgreSQL's Statics class.
- aRow[1] = new ORowSetValueDecorator(OUString("TABLE"));
+ aRow[1] = new ORowSetValueDecorator(u"TABLE"_ustr);
aResults.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("VIEW"));
+ aRow[1] = new ORowSetValueDecorator(u"VIEW"_ustr);
aResults.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("SYSTEM TABLE"));
+ aRow[1] = new ORowSetValueDecorator(u"SYSTEM TABLE"_ustr);
aResults.push_back(aRow);
- pResultSet->setRows(aResults);
- return xResultSet;
+ pResultSet->setRows(std::move(aResults));
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
@@ -812,9 +997,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
// this returns an empty resultset where the column-names are already set
// in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet =
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet =
new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
- uno::Reference< XResultSet > xResultSet = pResultSet;
static ODatabaseMetaDataResultSet::ORows aResults = []()
{
ODatabaseMetaDataResultSet::ORows tmp;
@@ -823,14 +1007,14 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
// Common data
aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); // Literal quote marks
aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); // Literal quote marks
- aRow[7] = new ORowSetValueDecorator(true); // Nullable
- aRow[8] = new ORowSetValueDecorator(true); // Case sensitive
- aRow[10] = new ORowSetValueDecorator(false); // Is unsigned
+ aRow[7] = new ORowSetValueDecorator(ORowSetValue(true)); // Nullable
+ aRow[8] = new ORowSetValueDecorator(ORowSetValue(true)); // Case sensitive
+ aRow[10] = new ORowSetValueDecorator(ORowSetValue(false)); // Is unsigned
// FIXED_PREC_SCALE: docs state "can it be a money value? " however
// in reality this causes Base to treat all numbers as money formatted
// by default which is wrong (and formatting as money value is still
// possible for all values).
- aRow[11] = new ORowSetValueDecorator(false);
+ aRow[11] = new ORowSetValueDecorator(ORowSetValue(false));
// Localised Type Name -- TODO: implement (but can be null):
aRow[13] = new ORowSetValueDecorator();
aRow[16] = new ORowSetValueDecorator(); // Unused
@@ -838,25 +1022,25 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[18] = new ORowSetValueDecorator(sal_Int16(10));// Radix
// Char
- aRow[1] = new ORowSetValueDecorator(OUString("CHAR"));
+ aRow[1] = new ORowSetValueDecorator(u"CHAR"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
- aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
+ aRow[6] = new ORowSetValueDecorator(u"length"_ustr); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
// Varchar
- aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR"));
+ aRow[1] = new ORowSetValueDecorator(u"VARCHAR"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
- aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
+ aRow[6] = new ORowSetValueDecorator(u"length"_ustr); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
@@ -865,10 +1049,10 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
// to fool LO into seeing it as different types.
// It is distinguished from Text type by its character set OCTETS;
// that will be added by Tables::createStandardColumnPart
- aRow[1] = new ORowSetValueDecorator(OUString("CHARACTER"));
+ aRow[1] = new ORowSetValueDecorator(u"CHARACTER"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::BINARY);
aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
- aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
+ aRow[6] = new ORowSetValueDecorator(u"length"_ustr); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::NONE)); // Searchable
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
@@ -876,21 +1060,21 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
tmp.push_back(aRow);
// Varbinary (VARCHAR); see comment above about BINARY
- aRow[1] = new ORowSetValueDecorator(OUString("CHARACTER VARYING"));
+ aRow[1] = new ORowSetValueDecorator(u"CHARACTER VARYING"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::VARBINARY);
aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
- aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
+ aRow[6] = new ORowSetValueDecorator(u"length"_ustr); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::NONE)); // Searchable
// Clob (SQL_BLOB)
- aRow[1] = new ORowSetValueDecorator(OUString("BLOB SUB_TYPE TEXT")); // BLOB, with subtype 1
+ aRow[1] = new ORowSetValueDecorator(u"BLOB SUB_TYPE TEXT"_ustr); // BLOB, with subtype 1
aRow[2] = new ORowSetValueDecorator(DataType::CLOB);
aRow[3] = new ORowSetValueDecorator(sal_Int32(2147483647)); // Precision = max length
aRow[6] = new ORowSetValueDecorator(); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
@@ -906,22 +1090,22 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[6] = new ORowSetValueDecorator(); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(true); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(true)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
}
// Smallint (SQL_SHORT)
- aRow[1] = new ORowSetValueDecorator(OUString("SMALLINT"));
+ aRow[1] = new ORowSetValueDecorator(u"SMALLINT"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::SMALLINT);
aRow[3] = new ORowSetValueDecorator(sal_Int16(5)); // Prevision
tmp.push_back(aRow);
// Integer (SQL_LONG)
- aRow[1] = new ORowSetValueDecorator(OUString("INTEGER"));
+ aRow[1] = new ORowSetValueDecorator(u"INTEGER"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
aRow[3] = new ORowSetValueDecorator(sal_Int16(10)); // Precision
tmp.push_back(aRow);
// Bigint (SQL_INT64)
- aRow[1] = new ORowSetValueDecorator(OUString("BIGINT"));
+ aRow[1] = new ORowSetValueDecorator(u"BIGINT"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::BIGINT);
aRow[3] = new ORowSetValueDecorator(sal_Int16(20)); // Precision
tmp.push_back(aRow);
@@ -930,19 +1114,19 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
{
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(true); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(true)); // Autoincrement
}
- aRow[6] = new ORowSetValueDecorator(OUString("PRECISION,SCALE")); // Create params
+ aRow[6] = new ORowSetValueDecorator(u"PRECISION,SCALE"_ustr); // Create params
// Numeric
- aRow[1] = new ORowSetValueDecorator(OUString("NUMERIC"));
+ aRow[1] = new ORowSetValueDecorator(u"NUMERIC"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC);
aRow[3] = new ORowSetValueDecorator(sal_Int16(18)); // Precision
aRow[14] = new ORowSetValueDecorator(sal_Int16(0)); // Minimum scale
aRow[15] = new ORowSetValueDecorator(sal_Int16(18)); // Max scale
tmp.push_back(aRow);
// Decimal
- aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
+ aRow[1] = new ORowSetValueDecorator(u"DECIMAL"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = new ORowSetValueDecorator(sal_Int16(18)); // Precision
aRow[14] = new ORowSetValueDecorator(sal_Int16(0)); // Minimum scale
@@ -951,14 +1135,14 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[6] = new ORowSetValueDecorator(); // Create Params
// Float (SQL_FLOAT)
- aRow[1] = new ORowSetValueDecorator(OUString("FLOAT"));
+ aRow[1] = new ORowSetValueDecorator(u"FLOAT"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::FLOAT);
aRow[3] = new ORowSetValueDecorator(sal_Int16(7)); // Precision
aRow[14] = new ORowSetValueDecorator(sal_Int16(1)); // Minimum scale
aRow[15] = new ORowSetValueDecorator(sal_Int16(7)); // Max scale
tmp.push_back(aRow);
// Double (SQL_DOUBLE)
- aRow[1] = new ORowSetValueDecorator(OUString("DOUBLE PRECISION"));
+ aRow[1] = new ORowSetValueDecorator(u"DOUBLE PRECISION"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
aRow[3] = new ORowSetValueDecorator(sal_Int16(15)); // Precision
aRow[14] = new ORowSetValueDecorator(sal_Int16(1)); // Minimum scale
@@ -968,68 +1152,69 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
// TODO: no idea whether D_FLOAT corresponds to an sql type
// SQL_TIMESTAMP
- aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
+ aRow[1] = new ORowSetValueDecorator(u"TIMESTAMP"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max length
aRow[6] = new ORowSetValueDecorator(); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
// SQL_TYPE_TIME
- aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
+ aRow[1] = new ORowSetValueDecorator(u"TIME"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::TIME);
aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max length
aRow[6] = new ORowSetValueDecorator(); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
// SQL_TYPE_DATE
- aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
+ aRow[1] = new ORowSetValueDecorator(u"DATE"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::DATE);
aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max length
aRow[6] = new ORowSetValueDecorator(); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::FULL)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
// SQL_BLOB
- aRow[1] = new ORowSetValueDecorator(OUString("BLOB SUB_TYPE BINARY"));
+ aRow[1] = new ORowSetValueDecorator(u"BLOB SUB_TYPE BINARY"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::BLOB);
aRow[3] = new ORowSetValueDecorator(sal_Int32(0)); // Prevision = max length
aRow[6] = new ORowSetValueDecorator(); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::NONE)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
// SQL_BOOLEAN
- aRow[1] = new ORowSetValueDecorator(OUString("BOOLEAN"));
+ aRow[1] = new ORowSetValueDecorator(u"BOOLEAN"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::BOOLEAN);
aRow[3] = new ORowSetValueDecorator(sal_Int32(1)); // Prevision = max length
aRow[6] = new ORowSetValueDecorator(); // Create Params
aRow[9] = new ORowSetValueDecorator(
sal_Int16(ColumnSearch::BASIC)); // Searchable
- aRow[12] = new ORowSetValueDecorator(false); // Autoincrement
+ aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
return tmp;
}();
- pResultSet->setRows(aResults);
- return xResultSet;
+ // [-loplugin:redundantfcast] false positive:
+ pResultSet->setRows(ODatabaseMetaDataResultSet::ORows(aResults));
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
@@ -1042,9 +1227,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
"Table: " << sTable
<< " & ColumnNamePattern: " << sColumnNamePattern);
- ODatabaseMetaDataResultSet* pResultSet = new
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumnPrivileges);
- uno::Reference< XResultSet > xResultSet = pResultSet;
uno::Reference< XStatement > statement = m_pConnection->createStatement();
static const char wld[] = "%";
@@ -1059,7 +1243,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
"FROM RDB$USER_PRIVILEGES priv ");
{
- OUString sAppend = "WHERE priv.RDB$RELATION_NAME = '%' ";
+ OUString sAppend = u"WHERE priv.RDB$RELATION_NAME = '%' "_ustr;
queryBuf.append(sAppend.replaceAll("%", sTable));
}
if (!sColumnNamePattern.isEmpty())
@@ -1097,14 +1281,14 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
aCurrentRow[6] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(3))); // 6. GRANTEE
aCurrentRow[7] = new ORowSetValueDecorator(xRow->getString(4)); // 7. Privilege
aCurrentRow[8] = new ORowSetValueDecorator( ( xRow->getShort(5) == 1 ) ?
- OUString("YES") : OUString("NO")); // 8. Grantable
+ u"YES"_ustr : u"NO"_ustr); // 8. Grantable
aResults.push_back(aCurrentRow);
}
- pResultSet->setRows( aResults );
+ pResultSet->setRows( std::move(aResults) );
- return xResultSet;
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
@@ -1299,21 +1483,20 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
// 18. Is nullable
if (xRow->getShort(9))
{
- aCurrentRow[18] = new ORowSetValueDecorator(OUString("NO"));
+ aCurrentRow[18] = new ORowSetValueDecorator(u"NO"_ustr);
}
else
{
- aCurrentRow[18] = new ORowSetValueDecorator(OUString("YES"));
+ aCurrentRow[18] = new ORowSetValueDecorator(u"YES"_ustr);
}
aResults.push_back(aCurrentRow);
}
- ODatabaseMetaDataResultSet* pResultSet = new
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumns);
- uno::Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( aResults );
+ pResultSet->setRows( std::move(aResults) );
- return xResultSet;
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
@@ -1325,9 +1508,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
SAL_INFO("connectivity.firebird", "getTables() with "
"TableNamePattern: " << tableNamePattern);
- ODatabaseMetaDataResultSet* pResultSet = new
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
- uno::Reference< XResultSet > xResultSet = pResultSet;
uno::Reference< XStatement > statement = m_pConnection->createStatement();
static const char wld[] = "%";
@@ -1344,8 +1526,10 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
// TODO: GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM
if (!types.hasElements() || (types.getLength() == 1 && types[0].match(wld)))
{
+ // from Firebird: src/jrd/constants.h
+ // rel_persistent = 0, rel_view = 1, rel_external = 2
// All table types? I.e. includes system tables.
- queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1) ");
+ queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1 OR RDB$RELATION_TYPE = 2) ");
}
else
{
@@ -1411,7 +1595,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
}
else
{
- if (nTableType == 0)
+ // see above about src/jrd/constants.h
+ if (nTableType == 0 || nTableType == 2)
sTableType = "TABLE";
}
@@ -1422,16 +1607,16 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
uno::Reference< XClob > xClob = xRow->getClob(4);
if (xClob.is())
{
- aCurrentRow[5] = new ORowSetValueDecorator(xClob->getSubString(0, xClob->length()));
+ aCurrentRow[5] = new ORowSetValueDecorator(xClob->getSubString(1, xClob->length()));
}
}
aResults.push_back(aCurrentRow);
}
- pResultSet->setRows( aResults );
+ pResultSet->setRows( std::move(aResults) );
- return xResultSet;
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
@@ -1475,15 +1660,14 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
return ODatabaseMetaData::lcl_getKeys(true, table);
}
-uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool& bIsImport, std::u16string_view table )
+uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool bIsImport, std::u16string_view table )
{
- ODatabaseMetaDataResultSet* pResultSet = new
- ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eImportedKeys);
- uno::Reference< XResultSet > xResultSet = pResultSet;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
+ ODatabaseMetaDataResultSet(bIsImport?ODatabaseMetaDataResultSet::eImportedKeys:ODatabaseMetaDataResultSet::eExportedKeys);
uno::Reference< XStatement > statement = m_pConnection->createStatement();
- OUString sSQL = "SELECT "
+ OUString sSQL = u"SELECT "
"RDB$REF_CONSTRAINTS.RDB$UPDATE_RULE, " // 1 update rule
"RDB$REF_CONSTRAINTS.RDB$DELETE_RULE, " // 2 delete rule
"RDB$REF_CONSTRAINTS.RDB$CONST_NAME_UQ, " // 3 primary or unique key name
@@ -1504,7 +1688,7 @@ uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool& bIsImpor
"ON PRIM.RDB$INDEX_NAME = PRIMARY_INDEX.RDB$INDEX_NAME "
"INNER JOIN RDB$INDEX_SEGMENTS AS FOREIGN_INDEX "
"ON FOREI.RDB$INDEX_NAME = FOREIGN_INDEX.RDB$INDEX_NAME "
- "WHERE FOREI.RDB$CONSTRAINT_TYPE = 'FOREIGN KEY' ";
+ "WHERE FOREI.RDB$CONSTRAINT_TYPE = 'FOREIGN KEY' "_ustr;
if (bIsImport)
sSQL += OUString::Concat("AND FOREI.RDB$RELATION_NAME = '")+ table +"'";
else
@@ -1524,11 +1708,11 @@ uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool& bIsImpor
aCurrentRow[6] = new ORowSetValueDecorator(); // FKTABLE_SCHEM unsupported
std::map< OUString,sal_Int32> aRuleMap;
- aRuleMap[ OUString("CASCADE")] = KeyRule::CASCADE;
- aRuleMap[ OUString("RESTRICT")] = KeyRule::RESTRICT;
- aRuleMap[ OUString("SET NULL")] = KeyRule::SET_NULL;
- aRuleMap[ OUString("SET DEFAULT")] = KeyRule::SET_DEFAULT;
- aRuleMap[ OUString("NO ACTION")] = KeyRule::NO_ACTION;
+ aRuleMap[ u"CASCADE"_ustr] = KeyRule::CASCADE;
+ aRuleMap[ u"RESTRICT"_ustr] = KeyRule::RESTRICT;
+ aRuleMap[ u"SET NULL"_ustr] = KeyRule::SET_NULL;
+ aRuleMap[ u"SET DEFAULT"_ustr] = KeyRule::SET_DEFAULT;
+ aRuleMap[ u"NO ACTION"_ustr] = KeyRule::NO_ACTION;
while(rs->next())
{
@@ -1558,8 +1742,8 @@ uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool& bIsImpor
aResults.push_back(aCurrentRow);
}
- pResultSet->setRows( aResults );
- return xResultSet;
+ pResultSet->setRows( std::move(aResults) );
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
@@ -1570,7 +1754,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
SAL_INFO("connectivity.firebird", "getPrimaryKeys() with "
"Table: " << sTable);
- OUString sAppend = "WHERE constr.RDB$RELATION_NAME = '%' ";
+ OUString sAppend = u"WHERE constr.RDB$RELATION_NAME = '%' "_ustr;
OUString sQuery = "SELECT "
"constr.RDB$RELATION_NAME, " // 1. Table Name
"inds.RDB$FIELD_NAME, " // 2. Column Name
@@ -1610,12 +1794,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
aResults.push_back(aCurrentRow);
}
- ODatabaseMetaDataResultSet* pResultSet = new
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::ePrimaryKeys);
- uno::Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( aResults );
+ pResultSet->setRows( std::move(aResults) );
- return xResultSet;
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
@@ -1683,7 +1866,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
}
// 4. NON_UNIQUE -- i.e. specifically negate here.
- aCurrentRow[4] = new ORowSetValueDecorator(xRow->getShort(5) == 0);
+ aCurrentRow[4] = new ORowSetValueDecorator(ORowSetValue(xRow->getShort(5) == 0));
// 6. INDEX NAME
aCurrentRow[6] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(4)));
@@ -1693,9 +1876,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
aCurrentRow[9] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(2)));
// 10. ASC(ending)/DESC(ending)
if (xRow->getShort(6) == 1)
- aCurrentRow[10] = new ORowSetValueDecorator(OUString("D"));
+ aCurrentRow[10] = new ORowSetValueDecorator(u"D"_ustr);
else
- aCurrentRow[10] = new ORowSetValueDecorator(OUString("A"));
+ aCurrentRow[10] = new ORowSetValueDecorator(u"A"_ustr);
// TODO: double check this^^^, doesn't seem to be officially documented anywhere.
// 11. CARDINALITY
aCurrentRow[11] = new ORowSetValueDecorator(sal_Int32(0)); // TODO: determine how to do this
@@ -1704,12 +1887,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
aResults.push_back(aCurrentRow);
}
- ODatabaseMetaDataResultSet* pResultSet = new
- ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::ePrimaryKeys);
- uno::Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( aResults );
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
+ ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eIndexInfo);
+ pResultSet->setRows( std::move(aResults) );
- return xResultSet;
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
@@ -1729,9 +1911,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
SAL_INFO("connectivity.firebird", "getTablePrivileges() with "
"TableNamePattern: " << sTableNamePattern);
- ODatabaseMetaDataResultSet* pResultSet = new
+ rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTablePrivileges);
- uno::Reference< XResultSet > xResultSet = pResultSet;
uno::Reference< XStatement > statement = m_pConnection->createStatement();
// TODO: column specific privileges are included, we may need
@@ -1778,14 +1959,14 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
aRow[4] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(2))); // 4. GRANTOR
aRow[5] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(3))); // 5. GRANTEE
aRow[6] = new ORowSetValueDecorator(xRow->getString(4)); // 6. Privilege
- aRow[7] = new ORowSetValueDecorator(bool(xRow->getBoolean(5))); // 7. Is Grantable
+ aRow[7] = new ORowSetValueDecorator(ORowSetValue(bool(xRow->getBoolean(5)))); // 7. Is Grantable
aResults.push_back(aRow);
}
- pResultSet->setRows( aResults );
+ pResultSet->setRows( std::move(aResults) );
- return xResultSet;
+ return pResultSet;
}
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
@@ -1805,5 +1986,4 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any&, co
return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eUDTs);
}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx
index fda5bb31bc88..ca6155ed4ca1 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DATABASEMETADATA_HXX
+#pragma once
#include <sal/config.h>
@@ -26,183 +25,212 @@
#include "Connection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData3.hpp>
#include <cppuhelper/implbase.hxx>
#include <rtl/ref.hxx>
namespace connectivity::firebird
+{
+
+ //************ 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:
- //************ Class: ODatabaseMetaData
-
-
- typedef ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData> ODatabaseMetaData_BASE;
-
- class ODatabaseMetaData : public ODatabaseMetaData_BASE
- {
- ::rtl::Reference<Connection> m_pConnection;
- private:
- css::uno::Reference< css::sdbc::XResultSet > lcl_getKeys( const 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;
- };
+ 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;
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DATABASEMETADATA_HXX
+ // 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;
+ };
+
+}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index 55e149e9de5c..0879a7eca310 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -25,12 +25,12 @@
#include <strings.hrc>
#include <resource/sharedresources.hxx>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/file.hxx>
#include <osl/process.h>
#include <rtl/bootstrap.hxx>
#include <sal/log.hxx>
-#include <unotools/localfilehelper.hxx>
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -45,11 +45,11 @@ using namespace connectivity::firebird;
// Static const variables
namespace {
-constexpr OUStringLiteral our_sFirebirdTmpVar = u"FIREBIRD_TMP";
-constexpr OUStringLiteral our_sFirebirdLockVar = u"FIREBIRD_LOCK";
-constexpr OUStringLiteral our_sFirebirdMsgVar = u"FIREBIRD_MSG";
+constexpr OUString our_sFirebirdTmpVar = u"FIREBIRD_TMP"_ustr;
+constexpr OUString our_sFirebirdLockVar = u"FIREBIRD_LOCK"_ustr;
+constexpr OUString our_sFirebirdMsgVar = u"FIREBIRD_MSG"_ustr;
#ifdef MACOSX
-constexpr OUStringLiteral our_sFirebirdLibVar = u"LIBREOFFICE_FIREBIRD_LIB";
+constexpr OUString our_sFirebirdLibVar = u"LIBREOFFICE_FIREBIRD_LIB"_ustr;
#endif
};
@@ -62,21 +62,23 @@ FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentCo
// ::utl::TempFile uses a unique temporary directory (subdirectory of
// /tmp or other user specific tmp directory) per instance in which
// we can create directories for firebird at will.
+ m_firebirdTMPDirectory.EnableKillingFile(true);
+ m_firebirdLockDirectory.EnableKillingFile(true);
// Overrides firebird's default of /tmp or c:\temp
- osl_setEnvironment(OUString(our_sFirebirdTmpVar).pData, m_firebirdTMPDirectory.GetFileName().pData);
+ osl_setEnvironment(our_sFirebirdTmpVar.pData, m_firebirdTMPDirectory.GetFileName().pData);
// Overrides firebird's default of /tmp/firebird or c:\temp\firebird
- osl_setEnvironment(OUString(our_sFirebirdLockVar).pData, m_firebirdLockDirectory.GetFileName().pData);
+ osl_setEnvironment(our_sFirebirdLockVar.pData, m_firebirdLockDirectory.GetFileName().pData);
#ifndef SYSTEM_FIREBIRD
// Overrides firebird's hardcoded default of /usr/local/firebird on *nix,
// however on Windows it seems to use the current directory as a default.
- OUString sMsgURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/firebird");
+ OUString sMsgURL(u"$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/firebird"_ustr);
::rtl::Bootstrap::expandMacros(sMsgURL);
OUString sMsgPath;
::osl::FileBase::getSystemPathFromFileURL(sMsgURL, sMsgPath);
- osl_setEnvironment(OUString(our_sFirebirdMsgVar).pData, sMsgPath.pData);
+ osl_setEnvironment(our_sFirebirdMsgVar.pData, sMsgPath.pData);
#ifdef MACOSX
// Set an env. variable to specify library location
// for dlopen used in fbclient.
@@ -84,16 +86,12 @@ FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentCo
::rtl::Bootstrap::expandMacros(sLibURL);
OUString sLibPath;
::osl::FileBase::getSystemPathFromFileURL(sLibURL, sLibPath);
- osl_setEnvironment(OUString(our_sFirebirdLibVar).pData, sLibPath.pData);
+ osl_setEnvironment(our_sFirebirdLibVar.pData, sLibPath.pData);
#endif /*MACOSX*/
#endif /*!SYSTEM_FIREBIRD*/
}
-FirebirdDriver::~FirebirdDriver()
-{
- utl::removeTree(m_firebirdTMPDirectory.GetURL());
- utl::removeTree(m_firebirdLockDirectory.GetURL());
-}
+FirebirdDriver::~FirebirdDriver() = default;
void FirebirdDriver::disposing()
{
@@ -101,30 +99,30 @@ void FirebirdDriver::disposing()
for (auto const& elem : m_xConnections)
{
- Reference< XComponent > xComp(elem.get(), UNO_QUERY);
+ rtl::Reference< Connection > xComp(elem.get());
if (xComp.is())
xComp->dispose();
}
m_xConnections.clear();
- osl_clearEnvironment(OUString(our_sFirebirdTmpVar).pData);
- osl_clearEnvironment(OUString(our_sFirebirdLockVar).pData);
+ osl_clearEnvironment(our_sFirebirdTmpVar.pData);
+ osl_clearEnvironment(our_sFirebirdLockVar.pData);
#ifndef SYSTEM_FIREBIRD
- osl_clearEnvironment(OUString(our_sFirebirdMsgVar).pData);
+ osl_clearEnvironment(our_sFirebirdMsgVar.pData);
#ifdef MACOSX
- osl_clearEnvironment(OUString(our_sFirebirdLibVar).pData);
+ osl_clearEnvironment(our_sFirebirdLibVar.pData);
#endif /*MACOSX*/
#endif /*!SYSTEM_FIREBIRD*/
- OSL_VERIFY(fb_shutdown(0, 1));
+ OSL_VERIFY(fb_shutdown(0, 1) == 0);
ODriver_BASE::disposing();
}
OUString SAL_CALL FirebirdDriver::getImplementationName()
{
- return "com.sun.star.comp.sdbc.firebird.Driver";
+ return u"com.sun.star.comp.sdbc.firebird.Driver"_ustr;
}
sal_Bool SAL_CALL FirebirdDriver::supportsService(const OUString& _rServiceName)
@@ -134,7 +132,7 @@ sal_Bool SAL_CALL FirebirdDriver::supportsService(const OUString& _rServiceName)
Sequence< OUString > SAL_CALL FirebirdDriver::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr, u"com.sun.star.sdbcx.Driver"_ustr };
}
// ---- XDriver -------------------------------------------------------------
@@ -150,13 +148,12 @@ Reference< XConnection > SAL_CALL FirebirdDriver::connect(
if ( ! acceptsURL(url) )
return nullptr;
- Connection* pCon = new Connection();
- Reference< XConnection > xCon = pCon;
+ rtl::Reference<Connection> pCon = new Connection();
pCon->construct(url, info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon);
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL FirebirdDriver::acceptsURL( const OUString& url )
@@ -193,8 +190,9 @@ sal_Int32 SAL_CALL FirebirdDriver::getMinorVersion( )
uno::Reference< XTablesSupplier > SAL_CALL FirebirdDriver::getDataDefinitionByConnection(
const uno::Reference< XConnection >& rConnection)
{
- Connection* pConnection = static_cast< Connection* >(rConnection.get());
- return pConnection->createCatalog();
+ if (Connection* pConnection = comphelper::getFromUnoTunnel<Connection>(rConnection))
+ return pConnection->createCatalog();
+ return {};
}
uno::Reference< XTablesSupplier > SAL_CALL FirebirdDriver::getDataDefinitionByURL(
@@ -227,5 +225,4 @@ connectivity_FirebirdDriver_get_implementation(
}
}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx
index 59cb1c49db69..5428568b4166 100644
--- a/connectivity/source/drivers/firebird/Driver.hxx
+++ b/connectivity/source/drivers/firebird/Driver.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
+#pragma once
#include "Connection.hxx"
@@ -28,64 +27,66 @@
#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
#include <cppuhelper/compbase.hxx>
#include <unotools/tempfile.hxx>
+#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
+
+ typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver,
+ css::sdbcx::XDataDefinitionSupplier,
+ css::lang::XServiceInfo > ODriver_BASE;
+
+ class FirebirdDriver : public ODriver_BASE
{
- // The SQL dialect in use
- // Has to be used in various isc_* calls.
- // 3: Is IB6 -- minimum required for delimited identifiers.
- const int FIREBIRD_SQL_DIALECT = 3;
-
- 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::TempFile m_firebirdTMPDirectory;
- ::utl::TempFile m_firebirdLockDirectory;
-
- protected:
- ::osl::Mutex m_aMutex; // mutex is need to control member access
- OWeakRefArray m_xConnections; // vector containing a list
- // of all the Connection objects
- // for this Driver
-
- 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; }
-
- // 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;
-
- // 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;
- };
+ 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
+
+ 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; }
+
+ // 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;
+
+ // 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Indexes.cxx b/connectivity/source/drivers/firebird/Indexes.cxx
index 6cdb8eb4ab5f..7bf783c79c7b 100644
--- a/connectivity/source/drivers/firebird/Indexes.cxx
+++ b/connectivity/source/drivers/firebird/Indexes.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -13,12 +13,11 @@ using namespace ::connectivity;
using namespace ::connectivity::firebird;
using namespace ::osl;
-using namespace ::std;
using namespace ::com::sun::star;
using namespace ::com::sun::star::sdbc;
-Indexes::Indexes(Table* pTable, Mutex& rMutex, const vector<OUString>& rVector)
+Indexes::Indexes(Table* pTable, Mutex& rMutex, const std::vector<OUString>& rVector)
: OIndexesHelper(pTable, rMutex, rVector)
, m_pTable(pTable)
{
@@ -30,3 +29,5 @@ void Indexes::dropObject(sal_Int32 /*nPosition*/, const OUString& sIndexName)
OUString sSql("DROP INDEX \"" + sIndexName + "\"");
m_pTable->getConnection()->createStatement()->execute(sSql);
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Indexes.hxx b/connectivity/source/drivers/firebird/Indexes.hxx
index 7f1044cb8b0a..58991e23a788 100644
--- a/connectivity/source/drivers/firebird/Indexes.hxx
+++ b/connectivity/source/drivers/firebird/Indexes.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,36 +7,33 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_INDEXES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_INDEXES_HXX
+#pragma once
#include "Table.hxx"
#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
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_INDEXES_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Keys.cxx b/connectivity/source/drivers/firebird/Keys.cxx
index dd4cca47fb20..18d74c8b6ac0 100644
--- a/connectivity/source/drivers/firebird/Keys.cxx
+++ b/connectivity/source/drivers/firebird/Keys.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -37,7 +37,7 @@ void Keys::dropObject(sal_Int32 nPosition, const OUString& sName)
if (m_pTable->isNew())
return;
- uno::Reference<XPropertySet> xKey(getObject(nPosition), UNO_QUERY);
+ uno::Reference<XPropertySet> xKey(getObject(nPosition));
if (xKey.is())
{
@@ -51,4 +51,4 @@ void Keys::dropObject(sal_Int32 nPosition, const OUString& sName)
}
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Keys.hxx b/connectivity/source/drivers/firebird/Keys.hxx
index 466ee9c81d0e..fb3d3ca036d4 100644
--- a/connectivity/source/drivers/firebird/Keys.hxx
+++ b/connectivity/source/drivers/firebird/Keys.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,32 +7,30 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_KEYS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_KEYS_HXX
+#pragma once
#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;
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_KEYS_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index e4510b758055..c1ebd314ea7e 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -20,8 +20,6 @@
#include <sal/config.h>
#include <cmath>
-#include <string_view>
-
#include "Connection.hxx"
#include "PreparedStatement.hxx"
#include "ResultSet.hxx"
@@ -50,7 +48,9 @@ using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.firebird.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(OPreparedStatement,u"com.sun.star.sdbcx.firebird.PreparedStatement"_ustr,u"com.sun.star.sdbc.PreparedStatement"_ustr);
+
+constexpr size_t MAX_SIZE_SEGMENT = 65535; // max value of a segment of CLOB, if we want more than 65535 bytes, we need more segments
OPreparedStatement::OPreparedStatement( Connection* _pConnection,
@@ -77,13 +77,12 @@ void OPreparedStatement::ensurePrepared()
if (!m_pInSqlda)
{
m_pInSqlda = static_cast<XSQLDA*>(calloc(1, XSQLDA_LENGTH(10)));
+ assert(m_pInSqlda && "Don't handle OOM conditions");
m_pInSqlda->version = SQLDA_VERSION1;
m_pInSqlda->sqln = 10;
}
- prepareAndDescribeStatement(m_sSqlStatement,
- m_pOutSqlda,
- m_pInSqlda);
+ prepareAndDescribeStatement(m_sSqlStatement, m_pOutSqlda);
aErr = isc_dsql_describe_bind(m_statusVector,
&m_aStatementHandle,
@@ -99,6 +98,7 @@ void OPreparedStatement::ensurePrepared()
short nItems = m_pInSqlda->sqld;
free(m_pInSqlda);
m_pInSqlda = static_cast<XSQLDA*>(calloc(1, XSQLDA_LENGTH(nItems)));
+ assert(m_pInSqlda && "Don't handle OOM conditions");
m_pInSqlda->version = SQLDA_VERSION1;
m_pInSqlda->sqln = nItems;
aErr = isc_dsql_describe_bind(m_statusVector,
@@ -118,12 +118,12 @@ OPreparedStatement::~OPreparedStatement()
{
}
-void SAL_CALL OPreparedStatement::acquire() throw()
+void SAL_CALL OPreparedStatement::acquire() noexcept
{
OStatementCommonBase::acquire();
}
-void SAL_CALL OPreparedStatement::release() throw()
+void SAL_CALL OPreparedStatement::release() noexcept
{
OStatementCommonBase::release();
}
@@ -193,80 +193,89 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex,
checkParameterIndex(nParameterIndex);
setParameterNull(nParameterIndex, false);
- OString str = OUStringToOString(sInput , RTL_TEXTENCODING_UTF8 );
-
XSQLVAR* pVar = m_pInSqlda->sqlvar + (nParameterIndex - 1);
+ ColumnTypeInfo columnType(*pVar);
- int dtype = (pVar->sqltype & ~1); // drop flag bit for now
-
- if (str.getLength() > pVar->sqllen)
- str = str.copy(0, pVar->sqllen);
-
- switch (dtype) {
- case SQL_VARYING:
+ switch (auto sdbcType = columnType.getSdbcType()) {
+ case DataType::VARCHAR:
+ case DataType::CHAR:
{
- const sal_Int32 max_varchar_len = 0xFFFF;
- // First 2 bytes indicate string size
- if (str.getLength() > max_varchar_len)
+ OString str = OUStringToOString(sInput, RTL_TEXTENCODING_UTF8);
+ const ISC_SHORT nLength = std::min(str.getLength(), static_cast<sal_Int32>(pVar->sqllen));
+ int offset = 0;
+ if (sdbcType == DataType::VARCHAR)
{
- str = str.copy(0, max_varchar_len);
+ // First 2 bytes indicate string size
+ static_assert(sizeof(nLength) == 2, "must match dest memcpy len");
+ memcpy(pVar->sqldata, &nLength, 2);
+ offset = 2;
}
- const auto nLength = str.getLength();
- memcpy(pVar->sqldata, &nLength, 2);
// Actual data
- memcpy(pVar->sqldata + 2, str.getStr(), str.getLength());
+ memcpy(pVar->sqldata + offset, str.getStr(), nLength);
+ if (sdbcType == DataType::CHAR)
+ {
+ // Fill remainder with spaces
+ memset(pVar->sqldata + offset + nLength, ' ', pVar->sqllen - nLength);
+ }
break;
}
- case SQL_TEXT:
- memcpy(pVar->sqldata, str.getStr(), str.getLength());
- // Fill remainder with spaces
- memset(pVar->sqldata + str.getLength(), ' ', pVar->sqllen - str.getLength());
- break;
- case SQL_BLOB: // Clob
- assert( pVar->sqlsubtype == static_cast<short>(BlobSubtype::Clob) );
+ case DataType::CLOB:
setClob(nParameterIndex, sInput );
break;
- case SQL_SHORT:
+ case DataType::SMALLINT:
{
sal_Int32 int32Value = sInput.toInt32();
if ( (int32Value < std::numeric_limits<sal_Int16>::min()) ||
(int32Value > std::numeric_limits<sal_Int16>::max()) )
{
::dbtools::throwSQLException(
- "Value out of range for SQL_SHORT type",
+ u"Value out of range for SQL_SHORT type"_ustr,
::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
*this);
}
setShort(nParameterIndex, int32Value);
break;
}
- case SQL_LONG:
+ case DataType::INTEGER:
{
sal_Int32 int32Value = sInput.toInt32();
setInt(nParameterIndex, int32Value);
break;
}
- case SQL_INT64:
+ case DataType::BIGINT:
{
sal_Int64 int64Value = sInput.toInt64();
setLong(nParameterIndex, int64Value);
break;
}
- case SQL_FLOAT:
+ case DataType::FLOAT:
{
float floatValue = sInput.toFloat();
setFloat(nParameterIndex, floatValue);
break;
}
- case SQL_BOOLEAN:
+ case DataType::DOUBLE:
+ setDouble(nParameterIndex, sInput.toDouble());
+ break;
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ return setObjectWithInfo(nParameterIndex, Any{ sInput }, sdbcType, 0);
+ break;
+ case DataType::BOOLEAN:
{
bool boolValue = sInput.toBoolean();
setBoolean(nParameterIndex, boolValue);
break;
}
+ case DataType::SQLNULL:
+ {
+ // See https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull
+ pVar->sqldata = nullptr;
+ break;
+ }
default:
::dbtools::throwSQLException(
- "Incorrect type for setString",
+ u"Incorrect type for setString"_ustr,
::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
*this);
}
@@ -277,7 +286,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection()
MutexGuard aGuard( m_aMutex );
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
- return Reference<XConnection>(m_pConnection.get());
+ return m_pConnection;
}
sal_Bool SAL_CALL OPreparedStatement::execute()
@@ -307,7 +316,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
// Do not throw error. Trying to close a closed cursor is not a
// critical mistake.
OUString sErrMsg = StatusVectorToString(m_statusVector,
- "isc_dsql_free_statement: close cursor");
+ u"isc_dsql_free_statement: close cursor");
SAL_WARN("connectivity.firebird", sErrMsg);
}
}
@@ -320,7 +329,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
if (aErr)
{
SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
- evaluateStatusVector(m_statusVector, "isc_dsql_execute", *this);
+ evaluateStatusVector(m_statusVector, u"isc_dsql_execute", *this);
}
m_xResultSet = new OResultSet(m_pConnection.get(),
@@ -329,9 +338,6 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
m_aStatementHandle,
m_pOutSqlda);
- if (getStatementChangeCount() > 0)
- m_pConnection->notifyDatabaseModified();
-
return m_xResultSet.is();
// TODO: implement handling of multiple ResultSets.
}
@@ -350,44 +356,97 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery()
namespace {
+sal_Int64 toPowOf10AndRound(double n, int powOf10)
+{
+ static constexpr sal_Int64 powers[] = {
+ 1,
+ 10,
+ 100,
+ 1000,
+ 10000,
+ 100000,
+ 1000000,
+ 10000000,
+ 100000000,
+ 1000000000,
+ 10000000000,
+ 100000000000,
+ 1000000000000,
+ 10000000000000,
+ 100000000000000,
+ 1000000000000000,
+ 10000000000000000,
+ 100000000000000000,
+ 1000000000000000000,
+ };
+ powOf10 = std::clamp(powOf10, 0, int(std::size(powers) - 1));
+ return n * powers[powOf10] + (n >= 0 ? 0.5 : -0.5);
+}
+
/**
* Take out the number part of a fix point decimal without
* the information of where is the fractional part from a
* string representation of a number. (e.g. 54.654 -> 54654)
*/
-sal_Int64 toNumericWithoutDecimalPlace(const OUString& sSource)
+sal_Int64 toNumericWithoutDecimalPlace(const Any& x, sal_Int32 scale)
{
- OUString sNumber(sSource);
-
- // cut off leading 0 eventually ( eg. 0.567 -> .567)
- (void)sSource.startsWith("0", &sNumber);
+ if (double value = 0; x >>= value)
+ return toPowOf10AndRound(value, scale);
- sal_Int32 nDotIndex = sNumber.indexOf('.');
+ // Can't use conversion of string to double, because it could be not representable in double
- if( nDotIndex < 0)
+ OUString s;
+ x >>= s;
+ std::u16string_view num(o3tl::trim(s));
+ size_t end = num.starts_with('-') ? 1 : 0;
+ for (bool seenDot = false; end < num.size(); ++end)
{
- return sNumber.toInt64(); // no dot -> it's an integer
+ if (num[end] == '.')
+ {
+ if (seenDot)
+ break;
+ seenDot = true;
+ }
+ else if (!rtl::isAsciiDigit(num[end]))
+ break;
}
- else
+ num = num.substr(0, end);
+
+ // fill in the number with nulls in fractional part.
+ // We need this because e.g. 0.450 != 0.045 despite
+ // their scale is equal
+ OUStringBuffer buffer(num);
+ if (auto dotPos = num.find('.'); dotPos != std::u16string_view::npos) // there is a dot
{
- // remove dot
- OUStringBuffer sBuffer(15);
- if(nDotIndex > 0)
+ scale -= num.substr(dotPos + 1).size();
+ buffer.remove(dotPos, 1);
+ if (scale < 0)
{
- sBuffer.append(std::u16string_view(sNumber).substr(0, nDotIndex));
+ const sal_Int32 n = std::min(buffer.getLength(), -scale);
+ buffer.truncate(buffer.getLength() - n);
+ scale = 0;
}
- sBuffer.append(std::u16string_view(sNumber).substr(nDotIndex + 1));
- return sBuffer.makeStringAndClear().toInt64();
}
+ for (sal_Int32 i = 0; i < scale; ++i)
+ buffer.append('0');
+
+ return OUString::unacquired(buffer).toInt64();
}
+double toDouble(const Any& x)
+{
+ if (double value = 0; x >>= value)
+ return value;
+ OUString s;
+ x >>= s;
+ return s.toDouble();
+}
}
//----- XParameters -----------------------------------------------------------
void SAL_CALL OPreparedStatement::setNull(sal_Int32 nIndex, sal_Int32 /*nSqlType*/)
{
MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
ensurePrepared();
checkParameterIndex(nIndex);
@@ -403,7 +462,6 @@ template <typename T>
void OPreparedStatement::setValue(sal_Int32 nIndex, const T& nValue, ISC_SHORT nType)
{
MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
ensurePrepared();
checkParameterIndex(nIndex);
@@ -414,7 +472,7 @@ void OPreparedStatement::setValue(sal_Int32 nIndex, const T& nValue, ISC_SHORT n
if ((pVar->sqltype & ~1) != nType)
{
::dbtools::throwSQLException(
- "Incorrect type for setValue",
+ u"Incorrect type for setValue"_ustr,
::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
*this);
}
@@ -422,20 +480,48 @@ void OPreparedStatement::setValue(sal_Int32 nIndex, const T& nValue, ISC_SHORT n
memcpy(pVar->sqldata, &nValue, sizeof(nValue));
}
+// Integral type setters convert transparently to bigger types
+
void SAL_CALL OPreparedStatement::setByte(sal_Int32 nIndex, sal_Int8 nValue)
{
// there's no TINYINT or equivalent on Firebird,
// so do the same as setShort
- setValue< sal_Int16 >(nIndex, nValue, SQL_SHORT);
+ setShort(nIndex, nValue);
}
void SAL_CALL OPreparedStatement::setShort(sal_Int32 nIndex, sal_Int16 nValue)
{
+ MutexGuard aGuard(m_aMutex);
+ ensurePrepared();
+
+ ColumnTypeInfo columnType{ m_pInSqlda, nIndex };
+ switch (columnType.getSdbcType())
+ {
+ case DataType::INTEGER:
+ return setValue<sal_Int32>(nIndex, nValue, columnType.getType());
+ case DataType::BIGINT:
+ return setValue<sal_Int64>(nIndex, nValue, columnType.getType());
+ case DataType::FLOAT:
+ return setValue<float>(nIndex, nValue, columnType.getType());
+ case DataType::DOUBLE:
+ return setValue<double>(nIndex, nValue, columnType.getType());
+ }
setValue< sal_Int16 >(nIndex, nValue, SQL_SHORT);
}
void SAL_CALL OPreparedStatement::setInt(sal_Int32 nIndex, sal_Int32 nValue)
{
+ MutexGuard aGuard(m_aMutex);
+ ensurePrepared();
+
+ ColumnTypeInfo columnType{ m_pInSqlda, nIndex };
+ switch (columnType.getSdbcType())
+ {
+ case DataType::BIGINT:
+ return setValue<sal_Int64>(nIndex, nValue, columnType.getType());
+ case DataType::DOUBLE:
+ return setValue<double>(nIndex, nValue, columnType.getType());
+ }
setValue< sal_Int32 >(nIndex, nValue, SQL_LONG);
}
@@ -452,51 +538,34 @@ void SAL_CALL OPreparedStatement::setFloat(sal_Int32 nIndex, float nValue)
void SAL_CALL OPreparedStatement::setDouble(sal_Int32 nIndex, double nValue)
{
MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
ensurePrepared();
- XSQLVAR* pVar = m_pInSqlda->sqlvar + (nIndex - 1);
- short dType = (pVar->sqltype & ~1); // drop flag bit for now
- short dSubType = pVar->sqlsubtype;
+ ColumnTypeInfo columnType{ m_pInSqlda, nIndex };
// Assume it is a sub type of a number.
- if(dSubType < 0 || dSubType > 2)
+ if (columnType.getSubType() < 0 || columnType.getSubType() > 2)
{
::dbtools::throwSQLException(
- "Incorrect number sub type",
+ u"Incorrect number sub type"_ustr,
::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
*this);
}
- // firebird stores scale as a negative number
- ColumnTypeInfo columnType{ dType, dSubType,
- static_cast<short>(-pVar->sqlscale) };
// Caller might try to set an integer type here. It makes sense to convert
// it instead of throwing an error.
- switch(columnType.getSdbcType())
+ switch(auto sdbcType = columnType.getSdbcType())
{
case DataType::SMALLINT:
- setValue< sal_Int16 >(nIndex,
- static_cast<sal_Int16>(nValue),
- dType);
- break;
+ return setValue(nIndex, static_cast<sal_Int16>(nValue), columnType.getType());
case DataType::INTEGER:
- setValue< sal_Int32 >(nIndex,
- static_cast<sal_Int32>(nValue),
- dType);
- break;
+ return setValue(nIndex, static_cast<sal_Int32>(nValue), columnType.getType());
case DataType::BIGINT:
- setValue< sal_Int64 >(nIndex,
- static_cast<sal_Int64>(nValue),
- dType);
- break;
+ return setValue(nIndex, static_cast<sal_Int64>(nValue), columnType.getType());
case DataType::NUMERIC:
case DataType::DECIMAL:
- // take decimal places into account, later on they are removed in makeNumericString
- setObjectWithInfo(nIndex,Any{nValue}, columnType.getSdbcType(), columnType.getScale());
- break;
- default:
- setValue< double >(nIndex, nValue, SQL_DOUBLE); // TODO: SQL_D_FLOAT?
+ return setObjectWithInfo(nIndex, Any{ nValue }, sdbcType, 0);
+ // TODO: SQL_D_FLOAT?
}
+ setValue<double>(nIndex, nValue, SQL_DOUBLE);
}
void SAL_CALL OPreparedStatement::setDate(sal_Int32 nIndex, const Date& rDate)
@@ -565,7 +634,7 @@ void OPreparedStatement::openBlobForWriting(isc_blob_handle& rBlobHandle, ISC_QU
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "setBlob failed on " + m_sSqlStatement,
+ Concat2View("setBlob failed on " + m_sSqlStatement),
*this);
assert(false);
}
@@ -580,7 +649,7 @@ void OPreparedStatement::closeBlobAfterWriting(isc_blob_handle& rBlobHandle)
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "isc_close_blob failed",
+ u"isc_close_blob failed",
*this);
assert(false);
}
@@ -591,11 +660,8 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 nParameterIndex, const Refer
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
-#if SAL_TYPES_SIZEOFPOINTER == 8
- isc_blob_handle aBlobHandle = 0;
-#else
- isc_blob_handle aBlobHandle = nullptr;
-#endif
+ // value-initialization: isc_blob_handle may be either a pointer of an integer
+ isc_blob_handle aBlobHandle{};
ISC_QUAD aBlobId;
openBlobForWriting(aBlobHandle, aBlobId);
@@ -607,9 +673,9 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 nParameterIndex, const Refer
sal_Int64 nCharWritten = 1; // XClob is indexed from 1
ISC_STATUS aErr = 0;
sal_Int64 nLen = xClob->length();
- while ( nLen > nCharWritten )
+ while ( nLen >= nCharWritten )
{
- sal_Int64 nCharRemain = nLen - nCharWritten;
+ sal_Int64 nCharRemain = nLen - nCharWritten + 1;
constexpr sal_uInt16 MAX_SIZE = SAL_MAX_UINT16 / 4;
sal_uInt16 nWriteSize = std::min<sal_Int64>(nCharRemain, MAX_SIZE);
OString sData = OUStringToOString(
@@ -632,7 +698,7 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 nParameterIndex, const Refer
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "isc_put_segment failed",
+ u"isc_put_segment failed",
*this);
assert(false);
}
@@ -640,17 +706,14 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 nParameterIndex, const Refer
setValue< ISC_QUAD >(nParameterIndex, aBlobId, SQL_BLOB);
}
-void OPreparedStatement::setClob( sal_Int32 nParameterIndex, const OUString& rStr )
+void OPreparedStatement::setClob(sal_Int32 nParameterIndex, std::u16string_view rStr)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
checkParameterIndex(nParameterIndex);
-#if SAL_TYPES_SIZEOFPOINTER == 8
- isc_blob_handle aBlobHandle = 0;
-#else
- isc_blob_handle aBlobHandle = nullptr;
-#endif
+ // value-initialization: isc_blob_handle may be either a pointer of an integer
+ isc_blob_handle aBlobHandle{};
ISC_QUAD aBlobId;
openBlobForWriting(aBlobHandle, aBlobId);
@@ -658,10 +721,41 @@ void OPreparedStatement::setClob( sal_Int32 nParameterIndex, const OUString& rSt
OString sData = OUStringToOString(
rStr,
RTL_TEXTENCODING_UTF8);
- ISC_STATUS aErr = isc_put_segment( m_statusVector,
+ size_t nDataSize = sData.getLength();
+ ISC_STATUS aErr = 0;
+ // we can't store more than MAX_SIZE_SEGMENT in a segment
+ if (nDataSize <= MAX_SIZE_SEGMENT)
+ {
+ aErr = isc_put_segment( m_statusVector,
&aBlobHandle,
sData.getLength(),
sData.getStr() );
+ }
+ else
+ {
+ // if we need more, let's split the input and first let's calculate the nb of entire chunks needed
+ size_t nNbEntireChunks = nDataSize / MAX_SIZE_SEGMENT;
+ for (size_t i = 0; i < nNbEntireChunks; ++i)
+ {
+ OString strCurrentChunk = sData.copy(i * MAX_SIZE_SEGMENT, MAX_SIZE_SEGMENT);
+ aErr = isc_put_segment( m_statusVector,
+ &aBlobHandle,
+ strCurrentChunk.getLength(),
+ strCurrentChunk.getStr() );
+ if (aErr)
+ break;
+ }
+ size_t nRemainingBytes = nDataSize - (nNbEntireChunks * MAX_SIZE_SEGMENT);
+ if (nRemainingBytes && !aErr)
+ {
+ // then copy the remaining
+ OString strCurrentChunk = sData.copy(nNbEntireChunks * MAX_SIZE_SEGMENT, nRemainingBytes);
+ aErr = isc_put_segment( m_statusVector,
+ &aBlobHandle,
+ strCurrentChunk.getLength(),
+ strCurrentChunk.getStr() );
+ }
+ }
// We need to make sure we close the Blob even if there are errors, hence evaluate
// errors after closing.
@@ -670,7 +764,7 @@ void OPreparedStatement::setClob( sal_Int32 nParameterIndex, const OUString& rSt
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "isc_put_segment failed",
+ u"isc_put_segment failed",
*this);
assert(false);
}
@@ -685,11 +779,8 @@ void SAL_CALL OPreparedStatement::setBlob(sal_Int32 nParameterIndex,
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
checkParameterIndex(nParameterIndex);
-#if SAL_TYPES_SIZEOFPOINTER == 8
- isc_blob_handle aBlobHandle = 0;
-#else
- isc_blob_handle aBlobHandle = nullptr;
-#endif
+ // value-initialization: isc_blob_handle may be either a pointer of an integer
+ isc_blob_handle aBlobHandle{};
ISC_QUAD aBlobId;
openBlobForWriting(aBlobHandle, aBlobId);
@@ -722,7 +813,7 @@ void SAL_CALL OPreparedStatement::setBlob(sal_Int32 nParameterIndex,
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "isc_put_segment failed",
+ u"isc_put_segment failed",
*this);
assert(false);
}
@@ -756,62 +847,28 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
checkParameterIndex(parameterIndex);
setParameterNull(parameterIndex, false);
- XSQLVAR* pVar = m_pInSqlda->sqlvar + (parameterIndex - 1);
- int dType = (pVar->sqltype & ~1); // drop null flag
+ ColumnTypeInfo columnType{ m_pInSqlda, parameterIndex };
+ int dType = columnType.getType() & ~1; // drop null flag
if(sqlType == DataType::DECIMAL || sqlType == DataType::NUMERIC)
{
- double dbValue =0.0;
- OUString sValue;
- if( x >>= dbValue )
- {
- // truncate and round to 'scale' number of decimal places
- sValue = OUString::number( std::floor((dbValue * pow10Integer(scale)) + .5) / pow10Integer(scale) );
- }
- else
- {
- x >>= sValue;
- }
-
- // fill in the number with nulls in fractional part.
- // We need this because e.g. 0.450 != 0.045 despite
- // their scale is equal
- OUStringBuffer sBuffer(15);
- sBuffer.append(sValue);
- if(sValue.indexOf('.') != -1) // there is a dot
- {
- for(sal_Int32 i=sValue.copy(sValue.indexOf('.')+1).getLength(); i<scale;i++)
- {
- sBuffer.append('0');
- }
- }
- else
- {
- for (sal_Int32 i=0; i<scale; i++)
- {
- sBuffer.append('0');
- }
- }
-
- sValue = sBuffer.makeStringAndClear();
switch(dType)
{
case SQL_SHORT:
- setValue< sal_Int16 >(parameterIndex,
- static_cast<sal_Int16>( toNumericWithoutDecimalPlace(sValue) ),
- dType);
- break;
+ return setValue(
+ parameterIndex,
+ static_cast<sal_Int16>(toNumericWithoutDecimalPlace(x, columnType.getScale())),
+ dType);
case SQL_LONG:
- case SQL_DOUBLE:
- setValue< sal_Int32 >(parameterIndex,
- static_cast<sal_Int32>( toNumericWithoutDecimalPlace(sValue) ),
- dType);
- break;
+ return setValue(
+ parameterIndex,
+ static_cast<sal_Int32>(toNumericWithoutDecimalPlace(x, columnType.getScale())),
+ dType);
case SQL_INT64:
- setValue< sal_Int64 >(parameterIndex,
- toNumericWithoutDecimalPlace(sValue),
- dType);
- break;
+ return setValue(parameterIndex,
+ toNumericWithoutDecimalPlace(x, columnType.getScale()), dType);
+ case SQL_DOUBLE:
+ return setValue(parameterIndex, toDouble(x), dType);
default:
SAL_WARN("connectivity.firebird",
"No Firebird sql type found for numeric or decimal types");
@@ -853,11 +910,8 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
if( dType == SQL_BLOB )
{
-#if SAL_TYPES_SIZEOFPOINTER == 8
- isc_blob_handle aBlobHandle = 0;
-#else
- isc_blob_handle aBlobHandle = nullptr;
-#endif
+ // value-initialization: isc_blob_handle may be either a pointer of an integer
+ isc_blob_handle aBlobHandle{};
ISC_QUAD aBlobId;
openBlobForWriting(aBlobHandle, aBlobId);
@@ -890,7 +944,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "isc_put_segment failed",
+ u"isc_put_segment failed",
*this);
assert(false);
}
@@ -901,12 +955,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
{
setParameterNull(nParameterIndex, false);
const sal_Int32 nMaxSize = 0xFFFF;
- Sequence<sal_Int8> xBytesCopy(xBytes);
- if (xBytesCopy.getLength() > nMaxSize)
- {
- xBytesCopy.realloc( nMaxSize );
- }
- const auto nSize = xBytesCopy.getLength();
+ const sal_uInt16 nSize = std::min(xBytes.getLength(), nMaxSize);
// 8000 corresponds to value from lcl_addDefaultParameters
// in dbaccess/source/filter/hsqldb/createparser.cxx
if (nSize > 8000)
@@ -914,22 +963,26 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
free(pVar->sqldata);
pVar->sqldata = static_cast<char *>(malloc(sizeof(char) * nSize + 2));
}
+ static_assert(sizeof(nSize) == 2, "must match dest memcpy len");
// First 2 bytes indicate string size
memcpy(pVar->sqldata, &nSize, 2);
// Actual data
- memcpy(pVar->sqldata + 2, xBytesCopy.getConstArray(), nSize);
+ memcpy(pVar->sqldata + 2, xBytes.getConstArray(), nSize);
}
else if( dType == SQL_TEXT )
{
+ if (pVar->sqllen < xBytes.getLength())
+ dbtools::throwSQLException(u"Data too big for this field"_ustr,
+ dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE, *this);
setParameterNull(nParameterIndex, false);
memcpy(pVar->sqldata, xBytes.getConstArray(), xBytes.getLength() );
- // Fill remainder with spaces
+ // Fill remainder with zeroes
memset(pVar->sqldata + xBytes.getLength(), 0, pVar->sqllen - xBytes.getLength());
}
else
{
::dbtools::throwSQLException(
- "Incorrect type for setBytes",
+ u"Incorrect type for setBytes"_ustr,
::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
*this);
}
@@ -1015,4 +1068,4 @@ void OPreparedStatement::setParameterNull(sal_Int32 nParameterIndex,
*pVar->sqlind = 0;
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.hxx b/connectivity/source/drivers/firebird/PreparedStatement.hxx
index db64c0b763e7..1c0fbb8f13f0 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.hxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_PREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_PREPAREDSTATEMENT_HXX
+#pragma once
#include "StatementCommonBase.hxx"
@@ -33,122 +32,121 @@
#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 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;
- css::uno::Reference< css::sdbc::XResultSetMetaData > 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, const OUString& 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_PREPAREDSTATEMENT_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index 7ae77c607e0d..ce6b875554da 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -144,23 +144,21 @@ sal_Bool SAL_CALL OResultSet::next()
{
SAL_WARN("connectivity.firebird", "Error when fetching data");
// Throws sql exception as appropriate
- evaluateStatusVector(m_statusVector, "isc_dsql_fetch", *this);
+ evaluateStatusVector(m_statusVector, u"isc_dsql_fetch", *this);
return false;
}
}
sal_Bool SAL_CALL OResultSet::previous()
{
- ::dbtools::throwFunctionNotSupportedSQLException("previous not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"previous not supported in firebird"_ustr,
*this);
- return false;
}
sal_Bool SAL_CALL OResultSet::isLast()
{
- ::dbtools::throwFunctionNotSupportedSQLException("isLast not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"isLast not supported in firebird"_ustr,
*this);
- return false;
}
sal_Bool SAL_CALL OResultSet::isBeforeFirst()
@@ -193,7 +191,7 @@ void SAL_CALL OResultSet::beforeFirst()
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
if (m_currentRow != 0)
- ::dbtools::throwFunctionNotSupportedSQLException("beforeFirst not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"beforeFirst not supported in firebird"_ustr,
*this);
}
@@ -203,7 +201,7 @@ void SAL_CALL OResultSet::afterLast()
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
if (!m_bIsAfterLastRow)
- ::dbtools::throwFunctionNotSupportedSQLException("afterLast not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"afterLast not supported in firebird"_ustr,
*this);
}
@@ -222,7 +220,7 @@ sal_Bool SAL_CALL OResultSet::first()
}
else
{
- ::dbtools::throwFunctionNotSupportedSQLException("first not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"first not supported in firebird"_ustr,
*this);
return false;
}
@@ -232,9 +230,8 @@ sal_Bool SAL_CALL OResultSet::last()
{
// We need to iterate past the last row to know when we've passed the last
// row, hence we can't actually move to last.
- ::dbtools::throwFunctionNotSupportedSQLException("last not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"last not supported in firebird"_ustr,
*this);
- return false;
}
sal_Bool SAL_CALL OResultSet::absolute(sal_Int32 aRow)
@@ -249,7 +246,7 @@ sal_Bool SAL_CALL OResultSet::absolute(sal_Int32 aRow)
}
else
{
- ::dbtools::throwFunctionNotSupportedSQLException("absolute not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"absolute not supported in firebird"_ustr,
*this);
return false;
}
@@ -271,7 +268,7 @@ sal_Bool SAL_CALL OResultSet::relative(sal_Int32 row)
}
else
{
- ::dbtools::throwFunctionNotSupportedSQLException("relative not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"relative not supported in firebird"_ustr,
*this);
return false;
}
@@ -299,7 +296,7 @@ void OResultSet::checkRowIndex()
if((m_currentRow < 1) || m_bIsAfterLastRow)
{
::dbtools::throwSQLException(
- "Invalid Row",
+ u"Invalid Row"_ustr,
::dbtools::StandardSQLState::INVALID_CURSOR_POSITION,
*this);
}
@@ -334,8 +331,6 @@ sal_Int32 SAL_CALL OResultSet::findColumn(const OUString& rColumnName)
}
::dbtools::throwInvalidColumnException(rColumnName, *this);
- assert(false);
- return 0; // Never reached
}
uno::Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 )
@@ -368,7 +363,7 @@ bool OResultSet::isNull(const sal_Int32 nColumnIndex)
return false;
}
-template <typename T>
+template <typename T> requires std::is_integral_v<T>
OUString OResultSet::makeNumericString(const sal_Int32 nColumnIndex)
{
// minus because firebird stores scale as a negative number
@@ -382,40 +377,14 @@ OUString OResultSet::makeNumericString(const sal_Int32 nColumnIndex)
OUStringBuffer sRetBuffer;
T nAllDigits = *reinterpret_cast<T*>(m_pSqlda->sqlvar[nColumnIndex-1].sqldata);
- sal_Int64 nDecimalCountExp = pow10Integer(nDecimalCount);
-
- if(nAllDigits < 0)
- {
- sRetBuffer.append('-');
- nAllDigits = -nAllDigits; // abs
- }
-
- sRetBuffer.append(static_cast<sal_Int64>(nAllDigits / nDecimalCountExp) );
- if( nDecimalCount > 0)
- {
- sRetBuffer.append('.');
-
- sal_Int64 nFractionalPart = nAllDigits % nDecimalCountExp;
-
- int iCount = 0; // digit count
- sal_Int64 nFracTemp = nFractionalPart;
- while(nFracTemp>0)
- {
- nFracTemp /= 10;
- iCount++;
- }
+ sRetBuffer.append(static_cast<sal_Int64>(nAllDigits));
+ sal_Int32 insertionPos = nAllDigits < 0 ? 1 : 0; // consider leading minus
+ int nMissingNulls = nDecimalCount - (sRetBuffer.getLength() - insertionPos) + 1;
+ for (int i = 0; i < nMissingNulls; ++i)
+ sRetBuffer.insert(insertionPos, '0');
- int nMissingNulls = nDecimalCount - iCount;
-
- // append nulls after dot and before nFractionalPart
- for(int i=0; i<nMissingNulls; i++)
- {
- sRetBuffer.append('0');
- }
-
- // the rest
- sRetBuffer.append(nFractionalPart);
- }
+ if (nDecimalCount)
+ sRetBuffer.insert(sRetBuffer.getLength() - nDecimalCount, '.');
return sRetBuffer.makeStringAndClear();
}
@@ -430,13 +399,29 @@ T OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT nType)
if ((m_pSqlda->sqlvar[nColumnIndex-1].sqltype & ~1) == nType)
return *reinterpret_cast<T*>(m_pSqlda->sqlvar[nColumnIndex-1].sqldata);
else
- return retrieveValue< ORowSetValue >(nColumnIndex, 0);
+ {
+ ORowSetValue row = retrieveValue< ORowSetValue >(nColumnIndex, 0);
+ if constexpr ( std::is_same_v<sal_Int64, T> )
+ return row.getLong();
+ else if constexpr ( std::is_same_v<sal_Int32, T> )
+ return row.getInt32();
+ else if constexpr ( std::is_same_v<sal_Int16, T> )
+ return row.getInt16();
+ else if constexpr ( std::is_same_v<float, T> )
+ return row.getFloat();
+ else if constexpr ( std::is_same_v<double, T> )
+ return row.getDouble();
+ else if constexpr ( std::is_same_v<bool, T> )
+ return row.getBool();
+ else
+ return row;
+ }
}
template <>
ORowSetValue OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT /*nType*/)
{
- // See http://wiki.openoffice.org/wiki/Documentation/DevGuide/Database/Using_the_getXXX_Methods
+ // See https://wiki.documentfoundation.org/Documentation/DevGuide/Database_Access#Using_the_getXXX_Methods
// (bottom of page) for a chart of possible conversions, we should allow all
// of these -- Blob/Clob will probably need some specialist handling especially
// w.r.t. to generating Strings for them.
@@ -511,7 +496,7 @@ Date OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT /*n
}
else
{
- return retrieveValue< ORowSetValue >(nColumnIndex, 0);
+ return retrieveValue< ORowSetValue >(nColumnIndex, 0).getDate();
}
}
@@ -534,7 +519,7 @@ Time OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT /*n
}
else
{
- return retrieveValue< ORowSetValue >(nColumnIndex, 0);
+ return retrieveValue< ORowSetValue >(nColumnIndex, 0).getTime();
}
}
@@ -560,7 +545,7 @@ DateTime OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT
}
else
{
- return retrieveValue< ORowSetValue >(nColumnIndex, 0);
+ return retrieveValue< ORowSetValue >(nColumnIndex, 0).getDateTime();
}
}
@@ -579,10 +564,11 @@ OUString OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT
else if (aSqlType == SQL_VARYING)
{
// First 2 bytes are a short containing the length of the string
- // No idea if sqllen is still valid here?
+ // Under unclear conditions, it may be wrong and greater than sqllen.
sal_uInt16 aLength = *reinterpret_cast<sal_uInt16*>(m_pSqlda->sqlvar[nColumnIndex-1].sqldata);
+ // Use greater signed type sal_Int32 to get the minimum of two 16-bit values
return OUString(m_pSqlda->sqlvar[nColumnIndex-1].sqldata + 2,
- aLength,
+ std::min<sal_Int32>(aLength, m_pSqlda->sqlvar[nColumnIndex-1].sqllen),
RTL_TEXTENCODING_UTF8);
}
else if ((aSqlType == SQL_SHORT || aSqlType == SQL_LONG ||
@@ -610,11 +596,11 @@ OUString OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT
else if(aSqlType == SQL_BLOB && aSqlSubType == static_cast<short>(BlobSubtype::Clob) )
{
uno::Reference<XClob> xClob = getClob(nColumnIndex);
- return xClob->getSubString( 0, xClob->length() );
+ return xClob->getSubString( 1, xClob->length() );
}
else
{
- return retrieveValue< ORowSetValue >(nColumnIndex, 0);
+ return retrieveValue< ORowSetValue >(nColumnIndex, 0).getString();
}
}
@@ -662,7 +648,7 @@ sal_Bool SAL_CALL OResultSet::getBoolean(sal_Int32 nColumnIndex)
sal_Int8 SAL_CALL OResultSet::getByte(sal_Int32 nColumnIndex)
{
// Not a native firebird type hence we always have to convert.
- return safelyRetrieveValue< ORowSetValue >(nColumnIndex);
+ return safelyRetrieveValue< ORowSetValue >(nColumnIndex).getInt8();
}
Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes(sal_Int32 nColumnIndex)
@@ -830,31 +816,28 @@ uno::Reference< XInterface > SAL_CALL OResultSet::getStatement()
//----- XResultSet: unsupported change detection methods ---------------------
sal_Bool SAL_CALL OResultSet::rowDeleted()
{
- ::dbtools::throwFunctionNotSupportedSQLException("rowDeleted not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"rowDeleted not supported in firebird"_ustr,
*this);
- return false;
}
+
sal_Bool SAL_CALL OResultSet::rowInserted()
{
- ::dbtools::throwFunctionNotSupportedSQLException("rowInserted not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"rowInserted not supported in firebird"_ustr,
*this);
- return false;
}
sal_Bool SAL_CALL OResultSet::rowUpdated()
{
- ::dbtools::throwFunctionNotSupportedSQLException("rowUpdated not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"rowUpdated not supported in firebird"_ustr,
*this);
- return false;
}
void SAL_CALL OResultSet::refreshRow()
{
- ::dbtools::throwFunctionNotSupportedSQLException("refreshRow not supported in firebird",
+ ::dbtools::throwFunctionNotSupportedSQLException(u"refreshRow not supported in firebird"_ustr,
*this);
}
-
void SAL_CALL OResultSet::cancel( )
{
MutexGuard aGuard(m_rMutex);
@@ -875,12 +858,12 @@ IPropertyArrayHelper & OResultSet::getInfoHelper()
return *getArrayHelper();
}
-void SAL_CALL OResultSet::acquire() throw()
+void SAL_CALL OResultSet::acquire() noexcept
{
OResultSet_BASE::acquire();
}
-void SAL_CALL OResultSet::release() throw()
+void SAL_CALL OResultSet::release() noexcept
{
OResultSet_BASE::release();
}
@@ -893,12 +876,12 @@ uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertyS
// ---- XServiceInfo -----------------------------------------------------------
OUString SAL_CALL OResultSet::getImplementationName()
{
- return "com.sun.star.sdbcx.firebird.ResultSet";
+ return u"com.sun.star.sdbcx.firebird.ResultSet"_ustr;
}
Sequence< OUString > SAL_CALL OResultSet::getSupportedServiceNames()
{
- return {"com.sun.star.sdbc.ResultSet","com.sun.star.sdbcx.ResultSet"};
+ return {u"com.sun.star.sdbc.ResultSet"_ustr,u"com.sun.star.sdbcx.ResultSet"_ustr};
}
sal_Bool SAL_CALL OResultSet::supportsService(const OUString& _rServiceName)
@@ -906,4 +889,4 @@ sal_Bool SAL_CALL OResultSet::supportsService(const OUString& _rServiceName)
return cppu::supportsService(this, _rServiceName);
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/ResultSet.hxx b/connectivity/source/drivers/firebird/ResultSet.hxx
index 7306e0c42405..66814748bd6b 100644
--- a/connectivity/source/drivers/firebird/ResultSet.hxx
+++ b/connectivity/source/drivers/firebird/ResultSet.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSET_HXX
+#pragma once
#include "Connection.hxx"
@@ -36,183 +35,185 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#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>
{
- /*
- ** 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 mange 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;
-
- css::uno::Reference< css::sdbc::XResultSetMetaData> 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> 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() throw() override;
- virtual void SAL_CALL release() throw() 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);
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSET_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx
index d21115029df3..1e2db23e0256 100644
--- a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx
+++ b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -53,8 +53,8 @@ OUString OResultSetMetaData::getCharacterSet( sal_Int32 nIndex )
"JOIN RDB$RELATION_FIELDS relfields "
"ON (fields.RDB$FIELD_NAME = relfields.RDB$FIELD_SOURCE) "
"WHERE relfields.RDB$RELATION_NAME = '"
- + escapeWith(sTable, '\'', '\'') + "' AND "
- "relfields.RDB$FIELD_NAME = '"+ escapeWith(sColumnName, '\'', '\'') +"'";
+ + sTable.replaceAll("'", "''") + "' AND "
+ "relfields.RDB$FIELD_NAME = '"+ sColumnName.replaceAll("'", "''") +"'";
Reference<XStatement> xStmt= m_pConnection->createStatement();
@@ -75,7 +75,7 @@ OUString OResultSetMetaData::getCharacterSet( sal_Int32 nIndex )
void OResultSetMetaData::verifyValidColumn(sal_Int32 column)
{
if (column>getColumnCount() || column < 1)
- throw SQLException("Invalid column specified", *this, OUString(), 0, Any());
+ throw SQLException(u"Invalid column specified"_ustr, *this, OUString(), 0, Any());
}
sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount()
@@ -102,10 +102,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnType(sal_Int32 column)
sCharset = getCharacterSet(column);
}
- ColumnTypeInfo aInfo( m_pSqlda->sqlvar[column-1].sqltype,
- m_pSqlda->sqlvar[column-1].sqlsubtype,
- -(m_pSqlda->sqlvar[column-1].sqlscale),
- sCharset );
+ ColumnTypeInfo aInfo(m_pSqlda, column, sCharset);
return aInfo.getSdbcType();
}
@@ -128,9 +125,25 @@ OUString SAL_CALL OResultSetMetaData::getSchemaName(sal_Int32)
OUString SAL_CALL OResultSetMetaData::getColumnName(sal_Int32 column)
{
verifyValidColumn(column);
- OUString sRet(m_pSqlda->sqlvar[column-1].sqlname,
- m_pSqlda->sqlvar[column-1].sqlname_length,
- RTL_TEXTENCODING_UTF8);
+ char* pColumnName = m_pSqlda->sqlvar[column - 1].sqlname;
+ sal_Int32 nColumnNameLength = m_pSqlda->sqlvar[column - 1].sqlname_length;
+ // tdf#132924 - return column alias if specified
+ if (m_pSqlda->sqlvar[column - 1].aliasname_length > 0)
+ {
+ pColumnName = m_pSqlda->sqlvar[column - 1].aliasname;
+ nColumnNameLength = m_pSqlda->sqlvar[column - 1].aliasname_length;
+ }
+ OUString sRet(pColumnName, nColumnNameLength, RTL_TEXTENCODING_UTF8);
+ sanitizeIdentifier(sRet);
+ return sRet;
+}
+
+OUString OResultSetMetaData::getColumnNameWithoutAlias(sal_Int32 column)
+{
+ verifyValidColumn(column);
+ char* pColumnName = m_pSqlda->sqlvar[column - 1].sqlname;
+ sal_Int32 nColumnNameLength = m_pSqlda->sqlvar[column - 1].sqlname_length;
+ OUString sRet(pColumnName, nColumnNameLength, RTL_TEXTENCODING_UTF8);
sanitizeIdentifier(sRet);
return sRet;
}
@@ -152,9 +165,7 @@ OUString SAL_CALL OResultSetMetaData::getColumnTypeName(sal_Int32 column)
{
verifyValidColumn(column);
- ColumnTypeInfo aInfo( m_pSqlda->sqlvar[column-1].sqltype,
- m_pSqlda->sqlvar[column-1].sqlsubtype,
- -(m_pSqlda->sqlvar[column-1].sqlscale) );
+ ColumnTypeInfo aInfo(m_pSqlda, column);
return aInfo.getColumnTypeName();
}
@@ -184,34 +195,34 @@ sal_Bool SAL_CALL OResultSetMetaData::isCurrency(sal_Int32)
sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement(sal_Int32 column)
{
OUString sTable = getTableName(column);
- if( !sTable.isEmpty() )
- {
- OUString sColumnName = getColumnName( column );
+ if( sTable.isEmpty() )
+ return false;
- OUString sSql = "SELECT RDB$IDENTITY_TYPE FROM RDB$RELATION_FIELDS "
- "WHERE RDB$RELATION_NAME = '"
- + escapeWith(sTable, '\'', '\'') + "' AND "
- "RDB$FIELD_NAME = '"+ escapeWith(sColumnName, '\'', '\'') +"'";
+ OUString sColumnName = getColumnNameWithoutAlias( column );
- Reference<XStatement> xStmt =m_pConnection ->createStatement();
+ OUString sSql = "SELECT RDB$IDENTITY_TYPE FROM RDB$RELATION_FIELDS "
+ "WHERE RDB$RELATION_NAME = '"
+ + sTable.replaceAll("'", "''") + "' AND "
+ "RDB$FIELD_NAME = '"+ sColumnName.replaceAll("'", "''") +"'";
- Reference<XResultSet> xRes =
- xStmt->executeQuery(sSql);
- Reference<XRow> xRow ( xRes, UNO_QUERY);
- if(xRes->next())
- {
- int iType = xRow->getShort(1);
- if(iType == 1) // IDENTITY
- return true;
- }
- else
- {
- SAL_WARN("connectivity.firebird","Column '"
- << sColumnName
- << "' not found in database");
+ Reference<XStatement> xStmt =m_pConnection ->createStatement();
- return false;
- }
+ Reference<XResultSet> xRes =
+ xStmt->executeQuery(sSql);
+ Reference<XRow> xRow ( xRes, UNO_QUERY);
+ if(xRes->next())
+ {
+ int iType = xRow->getShort(1);
+ if(iType == 1) // IDENTITY
+ return true;
+ }
+ else
+ {
+ SAL_WARN("connectivity.firebird","Column '"
+ << sColumnName
+ << "' not found in database");
+
+ return false;
}
return false;
}
@@ -226,34 +237,34 @@ sal_Bool SAL_CALL OResultSetMetaData::isSigned(sal_Int32)
sal_Int32 SAL_CALL OResultSetMetaData::getPrecision(sal_Int32 column)
{
sal_Int32 nType = getColumnType(column);
- if( nType == DataType::NUMERIC || nType == DataType::DECIMAL )
+ if( nType != DataType::NUMERIC && nType != DataType::DECIMAL )
+ return 0;
+
+ OUString sColumnName = getColumnName( column );
+
+ // RDB$FIELD_SOURCE is a unique name of column per database
+ OUString sSql = "SELECT RDB$FIELD_PRECISION FROM RDB$FIELDS "
+ " INNER JOIN RDB$RELATION_FIELDS "
+ " ON RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME "
+ "WHERE RDB$RELATION_FIELDS.RDB$RELATION_NAME = '"
+ + getTableName(column).replaceAll("'", "''") + "' AND "
+ "RDB$RELATION_FIELDS.RDB$FIELD_NAME = '"
+ + sColumnName.replaceAll("'", "''") +"'";
+ Reference<XStatement> xStmt= m_pConnection->createStatement();
+
+ Reference<XResultSet> xRes =
+ xStmt->executeQuery(sSql);
+ Reference<XRow> xRow ( xRes, UNO_QUERY);
+ if(xRes->next())
{
- OUString sColumnName = getColumnName( column );
-
- // RDB$FIELD_SOURCE is a unique name of column per database
- OUString sSql = "SELECT RDB$FIELD_PRECISION FROM RDB$FIELDS "
- " INNER JOIN RDB$RELATION_FIELDS "
- " ON RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME "
- "WHERE RDB$RELATION_FIELDS.RDB$RELATION_NAME = '"
- + escapeWith(getTableName(column), '\'', '\'') + "' AND "
- "RDB$RELATION_FIELDS.RDB$FIELD_NAME = '"
- + escapeWith(sColumnName, '\'', '\'') +"'";
- Reference<XStatement> xStmt= m_pConnection->createStatement();
-
- Reference<XResultSet> xRes =
- xStmt->executeQuery(sSql);
- Reference<XRow> xRow ( xRes, UNO_QUERY);
- if(xRes->next())
- {
- return static_cast<sal_Int32>(xRow->getShort(1));
- }
- else
- {
- SAL_WARN("connectivity.firebird","Column '"
- << sColumnName
- << "' not found in database");
- return 0;
- }
+ return static_cast<sal_Int32>(xRow->getShort(1));
+ }
+ else
+ {
+ SAL_WARN("connectivity.firebird","Column '"
+ << sColumnName
+ << "' not found in database");
+ return 0;
}
return 0;
}
@@ -292,5 +303,4 @@ sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 )
return !m_pConnection->isReadOnly();
}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/ResultSetMetaData.hxx b/connectivity/source/drivers/firebird/ResultSetMetaData.hxx
index 95c36ab958d4..ece967379205 100644
--- a/connectivity/source/drivers/firebird/ResultSetMetaData.hxx
+++ b/connectivity/source/drivers/firebird/ResultSetMetaData.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSETMETADATA_HXX
+#pragma once
#include "Connection.hxx"
@@ -30,54 +29,53 @@
#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;
+ OUString getColumnNameWithoutAlias(sal_Int32 column);
+ 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_RESULTSETMETADATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Statement.cxx b/connectivity/source/drivers/firebird/Statement.cxx
index 418c66a7d0cd..6b24e5c33321 100644
--- a/connectivity/source/drivers/firebird/Statement.cxx
+++ b/connectivity/source/drivers/firebird/Statement.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -40,7 +40,6 @@ using namespace com::sun::star::util;
using namespace ::comphelper;
using namespace ::osl;
-using namespace ::std;
// ---- XBatchExecution - UNSUPPORTED ----------------------------------------
void SAL_CALL OStatement::addBatch(const OUString&)
@@ -56,14 +55,14 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch()
return Sequence< sal_Int32 >();
}
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(OStatement,u"com.sun.star.sdbcx.OStatement"_ustr,u"com.sun.star.sdbc.Statement"_ustr);
-void SAL_CALL OStatement::acquire() throw()
+void SAL_CALL OStatement::acquire() noexcept
{
OStatementCommonBase::acquire();
}
-void SAL_CALL OStatement::release() throw()
+void SAL_CALL OStatement::release() noexcept
{
OStatementCommonBase::release();
}
@@ -71,7 +70,8 @@ void SAL_CALL OStatement::release() throw()
void OStatement::disposeResultSet()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
+ if (OStatementCommonBase_Base::rBHelper.bDisposed)
+ return;
OStatementCommonBase::disposeResultSet();
@@ -126,11 +126,6 @@ uno::Reference< XResultSet > SAL_CALL OStatement::executeQuery(const OUString& s
if (isDDLStatement())
{
m_pConnection->commit();
- m_pConnection->notifyDatabaseModified();
- }
- else if (getStatementChangeCount() > 0)
- {
- m_pConnection->notifyDatabaseModified();
}
return m_xResultSet;
@@ -148,7 +143,7 @@ uno::Reference< XConnection > SAL_CALL OStatement::getConnection()
MutexGuard aGuard(m_aMutex);
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
- return uno::Reference<XConnection>(m_pConnection.get());
+ return m_pConnection;
}
Any SAL_CALL OStatement::queryInterface( const Type & rType )
@@ -172,4 +167,5 @@ void SAL_CALL OStatement::disposing()
disposeResultSet();
close();
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Statement.hxx b/connectivity/source/drivers/firebird/Statement.hxx
index 903f12407ee8..6e501633a88f 100644
--- a/connectivity/source/drivers/firebird/Statement.hxx
+++ b/connectivity/source/drivers/firebird/Statement.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENT_HXX
+#pragma once
#include "StatementCommonBase.hxx"
@@ -26,61 +25,60 @@
#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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENT_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
index 1d7d5ef32bdf..12ce9a8fd7ba 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,9 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "Driver.hxx"
#include "StatementCommonBase.hxx"
#include "Util.hxx"
+#include "ResultSet.hxx"
#include <sal/log.hxx>
#include <comphelper/sequence.hxx>
@@ -44,7 +44,6 @@ using namespace ::com::sun::star::util;
using namespace ::comphelper;
using namespace ::osl;
-using namespace ::std;
OStatementCommonBase::OStatementCommonBase(Connection* _pConnection)
: OStatementCommonBase_Base(m_aMutex),
@@ -64,9 +63,8 @@ OStatementCommonBase::~OStatementCommonBase()
void OStatementCommonBase::disposeResultSet()
{
- uno::Reference< XComponent > xComp(m_xResultSet, UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
+ if (m_xResultSet.is())
+ m_xResultSet->dispose();
m_xResultSet.clear();
}
@@ -78,7 +76,7 @@ void OStatementCommonBase::freeStatementHandle()
&m_aStatementHandle,
DSQL_drop);
evaluateStatusVector(m_statusVector,
- "isc_dsql_free_statement",
+ u"isc_dsql_free_statement",
*this);
}
}
@@ -124,9 +122,7 @@ void SAL_CALL OStatementCommonBase::close()
dispose();
}
-void OStatementCommonBase::prepareAndDescribeStatement(std::u16string_view sql,
- XSQLDA*& pOutSqlda,
- XSQLDA* pInSqlda)
+void OStatementCommonBase::prepareAndDescribeStatement(std::u16string_view sql, XSQLDA*& pOutSqlda)
{
SolarMutexGuard g; // tdf#122129
@@ -135,6 +131,7 @@ void OStatementCommonBase::prepareAndDescribeStatement(std::u16string_view sql,
if (!pOutSqlda)
{
pOutSqlda = static_cast<XSQLDA*>(calloc(1, XSQLDA_LENGTH(10)));
+ assert(pOutSqlda && "Don't handle OOM conditions");
pOutSqlda->version = SQLDA_VERSION1;
pOutSqlda->sqln = 10;
}
@@ -146,7 +143,7 @@ void OStatementCommonBase::prepareAndDescribeStatement(std::u16string_view sql,
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "isc_dsql_allocate_statement",
+ u"isc_dsql_allocate_statement",
*this);
}
else
@@ -156,56 +153,42 @@ void OStatementCommonBase::prepareAndDescribeStatement(std::u16string_view sql,
&m_aStatementHandle,
0,
OUStringToOString(sql, RTL_TEXTENCODING_UTF8).getStr(),
- FIREBIRD_SQL_DIALECT,
- pInSqlda);
+ SQL_DIALECT_CURRENT,
+ pOutSqlda);
if (aErr)
{
evaluateStatusVector(m_statusVector,
- "isc_dsql_prepare",
+ u"isc_dsql_prepare",
*this);
}
else
{
- aErr = isc_dsql_describe(m_statusVector,
- &m_aStatementHandle,
- 1,
- pOutSqlda);
+ // Ensure we have enough space in pOutSqlda
+ if (pOutSqlda->sqld > pOutSqlda->sqln)
+ {
+ int n = pOutSqlda->sqld;
+ free(pOutSqlda);
+ pOutSqlda = static_cast<XSQLDA*>(calloc(1, XSQLDA_LENGTH(n)));
+ assert(pOutSqlda && "Don't handle OOM conditions");
+ pOutSqlda->version = SQLDA_VERSION1;
+ pOutSqlda->sqln = n;
+ aErr = isc_dsql_describe(m_statusVector,
+ &m_aStatementHandle,
+ 1,
+ pOutSqlda);
+ }
+ // Process each XSQLVAR parameter structure in the output XSQLDA
if (aErr)
{
- // TODO: free statement handle, etc.?
evaluateStatusVector(m_statusVector,
- "isc_dsql_describe",
+ u"isc_dsql_describe",
*this);
}
else
{
- // Ensure we have enough space in pOutSqlda
- if (pOutSqlda->sqld > pOutSqlda->sqln)
- {
- int n = pOutSqlda->sqld;
- free(pOutSqlda);
- pOutSqlda = static_cast<XSQLDA*>(calloc(1, XSQLDA_LENGTH(n)));
- pOutSqlda->version = SQLDA_VERSION1;
- pOutSqlda->sqln = n;
- aErr = isc_dsql_describe(m_statusVector,
- &m_aStatementHandle,
- 1,
- pOutSqlda);
- }
-
- // Process each XSQLVAR parameter structure in the output XSQLDA
- if (aErr)
- {
- evaluateStatusVector(m_statusVector,
- "isc_dsql_describe",
- *this);
- }
- else
- {
- mallocSQLVAR(pOutSqlda);
- }
+ mallocSQLVAR(pOutSqlda);
}
}
if(aErr)
@@ -260,31 +243,71 @@ void SAL_CALL OStatementCommonBase::clearWarnings()
{
// this properties are define by the service statement
// they must in alphabetic order
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
- PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
- PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
- PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
- PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
- PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
+ PROPERTY_ID_ESCAPEPROCESSING,
+ cppu::UnoType<bool>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
+ PROPERTY_ID_MAXFIELDSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
+ PROPERTY_ID_MAXROWS,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
+ PROPERTY_ID_QUERYTIMEOUT,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
+ PROPERTY_ID_USEBOOKMARKS,
+ cppu::UnoType<bool>::get(),
+ 0
+ }
+ }
+ };
}
@@ -342,12 +365,12 @@ void OStatementCommonBase::getFastPropertyValue(Any&,sal_Int32 nHandle) const
}
}
-void SAL_CALL OStatementCommonBase::acquire() throw()
+void SAL_CALL OStatementCommonBase::acquire() noexcept
{
OStatementCommonBase_Base::acquire();
}
-void SAL_CALL OStatementCommonBase::release() throw()
+void SAL_CALL OStatementCommonBase::release() noexcept
{
OStatementCommonBase_Base::release();
}
@@ -379,7 +402,7 @@ short OStatementCommonBase::getSqlInfoItem(char aInfoItem)
}
evaluateStatusVector(aStatusVector,
- "isc_dsq_sql_info",
+ u"isc_dsq_sql_info",
*this);
return 0;
}
@@ -411,7 +434,7 @@ sal_Int32 OStatementCommonBase::getStatementChangeCount()
if (aErr)
{
evaluateStatusVector(aStatusVector,
- "isc_dsq_sql_info",
+ u"isc_dsq_sql_info",
*this);
return 0;
}
@@ -432,32 +455,34 @@ sal_Int32 OStatementCommonBase::getStatementChangeCount()
aDesiredInfoType = isc_info_req_delete_count;
break;
case isc_info_sql_stmt_exec_procedure:
+ case isc_info_sql_stmt_ddl:
return 0; // cannot determine
default:
throw SQLException(); // TODO: better error message?
}
char* pResults = aResultsBuffer;
- if (static_cast<short>(*pResults++) == isc_info_sql_records)
- {
-// const short aTotalLength = (short) isc_vax_integer(pResults, 2);
- pResults += 2;
+ if (static_cast<short>(*pResults++) != isc_info_sql_records)
+ return 0;
- // Seems to be of form TOKEN (1 byte), LENGTH (2 bytes), DATA (LENGTH bytes)
- while (*pResults != isc_info_rsb_end)
- {
- const char aToken = *pResults;
- const short aLength = static_cast<short>(isc_vax_integer(pResults+1, 2));
+// const short aTotalLength = (short) isc_vax_integer(pResults, 2);
+ pResults += 2;
- if (aToken == aDesiredInfoType)
- {
- return isc_vax_integer(pResults + 3, aLength);
- }
+ // Seems to be of form TOKEN (1 byte), LENGTH (2 bytes), DATA (LENGTH bytes)
+ while (*pResults != isc_info_rsb_end)
+ {
+ const char aToken = *pResults;
+ const short aLength = static_cast<short>(isc_vax_integer(pResults+1, 2));
- pResults += (3 + aLength);
+ if (aToken == aDesiredInfoType)
+ {
+ return isc_vax_integer(pResults + 3, aLength);
}
+
+ pResults += (3 + aLength);
}
return 0;
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.hxx b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
index c92dd8634109..17c130f7a374 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.hxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
+#pragma once
#include <sal/config.h>
@@ -38,102 +37,99 @@
#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>
-
- {
- protected:
- ::osl::Mutex m_aMutex;
-
- css::uno::Reference< css::sdbc::XResultSet> 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,
- XSQLDA* pInSqlda=nullptr);
-
- /// @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() throw() override;
- virtual void SAL_CALL acquire() throw() 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;
-
- };
+ 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>
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
+ {
+ 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;
+
+ };
+
+}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/SubComponent.hxx b/connectivity/source/drivers/firebird/SubComponent.hxx
index 4d9c107213f5..8eec40e3275d 100644
--- a/connectivity/source/drivers/firebird/SubComponent.hxx
+++ b/connectivity/source/drivers/firebird/SubComponent.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,97 +17,92 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_SUBCOMPONENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_SUBCOMPONENT_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
-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;
+ }
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_SUBCOMPONENT_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index 02718c78e731..c12ea8439333 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -59,8 +59,8 @@ Table::Table(Tables* pTables,
rName,
rType,
rDescription,
- "",
- ""),
+ u""_ustr,
+ u""_ustr),
m_rMutex(rMutex),
m_nPrivileges(0)
{
@@ -121,19 +121,19 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
uno::Reference< XPropertySet > xColumn(m_xColumns->getByName(rColName), UNO_QUERY);
// sdbcx::Descriptor
- const bool bNameChanged = xColumn->getPropertyValue("Name") != rDescriptor->getPropertyValue("Name");
+ const bool bNameChanged = xColumn->getPropertyValue(u"Name"_ustr) != rDescriptor->getPropertyValue(u"Name"_ustr);
// sdbcx::ColumnDescriptor
- const bool bTypeChanged = xColumn->getPropertyValue("Type") != rDescriptor->getPropertyValue("Type");
- const bool bTypeNameChanged = xColumn->getPropertyValue("TypeName") != rDescriptor->getPropertyValue("TypeName");
- const bool bPrecisionChanged = xColumn->getPropertyValue("Precision") != rDescriptor->getPropertyValue("Precision");
- const bool bScaleChanged = xColumn->getPropertyValue("Scale") != rDescriptor->getPropertyValue("Scale");
- const bool bIsNullableChanged = xColumn->getPropertyValue("IsNullable") != rDescriptor->getPropertyValue("IsNullable");
- const bool bIsAutoIncrementChanged = xColumn->getPropertyValue("IsAutoIncrement") != rDescriptor->getPropertyValue("IsAutoIncrement");
+ const bool bTypeChanged = xColumn->getPropertyValue(u"Type"_ustr) != rDescriptor->getPropertyValue(u"Type"_ustr);
+ const bool bTypeNameChanged = xColumn->getPropertyValue(u"TypeName"_ustr) != rDescriptor->getPropertyValue(u"TypeName"_ustr);
+ const bool bPrecisionChanged = xColumn->getPropertyValue(u"Precision"_ustr) != rDescriptor->getPropertyValue(u"Precision"_ustr);
+ const bool bScaleChanged = xColumn->getPropertyValue(u"Scale"_ustr) != rDescriptor->getPropertyValue(u"Scale"_ustr);
+ const bool bIsNullableChanged = xColumn->getPropertyValue(u"IsNullable"_ustr) != rDescriptor->getPropertyValue(u"IsNullable"_ustr);
+ const bool bIsAutoIncrementChanged = xColumn->getPropertyValue(u"IsAutoIncrement"_ustr) != rDescriptor->getPropertyValue(u"IsAutoIncrement"_ustr);
// TODO: remainder -- these are all "optional" so have to detect presence and change.
- bool bDefaultChanged = xColumn->getPropertyValue("DefaultValue")
- != rDescriptor->getPropertyValue("DefaultValue");
+ bool bDefaultChanged = xColumn->getPropertyValue(u"DefaultValue"_ustr)
+ != rDescriptor->getPropertyValue(u"DefaultValue"_ustr);
if (bTypeChanged || bTypeNameChanged || bPrecisionChanged || bScaleChanged)
{
@@ -150,32 +150,19 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
if (bIsNullableChanged)
{
sal_Int32 nNullable = 0;
- rDescriptor->getPropertyValue("IsNullable") >>= nNullable;
+ rDescriptor->getPropertyValue(u"IsNullable"_ustr) >>= nNullable;
if (nNullable != ColumnValue::NULLABLE_UNKNOWN)
{
- OUString sSql;
- // Dirty hack: can't change null directly in sql, we have to fiddle
- // the system tables manually.
+ OUString sSql(getAlterTableColumn(rColName));
if (nNullable == ColumnValue::NULLABLE)
{
- sSql = "UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL "
- "WHERE RDB$FIELD_NAME = '" + rColName + "' "
- "AND RDB$RELATION_NAME = '" + getName() + "'";
+ sSql += "DROP NOT NULL";
}
else if (nNullable == ColumnValue::NO_NULLS)
{
- // And if we are making NOT NULL then we have to make sure we have
- // no nulls left in the column.
- OUString sFillNulls("UPDATE \"" + getName() + "\" SET \""
- + rColName + "\" = 0 "
- "WHERE \"" + rColName + "\" IS NULL");
- getConnection()->createStatement()->execute(sFillNulls);
-
- sSql = "UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = 1 "
- "WHERE RDB$FIELD_NAME = '" + rColName + "' "
- "AND RDB$RELATION_NAME = '" + getName() + "'";
+ sSql += "SET NOT NULL";
}
getConnection()->createStatement()->execute(sSql);
}
@@ -188,7 +175,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
if (bIsAutoIncrementChanged)
{
::dbtools::throwSQLException(
- "Changing autoincrement property of existing column is not supported",
+ u"Changing autoincrement property of existing column is not supported"_ustr,
::dbtools::StandardSQLState::FUNCTION_NOT_SUPPORTED,
*this);
@@ -197,7 +184,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
if (bDefaultChanged)
{
OUString sNewDefault;
- rDescriptor->getPropertyValue("DefaultValue") >>= sNewDefault;
+ rDescriptor->getPropertyValue(u"DefaultValue"_ustr) >>= sNewDefault;
OUString sSql;
if (sNewDefault.isEmpty())
@@ -211,7 +198,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
if (bNameChanged)
{
OUString sNewColName;
- rDescriptor->getPropertyValue("Name") >>= sNewColName;
+ rDescriptor->getPropertyValue(u"Name"_ustr) >>= sNewColName;
OUString sSql(getAlterTableColumn(rColName)
+ " TO \"" + sNewColName + "\"");
@@ -225,7 +212,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
// ----- XRename --------------------------------------------------------------
void SAL_CALL Table::rename(const OUString&)
{
- throw RuntimeException("Table renaming not supported by Firebird.");
+ throw RuntimeException(u"Table renaming not supported by Firebird."_ustr);
}
// ----- XInterface -----------------------------------------------------------
@@ -237,26 +224,9 @@ Any SAL_CALL Table::queryInterface(const Type& rType)
return OTableHelper::queryInterface(rType);
}
-// ----- XTypeProvider --------------------------------------------------------
-uno::Sequence< Type > SAL_CALL Table::getTypes()
-{
- uno::Sequence< Type > aTypes = OTableHelper::getTypes();
-
- for (int i = 0; i < aTypes.getLength(); i++)
- {
- if (aTypes[i].getTypeName() == "com.sun.star.sdbcx.XRename")
- {
- ::comphelper::removeElementAt(aTypes, i);
- break;
- }
- }
-
- return OTableHelper::getTypes();
-}
-
OUString Table::getAlterTableColumn(std::u16string_view rColumn)
{
return ("ALTER TABLE \"" + getName() + "\" ALTER COLUMN \"" + rColumn + "\" ");
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Table.hxx b/connectivity/source/drivers/firebird/Table.hxx
index d2646dcd168d..024f905a88b5 100644
--- a/connectivity/source/drivers/firebird/Table.hxx
+++ b/connectivity/source/drivers/firebird/Table.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLE_HXX
+#pragma once
#include <sal/config.h>
@@ -19,70 +18,64 @@
#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;
-
- //XTypeProvider
- virtual css::uno::Sequence< css::uno::Type >
- SAL_CALL getTypes() override;
-
- };
+ virtual void SAL_CALL alterColumnByName(
+ const OUString& rColName,
+ const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override;
-} // namespace connectivity::firebird
+ // XRename -- UNSUPPORTED
+ virtual void SAL_CALL rename(const OUString& sName) override;
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLE_HXX
+ //XInterface
+ virtual css::uno::Any
+ SAL_CALL queryInterface(const css::uno::Type & rType) override;
+
+ };
+
+} // namespace connectivity::firebird
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index 5acb391caeb5..3675882446f4 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -9,8 +9,8 @@
#include "Table.hxx"
#include "Tables.hxx"
+#include "Views.hxx"
#include "Catalog.hxx"
-#include "Util.hxx"
#include <TConnection.hxx>
@@ -30,7 +30,6 @@ using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::uno;
@@ -42,7 +41,7 @@ void Tables::impl_refresh()
static_cast<Catalog&>(m_rParent).refreshTables();
}
-ObjectType Tables::createObject(const OUString& rName)
+css::uno::Reference< css::beans::XPropertySet > Tables::createObject(const OUString& rName)
{
// Only retrieving a single table, so table type is irrelevant (param 4)
uno::Reference< XResultSet > xTables = m_xMetaData->getTables(Any(),
@@ -51,14 +50,14 @@ ObjectType Tables::createObject(const OUString& rName)
uno::Sequence< OUString >());
if (!xTables.is())
- throw RuntimeException("Could not acquire table.");
+ throw RuntimeException(u"Could not acquire table."_ustr);
uno::Reference< XRow > xRow(xTables,UNO_QUERY_THROW);
if (!xTables->next())
throw RuntimeException();
- ObjectType xRet(new Table(this,
+ css::uno::Reference< css::beans::XPropertySet > xRet(new Table(this,
m_rMutex,
m_xMetaData->getConnection(),
xRow->getString(3), // Name
@@ -66,7 +65,7 @@ ObjectType Tables::createObject(const OUString& rName)
xRow->getString(5))); // Description / Remarks / Comments
if (xTables->next())
- throw RuntimeException("Found more tables than expected.");
+ throw RuntimeException(u"Found more tables than expected."_ustr);
return xRet;
}
@@ -81,7 +80,7 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bIsAutoIncrement;
const OUString sQuoteString = xMetaData->getIdentifierQuoteString();
- OUStringBuffer aSql = ::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))));
+ OUStringBuffer aSql(::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))));
// check if the user enter a specific string to create autoincrement values
OUString sAutoIncrementValue;
@@ -90,9 +89,8 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP
if ( xPropInfo.is() && xPropInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION)) )
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION)) >>= sAutoIncrementValue;
- aSql.append(" ");
-
- aSql.append(dbtools::createStandardTypePart(xColProp, _xConnection));
+ aSql.append(" "
+ + dbtools::createStandardTypePart(xColProp, _xConnection));
// Add character set for (VAR)BINARY (fix) types:
// (VAR) BINARY is distinguished from other CHAR types by its character set.
// Octets is a special character set for binary data.
@@ -104,15 +102,13 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP
>>= aType;
if(aType == DataType::BINARY || aType == DataType::VARBINARY)
{
- aSql.append(" ");
- aSql.append("CHARACTER SET OCTETS");
+ aSql.append(" CHARACTER SET OCTETS");
}
}
if ( bIsAutoIncrement && !sAutoIncrementValue.isEmpty())
{
- aSql.append(" ");
- aSql.append(sAutoIncrementValue);
+ aSql.append(" " + sAutoIncrementValue);
}
// AutoIncrement "IDENTITY" is implicitly "NOT NULL"
else if(::comphelper::getINT32(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS)
@@ -130,14 +126,14 @@ uno::Reference< XPropertySet > Tables::createDescriptor()
}
//----- XAppend ---------------------------------------------------------------
-ObjectType Tables::appendObject(const OUString& rName,
+css::uno::Reference< css::beans::XPropertySet > Tables::appendObject(const OUString& rName,
const uno::Reference< XPropertySet >& rDescriptor)
{
/* OUString sSql(::dbtools::createSqlCreateTableStatement(rDescriptor,
m_xMetaData->getConnection())); */
OUStringBuffer aSqlBuffer("CREATE TABLE ");
OUString sCatalog, sSchema, sComposedName, sTable;
- const Reference< XConnection>& xConnection = m_xMetaData->getConnection();
+ const Reference< XConnection> xConnection = m_xMetaData->getConnection();
::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
@@ -149,11 +145,11 @@ ObjectType Tables::appendObject(const OUString& rName,
if ( sComposedName.isEmpty() )
::dbtools::throwFunctionSequenceException(xConnection);
- aSqlBuffer.append(sComposedName);
- aSqlBuffer.append(" (");
+ aSqlBuffer.append(sComposedName
+ + " (");
// columns
- Reference<XColumnsSupplier> xColumnSup(rDescriptor,UNO_QUERY);
+ Reference<XColumnsSupplier> xColumnSup(rDescriptor, UNO_QUERY_THROW);
Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
// check if there are columns
if(!xColumns.is() || !xColumns->getCount())
@@ -166,24 +162,23 @@ ObjectType Tables::appendObject(const OUString& rName,
{
if ( (xColumns->getByIndex(i) >>= xColProp) && xColProp.is() )
{
- aSqlBuffer.append(createStandardColumnPart(xColProp,xConnection));
- aSqlBuffer.append(",");
+ aSqlBuffer.append(createStandardColumnPart(xColProp,xConnection)
+ + ",");
}
}
- OUString sSql = aSqlBuffer.makeStringAndClear();
const OUString sKeyStmt = ::dbtools::createStandardKeyStatement(rDescriptor,xConnection);
if ( !sKeyStmt.isEmpty() )
- sSql += sKeyStmt;
+ aSqlBuffer.append(sKeyStmt);
else
{
- if ( sSql.endsWith(",") )
- sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")");
+ if (aSqlBuffer[aSqlBuffer.getLength() - 1] == ',')
+ aSqlBuffer[aSqlBuffer.getLength() - 1] = ')';
else
- sSql += ")";
+ aSqlBuffer.append(")");
}
- m_xMetaData->getConnection()->createStatement()->execute(sSql);
+ m_xMetaData->getConnection()->createStatement()->execute(OUString::unacquired(aSqlBuffer));
return createObject(rName);
}
@@ -196,16 +191,34 @@ void Tables::dropObject(sal_Int32 nPosition, const OUString& sName)
if (ODescriptor::isNew(xTable))
return;
- OUStringBuffer sSql("DROP ");
-
OUString sType;
- xTable->getPropertyValue("Type") >>= sType;
- sSql.append(sType);
+ xTable->getPropertyValue(u"Type"_ustr) >>= sType;
const OUString sQuoteString = m_xMetaData->getIdentifierQuoteString();
- sSql.append(::dbtools::quoteName(sQuoteString,sName));
- m_xMetaData->getConnection()->createStatement()->execute(sSql.makeStringAndClear());
+ m_xMetaData->getConnection()->createStatement()->execute(
+ "DROP " + sType + " " + ::dbtools::quoteName(sQuoteString,sName));
+
+ if (sType == "VIEW")
+ {
+ Views* pViews = static_cast<Views*>(static_cast<Catalog&>(m_rParent).getPrivateViews());
+ if ( pViews && pViews->hasByName(sName) )
+ pViews->dropByNameImpl(sName);
+ }
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+void connectivity::firebird::Tables::appendNew(const OUString& _rsNewTable)
+{
+ insertElement(_rsNewTable, nullptr);
+
+ // notify our container listeners
+ css::container::ContainerEvent aEvent(static_cast<XContainer*>(this),
+ css::uno::Any(_rsNewTable), css::uno::Any(),
+ css::uno::Any());
+ comphelper::OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
+ while (aListenerLoop.hasMoreElements())
+ aListenerLoop.next()->elementInserted(aEvent);
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Tables.hxx b/connectivity/source/drivers/firebird/Tables.hxx
index 3f36b9865c3b..057d35c1ad33 100644
--- a/connectivity/source/drivers/firebird/Tables.hxx
+++ b/connectivity/source/drivers/firebird/Tables.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,56 +7,55 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLES_HXX
+#pragma once
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <connectivity/sdbcx/VCollection.hxx>
+#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;
- /**
- * 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< com::sun::star::sdbc::XConnection>& _xConnection);
-
- // OCollection
- virtual void impl_refresh() override;
- virtual ::connectivity::sdbcx::ObjectType createObject(
- const OUString& rName) override;
- virtual css::uno::Reference< css::beans::XPropertySet >
- createDescriptor() override;
- virtual ::connectivity::sdbcx::ObjectType appendObject(
- const OUString& rName,
- const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override;
-
- public:
- Tables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData,
- ::cppu::OWeakObject& rParent,
- ::osl::Mutex& rMutex,
- ::std::vector< OUString> const & rNames) : sdbcx::OCollection(rParent, true, rMutex, rNames), m_xMetaData(rMetaData) {}
-
- // TODO: we should also implement XDataDescriptorFactory, XRefreshable,
- // XAppend, etc., but all are optional.
-
- // XDrop
- virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override;
-
- };
+ static OUString createStandardColumnPart(const css::uno::Reference< css::beans::XPropertySet >& xColProp,const css::uno::Reference< css::sdbc::XConnection>& _xConnection);
-} // namespace connectivity::firebird
+ // 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;
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLES_HXX
+ void appendNew(const OUString& _rsNewTable);
+
+ };
+
+} // namespace connectivity::firebird
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/User.cxx b/connectivity/source/drivers/firebird/User.cxx
index 3a9682fb8264..9f647713a663 100644
--- a/connectivity/source/drivers/firebird/User.cxx
+++ b/connectivity/source/drivers/firebird/User.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -49,3 +49,5 @@ void User::refreshGroups()
{
// TODO: implement.
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/User.hxx b/connectivity/source/drivers/firebird/User.hxx
index 16fa138976b9..537c6f9aa1d8 100644
--- a/connectivity/source/drivers/firebird/User.hxx
+++ b/connectivity/source/drivers/firebird/User.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,44 +7,40 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_USER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_USER_HXX
+#pragma once
#include <sdbcx/VUser.hxx>
#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);
-} // namespace connectivity::firebird
+ // 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;
+ };
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_USER_HXX
+} // namespace connectivity::firebird
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Users.cxx b/connectivity/source/drivers/firebird/Users.cxx
index fc8914250ee6..265bae760946 100644
--- a/connectivity/source/drivers/firebird/Users.cxx
+++ b/connectivity/source/drivers/firebird/Users.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -17,8 +17,6 @@ using namespace ::cppu;
using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
@@ -41,7 +39,7 @@ void Users::impl_refresh()
// TODO: IMPLEMENT ME
}
-ObjectType Users::createObject(const OUString& rName)
+css::uno::Reference< css::beans::XPropertySet > Users::createObject(const OUString& rName)
{
return new User(m_xMetaData->getConnection(), rName);
}
@@ -55,7 +53,7 @@ uno::Reference< XPropertySet > Users::createDescriptor()
}
//----- XAppend ---------------------------------------------------------------
-ObjectType Users::appendObject(const OUString& rName,
+css::uno::Reference< css::beans::XPropertySet > Users::appendObject(const OUString& rName,
const uno::Reference< XPropertySet >&)
{
// TODO: set sSql as appropriate
@@ -75,4 +73,4 @@ void Users::dropObject(sal_Int32 nPosition, const OUString&)
}
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Users.hxx b/connectivity/source/drivers/firebird/Users.hxx
index 6a6be1ead6a6..a3c65460e162 100644
--- a/connectivity/source/drivers/firebird/Users.hxx
+++ b/connectivity/source/drivers/firebird/Users.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,51 +7,47 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_USERS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_USERS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#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 ::connectivity::sdbcx::ObjectType createObject(
- const OUString& rName) override;
- virtual css::uno::Reference< css::beans::XPropertySet >
- createDescriptor() override;
- virtual ::connectivity::sdbcx::ObjectType 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
-
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_USERS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index 82d69a123c97..8f11068e80f0 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -13,6 +13,7 @@
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
+#include <o3tl/string_view.hxx>
using namespace ::connectivity;
@@ -22,16 +23,16 @@ using namespace ::com::sun::star::uno;
using namespace firebird;
-OUString firebird::sanitizeIdentifier(const OUString& rIdentifier)
+OUString firebird::sanitizeIdentifier(std::u16string_view rIdentifier)
{
- OUString sRet = rIdentifier.trim();
- assert(sRet.getLength() <= 31); // Firebird identifiers cannot be longer than this.
+ std::u16string_view sRet = o3tl::trim(rIdentifier);
+ assert(sRet.size() <= 31); // Firebird identifiers cannot be longer than this.
- return sRet;
+ return OUString(sRet);
}
OUString firebird::StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector,
- const OUString& rCause)
+ std::u16string_view rCause)
{
OUStringBuffer buf;
const ISC_STATUS* pStatus = reinterpret_cast<const ISC_STATUS*>(&rStatusVector);
@@ -43,15 +44,15 @@ OUString firebird::StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector,
while(fb_interpret(msg, sizeof(msg), &pStatus))
{
// TODO: verify encoding
- buf.append("\n*");
- buf.append(OUString(msg, strlen(msg), RTL_TEXTENCODING_UTF8));
+ buf.append("\n*"
+ + OUString(msg, strlen(msg), RTL_TEXTENCODING_UTF8));
}
}
catch (...)
{
SAL_WARN("connectivity.firebird", "ignore fb_interpret exception");
}
- buf.append("\ncaused by\n'").append(rCause).append("'\n");
+ buf.append(OUString::Concat("\ncaused by\n'") + rCause + "'\n");
OUString error = buf.makeStringAndClear();
SAL_WARN("connectivity.firebird", error);
@@ -59,7 +60,7 @@ OUString firebird::StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector,
}
void firebird::evaluateStatusVector(const ISC_STATUS_ARRAY& rStatusVector,
- const OUString& rCause,
+ std::u16string_view rCause,
const uno::Reference< XInterface >& _rxContext)
{
if (IndicatesError(rStatusVector))
@@ -185,57 +186,57 @@ OUString firebird::ColumnTypeInfo::getColumnTypeName() const
switch (nDataType)
{
case DataType::BIT:
- return "BIT";
+ return u"BIT"_ustr;
case DataType::TINYINT:
- return "TINYINT";
+ return u"TINYINT"_ustr;
case DataType::SMALLINT:
- return "SMALLINT";
+ return u"SMALLINT"_ustr;
case DataType::INTEGER:
- return "INTEGER";
+ return u"INTEGER"_ustr;
case DataType::BIGINT:
- return "BIGINT";
+ return u"BIGINT"_ustr;
case DataType::FLOAT:
- return "FLOAT";
+ return u"FLOAT"_ustr;
case DataType::REAL:
- return "REAL";
+ return u"REAL"_ustr;
case DataType::DOUBLE:
- return "DOUBLE";
+ return u"DOUBLE"_ustr;
case DataType::NUMERIC:
- return "NUMERIC";
+ return u"NUMERIC"_ustr;
case DataType::DECIMAL:
- return "DECIMAL";
+ return u"DECIMAL"_ustr;
case DataType::CHAR:
- return "CHAR";
+ return u"CHAR"_ustr;
case DataType::VARCHAR:
- return "VARCHAR";
+ return u"VARCHAR"_ustr;
case DataType::LONGVARCHAR:
- return "LONGVARCHAR";
+ return u"LONGVARCHAR"_ustr;
case DataType::DATE:
- return "DATE";
+ return u"DATE"_ustr;
case DataType::TIME:
- return "TIME";
+ return u"TIME"_ustr;
case DataType::TIMESTAMP:
- return "TIMESTAMP";
+ return u"TIMESTAMP"_ustr;
case DataType::BINARY:
// in Firebird, that is the same datatype "CHAR" as DataType::CHAR,
// only with CHARACTER SET OCTETS; we use the synonym CHARACTER
// to fool LO into seeing it as different types.
- return "CHARACTER";
+ return u"CHARACTER"_ustr;
case DataType::VARBINARY:
// see above comment about DataType::BINARY.
- return "CHARACTER VARYING";
+ return u"CHARACTER VARYING"_ustr;
case DataType::LONGVARBINARY:
return "BLOB SUB_TYPE " + OUString::number(static_cast<short>(BlobSubtype::Image));
case DataType::ARRAY:
- return "ARRAY";
+ return u"ARRAY"_ustr;
case DataType::BLOB:
- return "BLOB SUB_TYPE BINARY";
+ return u"BLOB SUB_TYPE BINARY"_ustr;
case DataType::CLOB:
- return "BLOB SUB_TYPE TEXT";
+ return u"BLOB SUB_TYPE TEXT"_ustr;
case DataType::BOOLEAN:
- return "BOOLEAN";
+ return u"BOOLEAN"_ustr;
case DataType::SQLNULL:
- return "NULL";
+ return u"NULL"_ustr;
default:
assert(false); // Should never happen
return OUString();
@@ -316,8 +317,6 @@ void firebird::mallocSQLVAR(XSQLDA* pSqlda)
pVar->sqldata = static_cast<char *>(malloc(sizeof(float)));
break;
case SQL_DOUBLE:
- pVar->sqldata = static_cast<char *>(malloc(sizeof(double)));
- break;
case SQL_D_FLOAT:
pVar->sqldata = static_cast<char *>(malloc(sizeof(double)));
break;
@@ -342,8 +341,9 @@ void firebird::mallocSQLVAR(XSQLDA* pSqlda)
case SQL_BOOLEAN:
pVar->sqldata = static_cast<char *>(malloc(sizeof(sal_Bool)));
break;
+ // See https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull
case SQL_NULL:
- assert(false); // TODO: implement
+ pVar->sqldata = nullptr;
break;
case SQL_QUAD:
assert(false); // TODO: implement
@@ -388,7 +388,8 @@ void firebird::freeSQLVAR(XSQLDA* pSqlda)
}
break;
case SQL_NULL:
- assert(false); // TODO: implement
+ // See SQL_NULL case in mallocSQLVAR
+ assert(pVar->sqldata == nullptr);
break;
case SQL_QUAD:
assert(false); // TODO: implement
@@ -407,30 +408,4 @@ void firebird::freeSQLVAR(XSQLDA* pSqlda)
}
}
-
-OUString firebird::escapeWith( const OUString& sText, const char aKey, const char aEscapeChar)
-{
- OUString sRet(sText);
- sal_Int32 aIndex = 0;
- for (;;)
- {
- aIndex = sRet.indexOf(aKey, aIndex);
- if ( aIndex <= 0 || aIndex >= sRet.getLength())
- break;
- sRet = sRet.replaceAt(aIndex, 1, OUStringChar(aEscapeChar) + OUStringChar(aKey) );
- aIndex += 2;
- }
-
- return sRet;
-}
-
-sal_Int64 firebird::pow10Integer(int nDecimalCount)
-{
- sal_Int64 nRet = 1;
- for(int i=0; i< nDecimalCount; i++)
- {
- nRet *= 10;
- }
- return nRet;
-}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx
index efb222f3ff22..b41afc07dbb9 100644
--- a/connectivity/source/drivers/firebird/Util.hxx
+++ b/connectivity/source/drivers/firebird/Util.hxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -7,122 +7,117 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
+#pragma once
#include <ibase.h>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/XInterface.hpp>
+#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, const OUString& sCharset = OUString() )
- : m_aType(aType)
- , m_aSubType(aSubType)
- , m_nScale(nScale)
- , m_sCharsetName(sCharset) {}
- explicit ColumnTypeInfo( short aType, const OUString& sCharset )
- : m_aType(aType)
- , m_aSubType(0)
- , m_nScale(0)
- , m_sCharsetName(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(const OUString& rIdentifier);
-
- inline bool IndicatesError(const ISC_STATUS_ARRAY& rStatusVector)
- {
- return rStatusVector[0]==1 && rStatusVector[1]; // indicates error;
- }
-
- OUString StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector,
- const OUString& 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,
- const OUString& 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);
-
- OUString escapeWith( const OUString& sText, const char aKey, const char aEscapeChar);
- sal_Int64 pow10Integer( int nDecimalCount );
+ 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);
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/View.cxx b/connectivity/source/drivers/firebird/View.cxx
new file mode 100644
index 000000000000..6dcbf6bce2b2
--- /dev/null
+++ b/connectivity/source/drivers/firebird/View.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#include "View.hxx"
+
+#include <propertyids.hxx>
+
+#include <com/sun/star/sdbc/XRow.hpp>
+
+namespace connectivity::firebird
+{
+View::View(const css::uno::Reference<css::sdbc::XConnection>& _rxConnection, bool _bCaseSensitive,
+ const OUString& _rSchemaName, const OUString& _rName)
+ : View_Base(_bCaseSensitive, _rName, _rxConnection->getMetaData(), OUString(), _rSchemaName,
+ OUString())
+ , m_xConnection(_rxConnection)
+{
+}
+
+View::~View() {}
+
+void SAL_CALL View::acquire() noexcept { View_Base::acquire(); };
+void SAL_CALL View::release() noexcept { View_Base::release(); };
+css::uno::Any SAL_CALL View::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = View_Base::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = View_IBASE::queryInterface(_rType);
+ return aReturn;
+}
+
+css::uno::Sequence<css::uno::Type> SAL_CALL View::getTypes()
+{
+ return ::comphelper::concatSequences(View_Base::getTypes(), View_IBASE::getTypes());
+}
+
+css::uno::Sequence<sal_Int8> SAL_CALL View::getImplementationId()
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+void SAL_CALL View::alterCommand(const OUString& _rNewCommand)
+{
+ OUString aCommand = "ALTER VIEW \"" + m_Name + "\" AS " + _rNewCommand;
+ m_xMetaData->getConnection()->createStatement()->execute(aCommand);
+}
+
+void SAL_CALL View::getFastPropertyValue(css::uno::Any& _rValue, sal_Int32 _nHandle) const
+{
+ if (_nHandle == PROPERTY_ID_COMMAND)
+ {
+ // retrieve the very current command, don't rely on the base classes cached value
+ // (which we initialized empty, anyway)
+ _rValue <<= impl_getCommand();
+ return;
+ }
+
+ View_Base::getFastPropertyValue(_rValue, _nHandle);
+}
+
+OUString View::impl_getCommand() const
+{
+ OUString aCommand("SELECT RDB$VIEW_SOURCE FROM RDB$RELATIONS WHERE RDB$RELATION_NAME = '"
+ + m_Name + "'");
+ css::uno::Reference<css::sdbc::XStatement> statement = m_xConnection->createStatement();
+ css::uno::Reference<css::sdbc::XResultSet> xResult = statement->executeQuery(aCommand);
+
+ css::uno::Reference<css::sdbc::XRow> xRow(xResult, css::uno::UNO_QUERY_THROW);
+ if (!xResult->next())
+ {
+ // hmm. There is no view the name as we know it. Can only mean some other instance
+ // dropped this view meanwhile...
+ std::abort();
+ }
+
+ return xRow->getString(1);
+}
+
+} // namespace connectivity::firebird
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/View.hxx b/connectivity/source/drivers/firebird/View.hxx
new file mode 100644
index 000000000000..2b300a8d06d9
--- /dev/null
+++ b/connectivity/source/drivers/firebird/View.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <connectivity/sdbcx/VView.hxx>
+
+#include <com/sun/star/sdbcx/XAlterView.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity::firebird
+{
+typedef ::connectivity::sdbcx::OView View_Base;
+typedef ::cppu::ImplHelper1<css::sdbcx::XAlterView> View_IBASE;
+
+class View : public View_Base, public View_IBASE
+{
+public:
+ View(const css::uno::Reference<css::sdbc::XConnection>& _rxConnection, bool _bCaseSensitive,
+ const OUString& _rSchemaName, const OUString& _rName);
+
+ // UNO
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& aType) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+ // XAlterView
+ virtual void SAL_CALL alterCommand(const OUString& NewCommand) override;
+
+protected:
+ virtual ~View() override;
+
+protected:
+ // OPropertyContainer
+ virtual void SAL_CALL getFastPropertyValue(css::uno::Any& _rValue,
+ sal_Int32 _nHandle) const override;
+
+private:
+ /** retrieves the current command of the View */
+ OUString impl_getCommand() const;
+
+private:
+ css::uno::Reference<css::sdbc::XConnection> m_xConnection;
+
+ using View_Base::getFastPropertyValue;
+};
+
+} // namespace connectivity::firebird
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Views.cxx b/connectivity/source/drivers/firebird/Views.cxx
new file mode 100644
index 000000000000..606ac9ae7e64
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Views.cxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#include "Tables.hxx"
+#include "Views.hxx"
+#include "View.hxx"
+#include "Catalog.hxx"
+#include <connectivity/dbtools.hxx>
+#include <comphelper/types.hxx>
+#include <TConnection.hxx>
+
+connectivity::firebird::Views::Views(
+ const css::uno::Reference<css::sdbc::XConnection>& _rxConnection, ::cppu::OWeakObject& _rParent,
+ ::osl::Mutex& _rMutex, const ::std::vector<OUString>& _rVector)
+ : sdbcx::OCollection(_rParent, true, _rMutex, _rVector)
+ , m_xConnection(_rxConnection)
+ , m_xMetaData(_rxConnection->getMetaData())
+ , m_bInDrop(false)
+{
+}
+
+css::uno::Reference<css::beans::XPropertySet>
+connectivity::firebird::Views::createObject(const OUString& _rName)
+{
+ OUString sCatalog, sSchema, sTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable,
+ ::dbtools::EComposeRule::InDataManipulation);
+ return new View(m_xConnection, isCaseSensitive(), sSchema, sTable);
+}
+
+void connectivity::firebird::Views::impl_refresh()
+{
+ static_cast<Catalog&>(m_rParent).refreshViews();
+}
+
+css::uno::Reference<css::beans::XPropertySet> connectivity::firebird::Views::createDescriptor()
+{
+ return new connectivity::sdbcx::OView(true, m_xMetaData);
+}
+
+// XAppend
+css::uno::Reference<css::beans::XPropertySet> connectivity::firebird::Views::appendObject(
+ const OUString& _rForName, const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ createView(descriptor);
+ return createObject(_rForName);
+}
+
+// XDrop
+void connectivity::firebird::Views::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
+{
+ if (m_bInDrop)
+ return;
+
+ css::uno::Reference<XInterface> xObject(getObject(_nPos));
+ bool bIsNew = connectivity::sdbcx::ODescriptor::isNew(xObject);
+ if (!bIsNew)
+ {
+ OUString aSql(u"DROP VIEW"_ustr);
+
+ css::uno::Reference<css::beans::XPropertySet> xProp(xObject, css::uno::UNO_QUERY);
+ aSql += ::dbtools::composeTableName(m_xMetaData, xProp,
+ ::dbtools::EComposeRule::InTableDefinitions, true);
+
+ css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
+ css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+}
+
+void connectivity::firebird::Views::dropByNameImpl(const OUString& elementName)
+{
+ m_bInDrop = true;
+ connectivity::sdbcx::OCollection::dropByName(elementName);
+ m_bInDrop = false;
+}
+
+void connectivity::firebird::Views::createView(
+ const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
+
+ OUString sCommand;
+ descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))
+ >>= sCommand;
+
+ OUString aSql = "CREATE VIEW "
+ + ::dbtools::composeTableName(m_xMetaData, descriptor,
+ ::dbtools::EComposeRule::InTableDefinitions, true)
+ + " AS " + sCommand;
+
+ css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
+ if (xStmt.is())
+ {
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+ connectivity::firebird::Tables* pTables = static_cast<connectivity::firebird::Tables*>(
+ static_cast<connectivity::firebird::Catalog&>(m_rParent).getPrivateTables());
+ if (pTables)
+ {
+ OUString sName = ::dbtools::composeTableName(
+ m_xMetaData, descriptor, ::dbtools::EComposeRule::InDataManipulation, false);
+ pTables->appendNew(sName);
+ }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Views.hxx b/connectivity/source/drivers/firebird/Views.hxx
new file mode 100644
index 000000000000..d1308d385494
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Views.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+namespace connectivity::firebird
+{
+class Views final : public connectivity::sdbcx::OCollection
+{
+ css::uno::Reference<css::sdbc::XConnection> m_xConnection;
+ css::uno::Reference<css::sdbc::XDatabaseMetaData> m_xMetaData;
+ bool m_bInDrop;
+
+ // OCollection
+ 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;
+
+ void createView(const css::uno::Reference<css::beans::XPropertySet>& descriptor);
+
+public:
+ Views(const css::uno::Reference<css::sdbc::XConnection>& _rxConnection,
+ ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const ::std::vector<OUString>& _rVector);
+
+ // XDrop
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
+
+ void dropByNameImpl(const OUString& elementName);
+};
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/flat/ECatalog.cxx b/connectivity/source/drivers/flat/ECatalog.cxx
index aed042fdd578..a7e806b58e9c 100644
--- a/connectivity/source/drivers/flat/ECatalog.cxx
+++ b/connectivity/source/drivers/flat/ECatalog.cxx
@@ -25,7 +25,6 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
@@ -41,7 +40,7 @@ void OFlatCatalog::refreshTables()
{
::std::vector<OUString> aVector;
Sequence<OUString> aTypes;
- Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), "%", "%", aTypes);
+ Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), u"%"_ustr, u"%"_ustr, aTypes);
if (xResult.is())
{
diff --git a/connectivity/source/drivers/flat/EColumns.cxx b/connectivity/source/drivers/flat/EColumns.cxx
index a9e210321ba6..f2d5c5f69461 100644
--- a/connectivity/source/drivers/flat/EColumns.cxx
+++ b/connectivity/source/drivers/flat/EColumns.cxx
@@ -23,20 +23,16 @@
using namespace connectivity::flat;
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-sdbcx::ObjectType OFlatColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OFlatColumns::createObject(const OUString& _rName)
{
OFlatTable* pTable = static_cast<OFlatTable*>(m_pTable);
const ::rtl::Reference<OSQLColumns>& aCols = pTable->getTableColumns();
OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
- sdbcx::ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
if(aIter != aCols->end())
- xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
+ xRet = *aIter;
return xRet;
}
diff --git a/connectivity/source/drivers/flat/EConnection.cxx b/connectivity/source/drivers/flat/EConnection.cxx
index 5127d903cc6d..3f199cdfc4f0 100644
--- a/connectivity/source/drivers/flat/EConnection.cxx
+++ b/connectivity/source/drivers/flat/EConnection.cxx
@@ -36,7 +36,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
OFlatConnection::OFlatConnection(ODriver* _pDriver) : OConnection(_pDriver)
@@ -55,7 +54,7 @@ OFlatConnection::~OFlatConnection()
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(OFlatConnection, "com.sun.star.sdbc.drivers.flat.Connection", "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(OFlatConnection, u"com.sun.star.sdbc.drivers.flat.Connection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
void OFlatConnection::construct(const OUString& url,const Sequence< PropertyValue >& info)
@@ -133,12 +132,11 @@ Reference< XDatabaseMetaData > SAL_CALL OFlatConnection::getMetaData( )
css::uno::Reference< XTablesSupplier > OFlatConnection::createCatalog()
{
::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
+ rtl::Reference< connectivity::sdbcx::OCatalog > xTab = m_xCatalog;
if(!xTab.is())
{
- OFlatCatalog *pCat = new OFlatCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
+ xTab = new OFlatCatalog(this);
+ m_xCatalog = xTab.get();
}
return xTab;
}
@@ -148,11 +146,9 @@ Reference< XStatement > SAL_CALL OFlatConnection::createStatement( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_B::rBHelper.bDisposed);
- OFlatStatement* pStmt = new OFlatStatement(this);
-
- Reference< XStatement > xStmt = pStmt;
+ rtl::Reference<OFlatStatement> pStmt = new OFlatStatement(this);
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xStmt;
+ return pStmt;
}
Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareStatement( const OUString& sql )
@@ -160,13 +156,10 @@ Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareStatement( cons
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_B::rBHelper.bDisposed);
-
- OFlatPreparedStatement* pStmt = new OFlatPreparedStatement(this);
- Reference< XPreparedStatement > xStmt = pStmt;
+ rtl::Reference<OFlatPreparedStatement> pStmt = new OFlatPreparedStatement(this);
pStmt->construct(sql);
-
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xStmt;
+ return pStmt;
}
Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareCall( const OUString& /*sql*/ )
@@ -174,8 +167,7 @@ Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareCall( const OUS
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_B::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::prepareCall"_ustr, *this );
}
diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
index b69b34e363c3..b76e88c9359e 100644
--- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
@@ -47,92 +47,90 @@ OFlatDatabaseMetaData::~OFlatDatabaseMetaData()
Reference< XResultSet > OFlatDatabaseMetaData::impl_getTypeInfo_throw( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- static ODatabaseMetaDataResultSet::ORows aRows = [&]()
+ static ODatabaseMetaDataResultSet::ORows aRows = []()
{
ODatabaseMetaDataResultSet::ORows tmp;
- ODatabaseMetaDataResultSet::ORow aRow;
-
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(OUString("CHAR")));
- aRow.push_back(new ORowSetValueDecorator(DataType::CHAR));
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(254)));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(ColumnSearch::CHAR)));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sal_Int32(10)));
+ ODatabaseMetaDataResultSet::ORow aRow
+ {
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ new ORowSetValueDecorator(u"CHAR"_ustr) ,
+ new ORowSetValueDecorator(DataType::CHAR) ,
+ new ORowSetValueDecorator(sal_Int32(254)) ,
+ ODatabaseMetaDataResultSet::getQuoteValue() ,
+ ODatabaseMetaDataResultSet::getQuoteValue() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)) ,
+ ODatabaseMetaDataResultSet::get1Value() ,
+ new ORowSetValueDecorator(sal_Int32(ColumnSearch::CHAR)) ,
+ ODatabaseMetaDataResultSet::get1Value() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::get0Value() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ ODatabaseMetaDataResultSet::getEmptyValue() ,
+ new ORowSetValueDecorator(sal_Int32(10))
+ };
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR"));
+ aRow[1] = new ORowSetValueDecorator(u"VARCHAR"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("LONGVARCHAR"));
+ aRow[1] = new ORowSetValueDecorator(u"LONGVARCHAR"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
aRow[3] = new ORowSetValueDecorator(sal_Int32(65535));
aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
+ aRow[1] = new ORowSetValueDecorator(u"DATE"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::DATE);
aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
+ aRow[1] = new ORowSetValueDecorator(u"TIME"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::TIME);
aRow[3] = new ORowSetValueDecorator(sal_Int32(8));
aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
+ aRow[1] = new ORowSetValueDecorator(u"TIMESTAMP"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
aRow[3] = new ORowSetValueDecorator(sal_Int32(19));
aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("BOOL"));
+ aRow[1] = new ORowSetValueDecorator(u"BOOL"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::BIT);
aRow[3] = ODatabaseMetaDataResultSet::get1Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
+ aRow[1] = new ORowSetValueDecorator(u"DECIMAL"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
aRow[15] = new ORowSetValueDecorator(sal_Int32(15));
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("DOUBLE"));
+ aRow[1] = new ORowSetValueDecorator(u"DOUBLE"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
tmp.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(OUString("NUMERIC"));
+ aRow[1] = new ORowSetValueDecorator(u"NUMERIC"_ustr);
aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC);
aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
aRow[15] = new ORowSetValueDecorator(sal_Int32(20));
@@ -141,8 +139,8 @@ Reference< XResultSet > OFlatDatabaseMetaData::impl_getTypeInfo_throw( )
return tmp;
}();
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns(
@@ -198,7 +196,7 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns(
aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
- switch(static_cast<sal_Int32>(aRow[5]->getValue()))
+ switch(aRow[5]->getValue().getInt32())
{
case DataType::CHAR:
case DataType::VARCHAR:
@@ -211,13 +209,13 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns(
aRow[16] = new ORowSetValueDecorator(sal_Int32(0));
}
aRow[17] = new ORowSetValueDecorator(i);
- switch(sal_Int32(aRow[11]->getValue()))
+ switch(aRow[11]->getValue().getInt32())
{
case ColumnValue::NO_NULLS:
- aRow[18] = new ORowSetValueDecorator(OUString("NO"));
+ aRow[18] = new ORowSetValueDecorator(u"NO"_ustr);
break;
case ColumnValue::NULLABLE:
- aRow[18] = new ORowSetValueDecorator(OUString("YES"));
+ aRow[18] = new ORowSetValueDecorator(u"YES"_ustr);
break;
default:
aRow[18] = new ORowSetValueDecorator(OUString());
@@ -228,11 +226,10 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns(
}
}
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
+ pResult->setRows(std::move(aRows));
- return xRef;
+ return pResult;
}
OUString SAL_CALL OFlatDatabaseMetaData::getURL( )
diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx
index bdd8bfa202a9..e9cb465d327f 100644
--- a/connectivity/source/drivers/flat/EDriver.cxx
+++ b/connectivity/source/drivers/flat/EDriver.cxx
@@ -39,7 +39,7 @@ using namespace css::lang;
OUString SAL_CALL ODriver::getImplementationName( )
{
- return "com.sun.star.comp.sdbc.flat.ODriver";
+ return u"com.sun.star.comp.sdbc.flat.ODriver"_ustr;
}
@@ -54,7 +54,7 @@ connectivity_flat_ODriver(
}
if (ret)
ret->acquire();
- return static_cast<cppu::OWeakObject*>(ret.get());
+ return getXWeak(ret.get());
}
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info )
@@ -66,12 +66,11 @@ Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const S
if ( ! acceptsURL(url) )
return nullptr;
- OFlatConnection* pCon = new OFlatConnection(this);
+ rtl::Reference<OFlatConnection> pCon = new OFlatConnection(this);
pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon.get());
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
@@ -83,54 +82,52 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
{
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
+ Sequence< OUString > aBoolean { u"0"_ustr, u"1"_ustr };
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
-
- aDriverInfo.push_back(DriverPropertyInfo(
- "FieldDelimiter"
- ,"Field separator."
+ std::vector< DriverPropertyInfo > aDriverInfo
+ {
+ {
+ u"FieldDelimiter"_ustr
+ ,u"Field separator."_ustr
,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "HeaderLine"
- ,"Text contains headers."
+ ,{}
+ ,{}
+ },
+ {
+ u"HeaderLine"_ustr
+ ,u"Text contains headers."_ustr
,false
- ,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "StringDelimiter"
- ,"Text separator."
+ ,u"0"_ustr
+ ,aBoolean
+ },
+ {
+ u"StringDelimiter"_ustr
+ ,u"Text separator."_ustr
,false
- ,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "DecimalDelimiter"
- ,"Decimal separator."
+ ,u"0"_ustr
+ ,aBoolean
+ },
+ {
+ u"DecimalDelimiter"_ustr
+ ,u"Decimal separator."_ustr
,false
- ,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "ThousandDelimiter"
- ,"Thousands separator."
+ ,u"0"_ustr
+ ,aBoolean
+ },
+ {
+ u"ThousandDelimiter"_ustr
+ ,u"Thousands separator."_ustr
,false
- ,"0"
- ,aBoolean)
- );
+ ,u"0"_ustr
+ ,aBoolean
+ }
+ };
return ::comphelper::concatSequences(OFileDriver::getPropertyInfo(url,info ),
Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size()));
}
::connectivity::SharedResources aResources;
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
}
diff --git a/connectivity/source/drivers/flat/EPreparedStatement.cxx b/connectivity/source/drivers/flat/EPreparedStatement.cxx
index bcd6bc6ecc11..90a8cb7d0127 100644
--- a/connectivity/source/drivers/flat/EPreparedStatement.cxx
+++ b/connectivity/source/drivers/flat/EPreparedStatement.cxx
@@ -22,14 +22,14 @@
using namespace connectivity::flat;
using namespace connectivity::file;
-using namespace ::com::sun::star::uno;
-OResultSet* OFlatPreparedStatement::createResultSet()
+rtl::Reference<OResultSet> OFlatPreparedStatement::createResultSet()
{
return new OFlatResultSet(this, m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OFlatPreparedStatement, "com.sun.star.sdbc.driver.flat.PreparedStatement",
- "com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(OFlatPreparedStatement,
+ u"com.sun.star.sdbc.driver.flat.PreparedStatement"_ustr,
+ u"com.sun.star.sdbc.PreparedStatement"_ustr);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx
index aca803041827..57fd3ea1f324 100644
--- a/connectivity/source/drivers/flat/EResultSet.cxx
+++ b/connectivity/source/drivers/flat/EResultSet.cxx
@@ -46,12 +46,12 @@ OFlatResultSet::OFlatResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTr
OUString SAL_CALL OFlatResultSet::getImplementationName( )
{
- return "com.sun.star.sdbcx.flat.ResultSet";
+ return u"com.sun.star.sdbcx.flat.ResultSet"_ustr;
}
Sequence< OUString > SAL_CALL OFlatResultSet::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
+ return { u"com.sun.star.sdbc.ResultSet"_ustr, u"com.sun.star.sdbcx.ResultSet"_ustr };
}
sal_Bool SAL_CALL OFlatResultSet::supportsService( const OUString& _rServiceName )
@@ -96,7 +96,7 @@ Any SAL_CALL OFlatResultSet::getBookmark( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return makeAny(static_cast<sal_Int32>((*m_aRow)[0]->getValue()));
+ return Any((*m_aRow)[0]->getValue().getInt32());
}
sal_Bool SAL_CALL OFlatResultSet::moveToBookmark( const Any& bookmark )
@@ -150,12 +150,12 @@ IPropertyArrayHelper & OFlatResultSet::getInfoHelper()
return *OFlatResultSet_BASE3::getArrayHelper();
}
-void SAL_CALL OFlatResultSet::acquire() throw()
+void SAL_CALL OFlatResultSet::acquire() noexcept
{
OFlatResultSet_BASE2::acquire();
}
-void SAL_CALL OFlatResultSet::release() throw()
+void SAL_CALL OFlatResultSet::release() noexcept
{
OFlatResultSet_BASE2::release();
}
diff --git a/connectivity/source/drivers/flat/EStatement.cxx b/connectivity/source/drivers/flat/EStatement.cxx
index 7774639052b3..795011ac61b1 100644
--- a/connectivity/source/drivers/flat/EStatement.cxx
+++ b/connectivity/source/drivers/flat/EStatement.cxx
@@ -22,13 +22,12 @@
using namespace connectivity::flat;
using namespace connectivity::file;
-using namespace css::uno;
-OResultSet* OFlatStatement::createResultSet()
+rtl::Reference<OResultSet> OFlatStatement::createResultSet()
{
return new OFlatResultSet(this,m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OFlatStatement,"com.sun.star.sdbc.driver.flat.Statement","com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(OFlatStatement,u"com.sun.star.sdbc.driver.flat.Statement"_ustr,u"com.sun.star.sdbc.Statement"_ustr);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 0dceba05b641..cbf2f1805be5 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -27,10 +27,8 @@
#include <o3tl/safeint.hxx>
#include <rtl/math.hxx>
#include <sal/log.hxx>
-#include <tools/solar.h>
#include <tools/urlobj.hxx>
#include <cppuhelper/queryinterface.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <comphelper/numbers.hxx>
#include <comphelper/servicehelper.hxx>
#include <com/sun/star/util/NumberFormat.hpp>
@@ -65,6 +63,8 @@ void OFlatTable::fillColumns(const css::lang::Locale& _aLocale)
{
m_bNeedToReadLine = true; // we overwrite m_aCurrentLine, seek the stream, ...
m_pFileStream->Seek(0);
+ // tdf#123055 - start to read unicode text in order to avoid the BOM
+ m_pFileStream->StartReadingUnicodeText(RTL_TEXTENCODING_DONTKNOW);
m_aCurrentLine = QuotedTokenizedString();
bool bRead = true;
@@ -72,7 +72,8 @@ void OFlatTable::fillColumns(const css::lang::Locale& _aLocale)
const bool bHasHeaderLine = pConnection->isHeaderLine();
QuotedTokenizedString aHeaderLine;
- TRowPositionInFile rowPos(0, 0);
+ const sal_Int32 nPos = static_cast<sal_Int32>(m_pFileStream->Tell());
+ TRowPositionInFile rowPos(nPos, nPos);
sal_Int32 rowNum(0);
if ( bHasHeaderLine )
{
@@ -176,7 +177,7 @@ void OFlatTable::fillColumns(const css::lang::Locale& _aLocale)
aFind = connectivity::find(m_aColumns->begin(),m_aColumns->end(),aAlias,aCase);
}
- sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeNames[i],OUString(),OUString(),
+ rtl::Reference<sdbcx::OColumn> pColumn = new sdbcx::OColumn(aAlias,aTypeNames[i],OUString(),OUString(),
ColumnValue::NULLABLE,
m_aPrecisions[i],
m_aScales[i],
@@ -186,8 +187,7 @@ void OFlatTable::fillColumns(const css::lang::Locale& _aLocale)
false,
bCase,
m_CatalogName, getSchema(), getName());
- Reference< XPropertySet> xCol = pColumn;
- m_aColumns->push_back(xCol);
+ m_aColumns->push_back(pColumn);
}
m_pFileStream->Seek(m_aRowPosToFilePos[0].second);
@@ -200,7 +200,7 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirs
if ( io_nType != DataType::VARCHAR )
{
bool bNumeric = io_nType == DataType::SQLNULL || io_nType == DataType::DOUBLE || io_nType == DataType::DECIMAL || io_nType == DataType::INTEGER;
- sal_uLong nIndex = 0;
+ sal_Int32 nIndex = 0;
if ( bNumeric )
{
@@ -229,7 +229,6 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirs
}
else
{
- bNumeric = true;
sal_Int32 nDot = 0;
sal_Int32 nDecimalDelCount = 0;
sal_Int32 nSpaceCount = 0;
@@ -265,8 +264,8 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirs
if (bNumeric && cThousandDelimiter)
{
// Is the delimiter correct?
- const OUString aValue = aField2.getToken(0,cDecimalDelimiter);
- for( sal_Int32 j = aValue.getLength() - 4; j >= 0; j -= 4)
+ const std::u16string_view aValue = o3tl::getToken(aField2, 0, cDecimalDelimiter);
+ for( sal_Int32 j = static_cast<sal_Int32>(aValue.size()) - 4; j >= 0; j -= 4)
{
const sal_Unicode c = aValue[j];
// just digits, decimal- and thousands-delimiter?
@@ -415,7 +414,7 @@ void OFlatTable::construct()
m_xNumberFormatter.set( NumberFormatter::create( m_pConnection->getDriver()->getComponentContext()), UNO_QUERY_THROW);
m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier);
Reference<XPropertySet> xProp = xSupplier->getNumberFormatSettings();
- xProp->getPropertyValue("NullDate") >>= m_aNullDate;
+ xProp->getPropertyValue(u"NullDate"_ustr) >>= m_aNullDate;
INetURLObject aURL;
aURL.SetURL(getEntry());
@@ -471,7 +470,7 @@ OUString OFlatTable::getEntry() const
if ( m_pConnection->matchesExtension( sExt ) )
{
if ( !sExt.isEmpty() )
- sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength()+1, OUString());
+ sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength()+1, u"");
if ( sName == m_Name )
{
Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );
@@ -502,7 +501,7 @@ void OFlatTable::refreshColumns()
if(m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = new OFlatColumns(this,m_aMutex,aVector);
+ m_xColumns.reset(new OFlatColumns(this,m_aMutex,aVector));
}
@@ -545,26 +544,10 @@ Any SAL_CALL OFlatTable::queryInterface( const Type & rType )
return Any();
Any aRet = OTable_TYPEDEF::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< css::lang::XUnoTunnel*> (this));
+ return aRet;
}
-Sequence< sal_Int8 > OFlatTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return (isUnoTunnelId<OFlatTable>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : OFlatTable_BASE::getSomething(rId);
-}
-
bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool bRetrieveData)
{
*(*_rRow)[0] = m_nFilePos;
@@ -676,7 +659,7 @@ bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
// #99178# OJ
if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType )
- *(*_rRow)[i] = OUString(OUString::number(nVal));
+ *(*_rRow)[i] = OUString::number(nVal);
else
*(*_rRow)[i] = nVal;
} break;
@@ -784,7 +767,6 @@ bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 n
}
// m_nMaxRowCount can still be zero, but now it means there a genuinely zero rows in the table
return seekRow(IResultSetHelper::ABSOLUTE1, m_nMaxRowCount, nCurPos);
- break;
case IResultSetHelper::RELATIVE1:
{
const sal_Int32 nNewRowPos = m_nRowPos + nOffset;
@@ -873,7 +855,7 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos
{
if (pStartPos)
*pStartPos = static_cast<sal_Int32>(m_pFileStream->Tell());
- m_pFileStream->ReadByteStringLine(m_aCurrentLine, nEncoding);
+ m_pFileStream->ReadByteStringLine(m_aCurrentLine, nEncoding, 262144);
if (m_pFileStream->eof())
return false;
diff --git a/connectivity/source/drivers/flat/ETables.cxx b/connectivity/source/drivers/flat/ETables.cxx
index 81f366a9e7d0..b1a0859a7acb 100644
--- a/connectivity/source/drivers/flat/ETables.cxx
+++ b/connectivity/source/drivers/flat/ETables.cxx
@@ -22,23 +22,15 @@
#include <file/FCatalog.hxx>
using namespace connectivity;
-using namespace ::comphelper;
using namespace connectivity::flat;
using namespace connectivity::file;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-sdbcx::ObjectType OFlatTables::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OFlatTables::createObject(const OUString& _rName)
{
- OFlatTable* pRet = new OFlatTable(this, static_cast<OFlatConnection*>(static_cast<OFileCatalog&>(m_rParent).getConnection()),
- _rName,"TABLE");
- sdbcx::ObjectType xRet = pRet;
+ rtl::Reference<OFlatTable> pRet = new OFlatTable(this, static_cast<OFlatConnection*>(static_cast<OFileCatalog&>(m_rParent).getConnection()),
+ _rName,u"TABLE"_ustr);
pRet->construct();
- return xRet;
+ return pRet;
}
diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx
index 029e60f9450a..d905e67399f0 100644
--- a/connectivity/source/drivers/hsqldb/HCatalog.cxx
+++ b/connectivity/source/drivers/hsqldb/HCatalog.cxx
@@ -30,11 +30,8 @@
using namespace connectivity;
using namespace connectivity::hsqldb;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OHCatalog::OHCatalog(const Reference< XConnection >& _xConnection) : sdbcx::OCatalog(_xConnection)
,m_xConnection(_xConnection)
@@ -44,8 +41,8 @@ OHCatalog::OHCatalog(const Reference< XConnection >& _xConnection) : sdbcx::OCat
void OHCatalog::refreshObjects(const Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames)
{
Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- "%",
- "%",
+ u"%"_ustr,
+ u"%"_ustr,
_sKindOfObject);
fillNames(xResult,_rNames);
}
@@ -54,9 +51,7 @@ void OHCatalog::refreshTables()
{
::std::vector< OUString> aVector;
- Sequence< OUString > sTableTypes(2);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
+ Sequence< OUString > sTableTypes {u"VIEW"_ustr, u"TABLE"_ustr};
refreshObjects(sTableTypes,aVector);
@@ -68,7 +63,7 @@ void OHCatalog::refreshTables()
void OHCatalog::refreshViews()
{
- Sequence< OUString > aTypes { "VIEW" };
+ Sequence< OUString > aTypes { u"VIEW"_ustr };
bool bSupportsViews = false;
try
@@ -105,7 +100,7 @@ void OHCatalog::refreshUsers()
{
::std::vector< OUString> aVector;
Reference< XStatement > xStmt = m_xConnection->createStatement( );
- Reference< XResultSet > xResult = xStmt->executeQuery("select User from hsqldb.user group by User");
+ Reference< XResultSet > xResult = xStmt->executeQuery(u"select User from hsqldb.user group by User"_ustr);
if ( xResult.is() )
{
Reference< XRow > xRow(xResult,UNO_QUERY);
diff --git a/connectivity/source/drivers/hsqldb/HColumns.cxx b/connectivity/source/drivers/hsqldb/HColumns.cxx
index 3f03c3616bc1..6906bde4435a 100644
--- a/connectivity/source/drivers/hsqldb/HColumns.cxx
+++ b/connectivity/source/drivers/hsqldb/HColumns.cxx
@@ -27,10 +27,6 @@ using namespace connectivity::sdbcx;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OHSQLColumns::OHSQLColumns( ::cppu::OWeakObject& _rParent
,::osl::Mutex& _rMutex
@@ -69,7 +65,7 @@ void OHSQLColumn::construct()
Sequence< OUString > SAL_CALL OHSQLColumn::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbcx.Column" };
+ return { u"com.sun.star.sdbcx.Column"_ustr };
}
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
index c3ff0169cea7..032d02d90e8a 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -32,10 +32,11 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
+#include <comphelper/propertyvalue.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <resource/sharedresources.hxx>
#include <strings.hrc>
@@ -75,19 +76,17 @@ namespace connectivity::hsqldb
{
m_aFlushListeners.disposeAndClear( EventObject( *this ) );
OHsqlConnection_BASE::disposing();
- OConnectionWrapper::disposing();
}
OHsqlConnection::OHsqlConnection( const Reference< XDriver >& _rxDriver,
const Reference< XConnection >& _xConnection ,const Reference< XComponentContext >& _rxContext )
- :OHsqlConnection_BASE( m_aMutex )
- ,m_aFlushListeners( m_aMutex )
+ :m_aFlushListeners( m_aMutex )
,m_xDriver( _rxDriver )
,m_xContext( _rxContext )
,m_bIni(true)
,m_bReadOnly(false)
{
- setDelegation(_xConnection,_rxContext,m_refCount);
+ setDelegation(_xConnection, _rxContext);
}
OHsqlConnection::~OHsqlConnection()
@@ -99,9 +98,7 @@ namespace connectivity::hsqldb
}
}
- IMPLEMENT_FORWARD_XINTERFACE2(OHsqlConnection,OHsqlConnection_BASE,OConnectionWrapper)
- IMPLEMENT_SERVICE_INFO(OHsqlConnection, "com.sun.star.sdbc.drivers.hsqldb.OHsqlConnection", "com.sun.star.sdbc.Connection")
- IMPLEMENT_FORWARD_XTYPEPROVIDER2(OHsqlConnection,OHsqlConnection_BASE,OConnectionWrapper)
+ IMPLEMENT_SERVICE_INFO(OHsqlConnection, u"com.sun.star.sdbc.drivers.hsqldb.OHsqlConnection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
::osl::Mutex& OHsqlConnection::getMutex() const
@@ -143,7 +140,7 @@ namespace connectivity::hsqldb
if ( !m_bReadOnly )
{
Reference< XStatement > xStmt( m_xConnection->createStatement(), css::uno::UNO_SET_THROW );
- xStmt->execute( "CHECKPOINT DEFRAG" );
+ xStmt->execute( u"CHECKPOINT DEFRAG"_ustr );
}
}
catch(const Exception& )
@@ -280,8 +277,7 @@ namespace connectivity::hsqldb
::dbtools::qualifiedNameComponents( xMetaData, _rTableName, sCatalog, sSchema, sName, ::dbtools::EComposeRule::Complete );
// get the table information
- OUStringBuffer sSQL;
- sSQL.append( "SELECT HSQLDB_TYPE FROM INFORMATION_SCHEMA.SYSTEM_TABLES" );
+ OUStringBuffer sSQL( "SELECT HSQLDB_TYPE FROM INFORMATION_SCHEMA.SYSTEM_TABLES" );
HTools::appendTableFilterCrit( sSQL, sCatalog, sSchema, sName, true );
sSQL.append( " AND TABLE_TYPE = 'TABLE'" );
@@ -315,13 +311,10 @@ namespace connectivity::hsqldb
xProvider.set( GraphicProvider::create(m_xContext) );
// ask the provider to obtain a graphic
- Sequence< PropertyValue > aMediaProperties( 1 );
- aMediaProperties[0].Name = "URL";
- aMediaProperties[0].Value <<= OUString(
- // load the graphic from the global graphic repository
- "private:graphicrepository/"
- // the relative path within the images.zip
- LINKED_TEXT_TABLE_IMAGE_RESOURCE);
+ Sequence< PropertyValue > aMediaProperties{ comphelper::makePropertyValue(
+ u"URL"_ustr, u"private:graphicrepository/"
+ // the relative path within the images.zip
+ LINKED_TEXT_TABLE_IMAGE_RESOURCE ""_ustr) };
xGraphic = xProvider->queryGraphic( aMediaProperties );
OSL_ENSURE( xGraphic.is(), "OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a graphic object!" );
}
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 6ff0f539407b..f43584d1f169 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -50,7 +50,9 @@
#include <strings.hrc>
#include <resource/sharedresources.hxx>
#include <i18nlangtag/languagetag.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/string_view.hxx>
+#include <vcl/svapp.hxx>
#include <memory>
@@ -68,9 +70,8 @@ namespace connectivity
using namespace css::embed;
using namespace css::io;
using namespace css::util;
- using namespace css::reflection;
- constexpr OUStringLiteral IMPL_NAME = u"com.sun.star.sdbcx.comp.hsqldb.Driver";
+ constexpr OUString IMPL_NAME = u"com.sun.star.sdbcx.comp.hsqldb.Driver"_ustr;
@@ -102,7 +103,7 @@ namespace connectivity
{
for (const auto& rConnection : m_aConnections)
{
- Reference<XInterface > xTemp = rConnection.first.get();
+ Reference<XConnection> xTemp(rConnection.xOrigConn);
::comphelper::disposeComponent(xTemp);
}
}
@@ -111,7 +112,6 @@ namespace connectivity
// not interested in
}
m_aConnections.clear();
- TWeakPairVector().swap(m_aConnections);
cppu::WeakComponentImplHelperBase::disposing();
}
@@ -121,7 +121,7 @@ namespace connectivity
if ( !m_xDriver.is() )
{
Reference<XDriverManager2> xDriverAccess = DriverManager::create( m_xContext );
- m_xDriver = xDriverAccess->getDriverByURL("jdbc:hsqldb:db");
+ m_xDriver = xDriverAccess->getDriverByURL(u"jdbc:hsqldb:db"_ustr);
}
return m_xDriver;
@@ -203,46 +203,43 @@ namespace connectivity
// properties for accessing the embedded storage
OUString sKey = StorageContainer::registerStorage( xStorage, sSystemPath );
- aProperties.put( "storage_key", sKey );
- aProperties.put( "storage_class_name",
- OUString( "com.sun.star.sdbcx.comp.hsqldb.StorageAccess" ) );
- aProperties.put( "fileaccess_class_name",
- OUString( "com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess" ) );
+ aProperties.put( u"storage_key"_ustr, sKey );
+ aProperties.put( u"storage_class_name"_ustr,
+ u"com.sun.star.sdbcx.comp.hsqldb.StorageAccess"_ustr );
+ aProperties.put( u"fileaccess_class_name"_ustr,
+ u"com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess"_ustr );
// JDBC driver and driver's classpath
- aProperties.put( "JavaDriverClass",
- OUString( "org.hsqldb.jdbcDriver" ) );
- aProperties.put( "JavaDriverClassPath",
- OUString(
+ aProperties.put( u"JavaDriverClass"_ustr, u"org.hsqldb.jdbcDriver"_ustr );
+ aProperties.put( u"JavaDriverClassPath"_ustr,
#ifdef SYSTEM_HSQLDB
- HSQLDB_JAR
+ u"" HSQLDB_JAR
#else
- "vnd.sun.star.expand:$LO_JAVA_DIR/hsqldb.jar"
+ u"vnd.sun.star.expand:$LO_JAVA_DIR/hsqldb.jar"
#endif
- " vnd.sun.star.expand:$LO_JAVA_DIR/sdbc_hsqldb.jar"
- ) );
+ " vnd.sun.star.expand:$LO_JAVA_DIR/sdbc_hsqldb.jar"_ustr );
// auto increment handling
- aProperties.put( "IsAutoRetrievingEnabled", true );
- aProperties.put( "AutoRetrievingStatement",
- OUString( "CALL IDENTITY()" ) );
- aProperties.put( "IgnoreDriverPrivileges", true );
+ aProperties.put( u"IsAutoRetrievingEnabled"_ustr, true );
+ aProperties.put( u"AutoRetrievingStatement"_ustr,
+ u"CALL IDENTITY()"_ustr );
+ aProperties.put( u"IgnoreDriverPrivileges"_ustr, true );
// don't want to expose HSQLDB's schema capabilities which exist since 1.8.0RC10
- aProperties.put( "default_schema",
- OUString( "true" ) );
+ aProperties.put( u"default_schema"_ustr,
+ u"true"_ustr );
// security: permitted Java classes
NamedValue aPermittedClasses(
- "hsqldb.method_class_names",
- makeAny( lcl_getPermittedJavaMethods_nothrow( m_xContext ) )
+ u"hsqldb.method_class_names"_ustr,
+ Any( lcl_getPermittedJavaMethods_nothrow( m_xContext ) )
);
- aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) );
+ aProperties.put( u"SystemProperties"_ustr, Sequence< NamedValue >( &aPermittedClasses, 1 ) );
OUString sMessage;
try
{
- const OUString sProperties( "properties" );
+ static constexpr OUString sProperties( u"properties"_ustr );
if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) )
{
Reference<XStream > xStream = xStorage->openStreamElement(sProperties,ElementModes::READ);
@@ -251,15 +248,15 @@ namespace connectivity
std::unique_ptr<SvStream> pStream( ::utl::UcbStreamHelper::CreateStream(xStream) );
if (pStream)
{
- OString sLine;
+ OStringBuffer sLine;
OString sVersionString;
while ( pStream->ReadLine(sLine) )
{
if ( sLine.isEmpty() )
continue;
sal_Int32 nIdx {0};
- const OString sIniKey = sLine.getToken(0, '=', nIdx);
- const OString sValue = sLine.getToken(0, '=', nIdx);
+ const std::string_view sIniKey = o3tl::getToken(sLine, 0, '=', nIdx);
+ const OString sValue(o3tl::getToken(sLine, 0, '=', nIdx));
if( sIniKey == "hsqldb.compatible_version" )
{
sVersionString = sValue;
@@ -275,9 +272,9 @@ namespace connectivity
if (!sVersionString.isEmpty())
{
sal_Int32 nIdx {0};
- const sal_Int32 nMajor = sVersionString.getToken(0, '.', nIdx).toInt32();
- const sal_Int32 nMinor = sVersionString.getToken(0, '.', nIdx).toInt32();
- const sal_Int32 nMicro = sVersionString.getToken(0, '.', nIdx).toInt32();
+ const sal_Int32 nMajor = o3tl::toInt32(o3tl::getToken(sVersionString, 0, '.', nIdx));
+ const sal_Int32 nMinor = o3tl::toInt32(o3tl::getToken(sVersionString, 0, '.', nIdx));
+ const sal_Int32 nMicro = o3tl::toInt32(o3tl::getToken(sVersionString, 0, '.', nIdx));
if ( nMajor > 1
|| ( nMajor == 1 && nMinor > 8 )
|| ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) )
@@ -290,6 +287,37 @@ namespace connectivity
} // if ( xStream.is() )
::comphelper::disposeComponent(xStream);
}
+
+ // disallow any database/script files that contain a "SCRIPT[.*]" entry (this is belt and braces
+ // in that bundled hsqldb 1.8.0 is patched to also reject them)
+ //
+ // hsqldb 2.6.0 release notes have: added system role SCRIPT_OPS for export / import of database structure and data
+ // which seems to provide a builtin way to do this with contemporary hsqldb
+ static constexpr OUString sScript(u"script"_ustr);
+ if (!bIsNewDatabase && xStorage->isStreamElement(sScript))
+ {
+ Reference<XStream > xStream = xStorage->openStreamElement(sScript, ElementModes::READ);
+ if (xStream.is())
+ {
+ std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream(xStream));
+ if (pStream)
+ {
+ OStringBuffer sLine;
+ while (pStream->ReadLine(sLine))
+ {
+ OString sText = sLine.makeStringAndClear().trim();
+ if (sText.startsWithIgnoreAsciiCase("SCRIPT"))
+ {
+ ::connectivity::SharedResources aResources;
+ sMessage = aResources.getResourceString(STR_COULD_NOT_LOAD_FILE).replaceFirst("$filename$", sSystemPath);
+ break;
+ }
+ }
+ }
+ } // if ( xStream.is() )
+ ::comphelper::disposeComponent(xStream);
+ }
+
}
catch(Exception&)
{
@@ -304,10 +332,10 @@ namespace connectivity
if ( xProp.is() )
{
sal_Int32 nMode = 0;
- xProp->getPropertyValue("OpenMode") >>= nMode;
+ xProp->getPropertyValue(u"OpenMode"_ustr) >>= nMode;
if ( (nMode & ElementModes::WRITE) != ElementModes::WRITE )
{
- aProperties.put( "readonly", OUString( "true" ) );
+ aProperties.put( u"readonly"_ustr, u"true"_ustr );
}
}
@@ -333,7 +361,7 @@ namespace connectivity
if ( xOrig.is() )
{
// now we have to set the URL to get the correct answer for metadata()->getURL()
- auto pMetaConnection = comphelper::getUnoTunnelImplementation<OMetaConnection>(xOrig);
+ auto pMetaConnection = comphelper::getFromUnoTunnel<OMetaConnection>(xOrig);
if ( pMetaConnection )
pMetaConnection->setURL(url);
@@ -342,23 +370,22 @@ namespace connectivity
xComp->addEventListener(this);
// we want to close all connections when the office shuts down
- static Reference< XTerminateListener> s_xTerminateListener = [&]()
+ static rtl::Reference< OConnectionController > s_xTerminateListener = [&]()
{
Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext );
- auto tmp = new OConnectionController(this);
+ rtl::Reference<OConnectionController> tmp = new OConnectionController(this);
xDesktop->addTerminateListener(tmp);
return tmp;
}();
Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, m_xContext );
xConnection.set(xIfc,UNO_QUERY);
- m_aConnections.push_back(TWeakPair(WeakReferenceHelper(xOrig),TWeakConnectionPair(sKey,TWeakRefPair(WeakReferenceHelper(xConnection),WeakReferenceHelper()))));
+ m_aConnections.push_back( { xOrig, sKey, xConnection, nullptr } );
Reference<XTransactionBroadcaster> xBroad(xStorage,UNO_QUERY);
if ( xBroad.is() )
{
- Reference<XTransactionListener> xListener(*this,UNO_QUERY);
- xBroad->addTransactionListener(xListener);
+ xBroad->addTransactionListener(Reference<XTransactionListener>(this));
}
}
}
@@ -393,29 +420,30 @@ namespace connectivity
{
if ( !acceptsURL(url) )
return Sequence< DriverPropertyInfo >();
- std::vector< DriverPropertyInfo > aDriverInfo;
- aDriverInfo.push_back(DriverPropertyInfo(
- "Storage"
- ,"Defines the storage where the database will be stored."
- ,true
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "URL"
- ,"Defines the url of the data source."
- ,true
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "AutoRetrievingStatement"
- ,"Defines the statement which will be executed to retrieve auto increment values."
- ,false
- ,"CALL IDENTITY()"
- ,Sequence< OUString >())
- );
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ return
+ {
+ {
+ u"Storage"_ustr,
+ u"Defines the storage where the database will be stored."_ustr,
+ true,
+ {},
+ {}
+ },
+ {
+ u"URL"_ustr,
+ u"Defines the url of the data source."_ustr,
+ true,
+ {},
+ {}
+ },
+ {
+ u"AutoRetrievingStatement"_ustr,
+ u"Defines the statement which will be executed to retrieve auto increment values."_ustr,
+ false,
+ u"CALL IDENTITY()"_ustr,
+ {}
+ }
+ };
}
@@ -436,18 +464,18 @@ namespace connectivity
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(ODriverDelegator_BASE::rBHelper.bDisposed);
- Reference< XTablesSupplier > xTab;
+ rtl::Reference< OHCatalog > xTab;
- TWeakPairVector::iterator i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
- [&connection](const TWeakPairVector::value_type& rConnection) {
- return rConnection.second.second.first.get() == connection.get(); });
+ auto i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
+ [&connection](const TConnectionInfo& rConnection) {
+ return rConnection.xConn.get() == connection.get(); });
if (i != m_aConnections.end())
{
- xTab.set(i->second.second.second,UNO_QUERY);
+ xTab = i->xCatalog.get();
if ( !xTab.is() )
{
xTab = new OHCatalog(connection);
- i->second.second.second = WeakReferenceHelper(xTab);
+ i->xCatalog = xTab.get();
}
}
@@ -481,33 +509,40 @@ namespace connectivity
Sequence< OUString > SAL_CALL ODriverDelegator::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr, u"com.sun.star.sdbcx.Driver"_ustr };
}
void SAL_CALL ODriverDelegator::createCatalog( const Sequence< PropertyValue >& /*info*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XCreateCatalog::createCatalog", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XCreateCatalog::createCatalog"_ustr, *this );
}
- void ODriverDelegator::shutdownConnection(const TWeakPairVector::iterator& _aIter )
+ void ODriverDelegator::shutdownConnection(const std::vector<TConnectionInfo>::iterator& _aIter )
{
OSL_ENSURE(m_aConnections.end() != _aIter,"Iterator equals .end()");
bool bLastOne = true;
try
{
- Reference<XConnection> _xConnection(_aIter->first.get(),UNO_QUERY);
+ Reference<XConnection> _xConnection(_aIter->xOrigConn);
if ( _xConnection.is() )
{
Reference<XStatement> xStmt = _xConnection->createStatement();
if ( xStmt.is() )
{
- Reference<XResultSet> xRes = xStmt->executeQuery("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS WHERE USER_NAME ='SA'");
+ Reference<XResultSet> xRes = xStmt->executeQuery(u"SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS WHERE USER_NAME ='SA'"_ustr);
Reference<XRow> xRow(xRes,UNO_QUERY);
if ( xRow.is() && xRes->next() )
bLastOne = xRow->getInt(1) == 1;
if ( bLastOne )
- xStmt->execute("SHUTDOWN");
+ {
+ // during shutdown, we are running on the main thread, and if we call this,
+ // it might trigger dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow
+ // which is running on a different thread, and that will call other code that tries
+ // to take the solar mutex.
+ SolarMutexReleaser aReleaser;
+ xStmt->execute(u"SHUTDOWN"_ustr);
+ }
}
}
}
@@ -518,7 +553,7 @@ namespace connectivity
{
// Reference<XTransactionListener> xListener(*this,UNO_QUERY);
// a shutdown should commit all changes to the db files
- StorageContainer::revokeStorage(_aIter->second.first,nullptr);
+ StorageContainer::revokeStorage(_aIter->sKey,nullptr);
}
if ( !m_bInShutDownConnections )
m_aConnections.erase(_aIter);
@@ -530,8 +565,8 @@ namespace connectivity
Reference<XConnection> xCon(Source.Source,UNO_QUERY);
if ( xCon.is() )
{
- TWeakPairVector::iterator i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
- [&xCon](const TWeakPairVector::value_type& rConnection) { return rConnection.first.get() == xCon.get(); });
+ auto i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
+ [&xCon](const TConnectionInfo& rConnection) { return rConnection.xOrigConn.get() == xCon.get(); });
if (i != m_aConnections.end())
shutdownConnection(i);
@@ -542,9 +577,9 @@ namespace connectivity
if ( xStorage.is() )
{
OUString sKey = StorageContainer::getRegisteredKey(xStorage);
- TWeakPairVector::iterator i = std::find_if(m_aConnections.begin(),m_aConnections.end(),
- [&sKey] (const TWeakPairVector::value_type& conn) {
- return conn.second.first == sKey;
+ auto i = std::find_if(m_aConnections.begin(),m_aConnections.end(),
+ [&sKey] (const TConnectionInfo& conn) {
+ return conn.sKey == sKey;
});
if ( i != m_aConnections.end() )
@@ -560,7 +595,7 @@ namespace connectivity
{
try
{
- Reference<XConnection> xCon(rConnection.first,UNO_QUERY);
+ Reference<XConnection> xCon(rConnection.xOrigConn);
::comphelper::disposeComponent(xCon);
}
catch(Exception&)
@@ -577,7 +612,7 @@ namespace connectivity
{
try
{
- Reference<XFlushable> xCon(rConnection.second.second.first.get(),UNO_QUERY);
+ Reference<XFlushable> xCon(rConnection.xConn.get(),UNO_QUERY);
if (xCon.is())
xCon->flush();
}
@@ -597,9 +632,9 @@ namespace connectivity
if ( sKey.isEmpty() )
return;
- TWeakPairVector::const_iterator i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
- [&sKey] (const TWeakPairVector::value_type& conn) {
- return conn.second.first == sKey;
+ auto i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
+ [&sKey] (const TConnectionInfo& conn) {
+ return conn.sKey == sKey;
});
OSL_ENSURE( i != m_aConnections.end(), "ODriverDelegator::preCommit: they're committing a storage which I do not know!" );
@@ -608,13 +643,13 @@ namespace connectivity
try
{
- Reference<XConnection> xConnection(i->first,UNO_QUERY);
+ Reference<XConnection> xConnection(i->xOrigConn);
if ( xConnection.is() )
{
Reference< XStatement> xStmt = xConnection->createStatement();
OSL_ENSURE( xStmt.is(), "ODriverDelegator::preCommit: no statement!" );
if ( xStmt.is() )
- xStmt->execute( "SET WRITE_DELAY 0" );
+ xStmt->execute( u"SET WRITE_DELAY 0"_ustr );
bool bPreviousAutoCommit = xConnection->getAutoCommit();
xConnection->setAutoCommit( false );
@@ -622,7 +657,7 @@ namespace connectivity
xConnection->setAutoCommit( bPreviousAutoCommit );
if ( xStmt.is() )
- xStmt->execute( "SET WRITE_DELAY 60" );
+ xStmt->execute( u"SET WRITE_DELAY 60"_ustr );
}
}
catch(Exception&)
@@ -783,7 +818,7 @@ namespace connectivity
OUString lcl_getSystemLocale( const Reference< XComponentContext >& _rxContext )
{
- OUString sLocaleString = "en-US";
+ OUString sLocaleString = u"en-US"_ustr;
try
{
@@ -794,13 +829,13 @@ namespace connectivity
// arguments for creating the config access
Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
{
- {"nodepath", Any(OUString("/org.openoffice.Setup/L10N" ))}, // the path to the node to open
+ {"nodepath", Any(u"/org.openoffice.Setup/L10N"_ustr)}, // the path to the node to open
{"depth", Any(sal_Int32(-1))}, // the depth: -1 means unlimited
}));
// create the access
Reference< XPropertySet > xNode(
xConfigProvider->createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationAccess",
+ u"com.sun.star.configuration.ConfigurationAccess"_ustr,
aArguments ),
UNO_QUERY );
OSL_ENSURE( xNode.is(), "lcl_getSystemLocale: invalid access returned (should throw an exception instead)!" );
@@ -808,7 +843,7 @@ namespace connectivity
// ask for the system locale setting
if ( xNode.is() )
- xNode->getPropertyValue("ooSetupSystemLocale") >>= sLocaleString;
+ xNode->getPropertyValue(u"ooSetupSystemLocale"_ustr) >>= sLocaleString;
}
catch( const Exception& )
{
@@ -832,8 +867,7 @@ namespace connectivity
OSL_ENSURE( xStatement.is(), "ODriverDelegator::onConnectedNewDatabase: could not create a statement!" );
if ( xStatement.is() )
{
- OUStringBuffer aStatement;
- aStatement.append( "SET DATABASE COLLATION \"" );
+ OUStringBuffer aStatement( "SET DATABASE COLLATION \"" );
aStatement.appendAscii( lcl_getCollationForLocale( lcl_getSystemLocale( m_xContext ) ) );
aStatement.append( "\"" );
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
index 91b8324008e3..3e874dbbeddc 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -22,15 +22,14 @@
#include <hsqldb/HStorageMap.hxx>
#include "accesslog.hxx"
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <string.h>
-using namespace ::com::sun::star::container;
+#include <algorithm>
+
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::lang;
using namespace ::connectivity::hsqldb;
#define ThrowException(env, type, msg) { \
@@ -146,28 +145,28 @@ jint read_from_storage_stream( JNIEnv * env, jstring name, jstring key )
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
Reference< XInputStream> xIn = pHelper ? pHelper->getInputStream() : Reference< XInputStream>();
OSL_ENSURE(xIn.is(),"Input stream is NULL!");
- if ( xIn.is() )
+ if ( !xIn.is() )
+ return -1;
+
+ Sequence< ::sal_Int8 > aData(1);
+ sal_Int32 nBytesRead = -1;
+ try
{
- Sequence< ::sal_Int8 > aData(1);
- sal_Int32 nBytesRead = -1;
- try
- {
- nBytesRead = xIn->readBytes(aData,1);
- }
- catch(const Exception& e)
- {
- StorageContainer::throwJavaException(e,env);
- return -1;
+ nBytesRead = xIn->readBytes(aData,1);
+ }
+ catch(const Exception& e)
+ {
+ StorageContainer::throwJavaException(e,env);
+ return -1;
- }
- if (nBytesRead <= 0)
- {
- return -1;
- }
- else
- {
- return static_cast<unsigned char>(aData[0]);
- }
+ }
+ if (nBytesRead <= 0)
+ {
+ return -1;
+ }
+ else
+ {
+ return static_cast<unsigned char>(aData[0]);
}
return -1;
}
@@ -229,7 +228,7 @@ jint read_from_storage_stream_into_buffer( JNIEnv * env, jstring name, jstring k
if (nBytesRead <= 0)
return -1;
- env->SetByteArrayRegion(buffer,off,nBytesRead,reinterpret_cast<jbyte*>(&aData[0]));
+ env->SetByteArrayRegion(buffer,off,nBytesRead,reinterpret_cast<const jbyte*>(&aData[0]));
return nBytesRead;
}
@@ -299,10 +298,8 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nativ
}
Sequence< sal_Int32 > ch(4);
- for(sal_Int32 i = 0;i < 4; ++i)
- {
- ch[i] = static_cast<unsigned char>(aData[i]);
- }
+ std::transform(aData.begin(), aData.end(), ch.getArray(),
+ [](auto c) { return static_cast<unsigned char>(c); });
if ((ch[0] | ch[1] | ch[2] | ch[3]) < 0)
{
@@ -341,10 +338,15 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nativ
#endif
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XSeekable> xSeek = pHelper ? pHelper->getSeek() : Reference< XSeekable>();
- OSL_ENSURE(xSeek.is(),"No Seekable stream!");
- if ( !xSeek.is() )
+ OSL_ENSURE(pHelper, "No StreamHelper!");
+ if (!pHelper)
+ return;
+
+ Reference< XSeekable> xSeek = pHelper->getSeek();
+
+ OSL_ENSURE(xSeek.is(), "No Seekable stream!");
+ if (!xSeek)
return;
#ifdef HSQLDB_DBG
@@ -362,22 +364,22 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nativ
Reference< XOutputStream> xOut = pHelper->getOutputStream();
OSL_ENSURE(xOut.is(),"No output stream!");
- ::sal_Int64 diff = position - nLen;
- sal_Int32 n;
- while( diff != 0 )
+ sal_Int64 diff = position - nLen, n;
+ while (diff != 0)
{
- if ( BUFFER_SIZE < diff )
+ if (diff > BUFFER_SIZE)
{
- n = static_cast<sal_Int32>(BUFFER_SIZE);
+ n = BUFFER_SIZE;
diff = diff - BUFFER_SIZE;
}
else
{
- n = static_cast<sal_Int32>(diff);
+ n = diff;
diff = 0;
}
- Sequence< ::sal_Int8 > aData(n);
- memset(aData.getArray(),0,n);
+ assert(n >= 0 && n <= SAL_MAX_INT32 && "this fits in sal_Int32");
+ Sequence<sal_Int8> aData(n);
+ memset(aData.getArray(), 0, n);
xOut->writeBytes(aData);
#ifdef HSQLDB_DBG
aDataLog.write( aData.getConstArray(), n );
@@ -463,11 +465,13 @@ void write_to_storage_stream( JNIEnv* env, jstring name, jstring key, jint v )
{
if ( xOut.is() )
{
- Sequence< ::sal_Int8 > oneByte(4);
- oneByte[0] = static_cast<sal_Int8>((v >> 24) & 0xFF);
- oneByte[1] = static_cast<sal_Int8>((v >> 16) & 0xFF);
- oneByte[2] = static_cast<sal_Int8>((v >> 8) & 0xFF);
- oneByte[3] = static_cast<sal_Int8>((v >> 0) & 0xFF);
+ Sequence< ::sal_Int8 > oneByte
+ {
+ static_cast<sal_Int8>((v >> 24) & 0xFF),
+ static_cast<sal_Int8>((v >> 16) & 0xFF),
+ static_cast<sal_Int8>((v >> 8) & 0xFF),
+ static_cast<sal_Int8>((v >> 0) & 0xFF)
+ };
xOut->writeBytes(oneByte);
}
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
index 63b5e0481c5c..822a655675d2 100644
--- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
@@ -27,7 +27,7 @@
#include <sal/log.hxx>
#include <uno/mapping.hxx>
#include <algorithm>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace connectivity::hsqldb
{
@@ -103,14 +103,14 @@ namespace connectivity::hsqldb
{
css::uno::Environment env(css::uno::Environment::getCurrent());
if (!(env.is() && storageEnvironment.is())) {
- throw css::uno::RuntimeException("cannot get environments");
+ throw css::uno::RuntimeException(u"cannot get environments"_ustr);
}
if (env.get() == storageEnvironment.get()) {
return storage;
} else {
css::uno::Mapping map(storageEnvironment, env);
if (!map.is()) {
- throw css::uno::RuntimeException("cannot get mapping");
+ throw css::uno::RuntimeException(u"cannot get mapping"_ustr);
}
css::uno::Reference<css::embed::XStorage> mapped;
map.mapInterface(
@@ -132,9 +132,9 @@ namespace connectivity::hsqldb
return OUString::number(s_nCount++);
}
- OUString StorageContainer::removeURLPrefix(const OUString& _sURL,const OUString& _sFileURL)
+ OUString StorageContainer::removeURLPrefix(std::u16string_view _sURL, std::u16string_view _sFileURL)
{
- return _sURL.copy(_sFileURL.getLength()+1);
+ return OUString(_sURL.substr(_sFileURL.size()+1));
}
OUString StorageContainer::removeOldURLPrefix(const OUString& _sURL)
diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx
index 0049ff919fc3..05338f21aef2 100644
--- a/connectivity/source/drivers/hsqldb/HTable.cxx
+++ b/connectivity/source/drivers/hsqldb/HTable.cxx
@@ -18,7 +18,6 @@
*/
#include <hsqldb/HTable.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <comphelper/property.hxx>
@@ -30,7 +29,7 @@
#include <hsqldb/HColumns.hxx>
#include <TConnection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::comphelper;
@@ -116,21 +115,6 @@ sdbcx::OCollection* OHSQLTable::createIndexes(const ::std::vector< OUString>& _r
return new OIndexesHelper(this,m_aMutex,_rNames);
}
-Sequence< sal_Int8 > OHSQLTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OHSQLTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return (isUnoTunnelId<OHSQLTable>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
// XAlterTable
void SAL_CALL OHSQLTable::alterColumnByName( const OUString& colName, const Reference< XPropertySet >& descriptor )
@@ -260,12 +244,11 @@ void OHSQLTable::alterColumnType(sal_Int32 nNewType,const OUString& _rColName, c
(void)_rColName;
#endif
- OHSQLColumn* pColumn = new OHSQLColumn;
- Reference<XPropertySet> xProp = pColumn;
- ::comphelper::copyProperties(_xDescriptor,xProp);
- xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType));
+ rtl::Reference<OHSQLColumn> pColumn = new OHSQLColumn;
+ ::comphelper::copyProperties(_xDescriptor,pColumn);
+ pColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),Any(nNewType));
- sSql += ::dbtools::createStandardColumnPart(xProp,getConnection());
+ sSql += ::dbtools::createStandardColumnPart(pColumn,getConnection());
executeStatement(sSql);
}
@@ -293,7 +276,7 @@ void OHSQLTable::dropDefaultValue(const OUString& _rColName)
OUString OHSQLTable::getAlterTableColumnPart() const
{
- OUString sSql( "ALTER TABLE " );
+ OUString sSql( u"ALTER TABLE "_ustr );
OUString sComposedName( ::dbtools::composeTableName( getMetaData(), m_CatalogName, m_SchemaName, m_Name, true, ::dbtools::EComposeRule::InTableDefinitions ) );
sSql += sComposedName;
@@ -305,7 +288,7 @@ void OHSQLTable::executeStatement(const OUString& _rStatement )
{
OUString sSQL = _rStatement;
if(sSQL.endsWith(","))
- sSQL = sSQL.replaceAt(sSQL.getLength()-1, 1, ")");
+ sSQL = sSQL.replaceAt(sSQL.getLength()-1, 1, u")");
Reference< XStatement > xStmt = getConnection()->createStatement( );
if ( xStmt.is() )
@@ -355,7 +338,7 @@ void SAL_CALL OHSQLTable::rename( const OUString& newName )
if(!isNew())
{
- OUString sSql = "ALTER ";
+ OUString sSql = u"ALTER "_ustr;
if ( m_Type == "VIEW" )
sSql += " VIEW ";
else
diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx
index 787af894b992..dcb1ee1a33d9 100644
--- a/connectivity/source/drivers/hsqldb/HTables.cxx
+++ b/connectivity/source/drivers/hsqldb/HTables.cxx
@@ -37,47 +37,42 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace dbtools;
-sdbcx::ObjectType OTables::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OTables::createObject(const OUString& _rName)
{
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
- Sequence< OUString > sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else...
+ Sequence< OUString > sTableTypes {u"VIEW"_ustr, u"TABLE"_ustr, u"%"_ustr}; // this last one just to be sure to include anything else...
Any aCatalog;
if ( !sCatalog.isEmpty() )
aCatalog <<= sCatalog;
Reference< XResultSet > xResult = m_xMetaData->getTables(aCatalog,sSchema,sTable,sTableTypes);
- sdbcx::ObjectType xRet;
- if ( xResult.is() )
+ if ( !xResult.is() )
+ return nullptr;
+
+ rtl::Reference< OHSQLTable > xRet;
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ if ( xResult->next() ) // there can be only one table with this name
{
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if ( xResult->next() ) // there can be only one table with this name
- {
- sal_Int32 nPrivileges = ::dbtools::getTablePrivileges( m_xMetaData, sCatalog, sSchema, sTable );
- if ( m_xMetaData->isReadOnly() )
- nPrivileges &= ~( Privilege::INSERT | Privilege::UPDATE | Privilege::DELETE | Privilege::CREATE | Privilege::ALTER | Privilege::DROP );
-
- // obtain privileges
- OHSQLTable* pRet = new OHSQLTable( this
- ,static_cast<OHCatalog&>(m_rParent).getConnection()
- ,sTable
- ,xRow->getString(4)
- ,xRow->getString(5)
- ,sSchema
- ,sCatalog
- ,nPrivileges);
- xRet = pRet;
- }
- ::comphelper::disposeComponent(xResult);
+ sal_Int32 nPrivileges = ::dbtools::getTablePrivileges( m_xMetaData, sCatalog, sSchema, sTable );
+ if ( m_xMetaData->isReadOnly() )
+ nPrivileges &= ~( Privilege::INSERT | Privilege::UPDATE | Privilege::DELETE | Privilege::CREATE | Privilege::ALTER | Privilege::DROP );
+
+ // obtain privileges
+ xRet = new OHSQLTable( this
+ ,static_cast<OHCatalog&>(m_rParent).getConnection()
+ ,sTable
+ ,xRow->getString(4)
+ ,xRow->getString(5)
+ ,sSchema
+ ,sCatalog
+ ,nPrivileges);
}
+ ::comphelper::disposeComponent(xResult);
return xRet;
}
@@ -99,7 +94,7 @@ Reference< XPropertySet > OTables::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
createTable(descriptor);
return createObject( _rForName );
@@ -119,7 +114,7 @@ void OTables::dropObject(sal_Int32 _nPos,const OUString& _sElementName)
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
- OUString aSql( "DROP " );
+ OUString aSql( u"DROP "_ustr );
Reference<XPropertySet> xProp(xObject,UNO_QUERY);
bool bIsView;
@@ -164,13 +159,13 @@ void OTables::appendNew(const OUString& _rsNewTable)
insertElement(_rsNewTable,nullptr);
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners);
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rsNewTable), Any(), Any());
+ OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
+ aListenerLoop.next()->elementInserted(aEvent);
}
-OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
+OUString OTables::getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject)
{
OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!");
return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::EComposeRule::InDataManipulation, false );
diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx b/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
index a9df5ccc9b9a..7c6b494488db 100644
--- a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
+++ b/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
@@ -23,7 +23,6 @@
namespace connectivity
{
using namespace hsqldb;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
// XEventListener
diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx b/connectivity/source/drivers/hsqldb/HTerminateListener.hxx
index 63d69b29e64b..265be80ef5b9 100644
--- a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx
+++ b/connectivity/source/drivers/hsqldb/HTerminateListener.hxx
@@ -16,34 +16,31 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_HTERMINATELISTENER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_HTERMINATELISTENER_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/frame/XTerminateListener.hpp>
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
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_HTERMINATELISTENER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HTools.cxx b/connectivity/source/drivers/hsqldb/HTools.cxx
index b9854c01ce67..3dd388aceecb 100644
--- a/connectivity/source/drivers/hsqldb/HTools.cxx
+++ b/connectivity/source/drivers/hsqldb/HTools.cxx
@@ -23,18 +23,18 @@
namespace connectivity::hsqldb
{
- void HTools::appendTableFilterCrit( OUStringBuffer& _inout_rBuffer, const OUString& _rCatalog,
- const OUString& _rSchema, const OUString& _rName, bool _bShortForm )
+ void HTools::appendTableFilterCrit( OUStringBuffer& _inout_rBuffer, std::u16string_view _rCatalog,
+ std::u16string_view _rSchema, std::u16string_view _rName, bool _bShortForm )
{
_inout_rBuffer.append( " WHERE " );
- if ( !_rCatalog.isEmpty() )
+ if ( !_rCatalog.empty() )
{
_inout_rBuffer.appendAscii( _bShortForm ? "TABLE_CAT" : "TABLE_CATALOG" );
_inout_rBuffer.append( " = '" );
_inout_rBuffer.append ( _rCatalog );
_inout_rBuffer.append( "' AND " );
}
- if ( !_rSchema.isEmpty() )
+ if ( !_rSchema.empty() )
{
_inout_rBuffer.appendAscii( _bShortForm ? "TABLE_SCHEM" : "TABLE_SCHEMA" );
_inout_rBuffer.append( " = '" );
diff --git a/connectivity/source/drivers/hsqldb/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx
index 2ed0c06262ff..95cb68ea517f 100644
--- a/connectivity/source/drivers/hsqldb/HUser.cxx
+++ b/connectivity/source/drivers/hsqldb/HUser.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
#include <TConnection.hxx>
#include <strings.hrc>
+#include <utility>
using namespace connectivity;
using namespace connectivity::hsqldb;
@@ -37,16 +38,16 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-OHSQLUser::OHSQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection) : connectivity::sdbcx::OUser(true)
- ,m_xConnection(_xConnection)
+OHSQLUser::OHSQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection) : connectivity::sdbcx::OUser(true)
+ ,m_xConnection(std::move(_xConnection))
{
construct();
}
-OHSQLUser::OHSQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+OHSQLUser::OHSQLUser( css::uno::Reference< css::sdbc::XConnection > _xConnection,
const OUString& Name
) : connectivity::sdbcx::OUser(Name,true)
- ,m_xConnection(_xConnection)
+ ,m_xConnection(std::move(_xConnection))
{
construct();
}
@@ -113,7 +114,7 @@ void OHSQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_In
Any aCatalog;
if ( !sCatalog.isEmpty() )
aCatalog <<= sCatalog;
- xRes = xMeta->getColumnPrivileges(aCatalog,sSchema,sTable,"%");
+ xRes = xMeta->getColumnPrivileges(aCatalog,sSchema,sTable,u"%"_ustr);
}
break;
}
@@ -266,7 +267,7 @@ void SAL_CALL OHSQLUser::changePassword( const OUString& /*oldPassword*/, const
if( m_Name != xMeta->getUserName() )
{
- ::dbtools::throwGenericSQLException("HSQLDB can only change password of the current user.", *this);
+ ::dbtools::throwGenericSQLException(u"HSQLDB can only change password of the current user."_ustr, *this);
}
OUString sAlterPwd = "SET PASSWORD " +
diff --git a/connectivity/source/drivers/hsqldb/HUsers.cxx b/connectivity/source/drivers/hsqldb/HUsers.cxx
index 40d1f5243cb6..2141a0045d58 100644
--- a/connectivity/source/drivers/hsqldb/HUsers.cxx
+++ b/connectivity/source/drivers/hsqldb/HUsers.cxx
@@ -23,6 +23,7 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <TConnection.hxx>
+#include <utility>
using namespace ::comphelper;
using namespace connectivity;
@@ -30,22 +31,20 @@ using namespace connectivity::hsqldb;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OUsers::OUsers( ::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const ::std::vector< OUString> &_rVector,
- const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ css::uno::Reference< css::sdbc::XConnection > _xConnection,
connectivity::sdbcx::IRefreshableUsers* _pParent)
: sdbcx::OCollection(_rParent, true, _rMutex, _rVector)
- ,m_xConnection(_xConnection)
+ ,m_xConnection(std::move(_xConnection))
,m_pParent(_pParent)
{
}
-sdbcx::ObjectType OUsers::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > OUsers::createObject(const OUString& _rName)
{
return new OHSQLUser(m_xConnection,_rName);
}
@@ -57,12 +56,11 @@ void OUsers::impl_refresh()
Reference< XPropertySet > OUsers::createDescriptor()
{
- OUserExtend* pNew = new OUserExtend(m_xConnection);
- return pNew;
+ return new OUserExtend(m_xConnection);
}
// XAppend
-sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
OUString sPassword;
@@ -85,7 +83,7 @@ sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Referen
// XDrop
void OUsers::dropObject(sal_Int32 /*nPos*/,const OUString& _sElementName)
{
- OUString aSql( "REVOKE ALL ON * FROM " );
+ OUString aSql( u"REVOKE ALL ON * FROM "_ustr );
OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
aSql += ::dbtools::quoteName(aQuote,_sElementName);
diff --git a/connectivity/source/drivers/hsqldb/HView.cxx b/connectivity/source/drivers/hsqldb/HView.cxx
index 0a09ec0d201b..83946ee86f86 100644
--- a/connectivity/source/drivers/hsqldb/HView.cxx
+++ b/connectivity/source/drivers/hsqldb/HView.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/sdbc/SQLException.hpp>
#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/sharedunocomponent.hxx>
@@ -90,12 +90,11 @@ namespace connectivity::hsqldb
// create a statement which can be used to re-create the original view, in case
// dropping it succeeds, but creating it with a new statement fails
- OUStringBuffer aRestoreCommand;
- aRestoreCommand.append( "CREATE VIEW " );
- aRestoreCommand.append ( sQualifiedName );
- aRestoreCommand.append( " AS " );
- aRestoreCommand.append ( impl_getCommand_throwSQLException() );
- OUString sRestoreCommand( aRestoreCommand.makeStringAndClear() );
+ OUString sRestoreCommand =
+ "CREATE VIEW " +
+ sQualifiedName +
+ " AS " +
+ impl_getCommand_throwSQLException();
bool bDropSucceeded( false );
try
@@ -147,8 +146,8 @@ namespace connectivity::hsqldb
OUString HView::impl_getCommand() const
{
- OUStringBuffer aCommand;
- aCommand.append( "SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.SYSTEM_VIEWS " );
+ OUStringBuffer aCommand(
+ "SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.SYSTEM_VIEWS " );
HTools::appendTableFilterCrit( aCommand, m_CatalogName, m_SchemaName, m_Name, false );
::utl::SharedUNOComponent< XStatement > xStatement; xStatement.set( m_xConnection->createStatement(), UNO_QUERY_THROW );
Reference< XResultSet > xResult( xStatement->executeQuery( aCommand.makeStringAndClear() ), css::uno::UNO_SET_THROW );
diff --git a/connectivity/source/drivers/hsqldb/HViews.cxx b/connectivity/source/drivers/hsqldb/HViews.cxx
index e67a9fa14f86..880b7bc4ce51 100644
--- a/connectivity/source/drivers/hsqldb/HViews.cxx
+++ b/connectivity/source/drivers/hsqldb/HViews.cxx
@@ -33,10 +33,7 @@ using namespace connectivity;
using namespace connectivity::hsqldb;
using namespace css::uno;
using namespace css::beans;
-using namespace css::sdbcx;
using namespace css::sdbc;
-using namespace css::container;
-using namespace css::lang;
using namespace dbtools;
typedef connectivity::sdbcx::OCollection OCollection_TYPE;
@@ -51,7 +48,7 @@ HViews::HViews( const Reference< XConnection >& _rxConnection, ::cppu::OWeakObje
}
-sdbcx::ObjectType HViews::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > HViews::createObject(const OUString& _rName)
{
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(m_xMetaData,
@@ -78,12 +75,11 @@ void HViews::disposing()
Reference< XPropertySet > HViews::createDescriptor()
{
Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
- connectivity::sdbcx::OView* pNew = new connectivity::sdbcx::OView(true, xConnection->getMetaData());
- return pNew;
+ return new connectivity::sdbcx::OView(true, xConnection->getMetaData());
}
// XAppend
-sdbcx::ObjectType HViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > HViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
createView(descriptor);
return createObject( _rForName );
@@ -99,7 +95,7 @@ void HViews::dropObject(sal_Int32 _nPos,const OUString& /*_sElementName*/)
bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
if (!bIsNew)
{
- OUString aSql( "DROP VIEW" );
+ OUString aSql( u"DROP VIEW"_ustr );
Reference<XPropertySet> xProp(xObject,UNO_QUERY);
aSql += ::dbtools::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InTableDefinitions, true );
diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
index 65457ab1d129..bb07d6673fb1 100644
--- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
@@ -24,8 +24,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <hsqldb/HStorageMap.hxx>
-#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno;
@@ -44,42 +43,42 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
{
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
auto storage = aStoragePair.mapStorage();
- if ( storage.is() )
+ if ( !storage )
+ return JNI_FALSE;
+
+ try
{
+ OUString sName = StorageContainer::jstring2ustring(env,name);
try
{
- OUString sName = StorageContainer::jstring2ustring(env,name);
- try
+ OUString sOldName = StorageContainer::removeOldURLPrefix(sName);
+ if ( storage->isStreamElement(sOldName) )
{
- OUString sOldName = StorageContainer::removeOldURLPrefix(sName);
- if ( storage->isStreamElement(sOldName) )
+ try
+ {
+ storage->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.url));
+ }
+ catch(const Exception&)
{
- try
- {
- storage->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.url));
- }
- catch(const Exception&)
- {
- }
}
}
- catch(const NoSuchElementException&)
- {
- }
- catch(const IllegalArgumentException&)
- {
- }
- return storage->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.url));
}
catch(const NoSuchElementException&)
{
}
- catch(const Exception&)
+ catch(const IllegalArgumentException&)
{
- TOOLS_WARN_EXCEPTION("connectivity.hsqldb", "forwarding");
- if (env->ExceptionCheck())
- env->ExceptionClear();
}
+ return storage->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.url));
+ }
+ catch(const NoSuchElementException&)
+ {
+ }
+ catch(const Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("connectivity.hsqldb", "forwarding");
+ if (env->ExceptionCheck())
+ env->ExceptionClear();
}
return JNI_FALSE;
}
diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
index 7ddf79aa5e77..3336c7f78bb0 100644
--- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
@@ -27,18 +27,16 @@
#include <hsqldb/HStorageMap.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "accesslog.hxx"
#include <limits>
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::lang;
using namespace ::connectivity::hsqldb;
/*****************************************************************************/
@@ -136,9 +134,12 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stor
#endif
if ( n < 0 )
+ {
ThrowException( env,
"java/io/IOException",
"n < 0");
+ return 0;
+ }
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
OSL_ENSURE(pHelper,"No stream helper!");
@@ -155,10 +156,10 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stor
try
{
do {
- if (tmpLongVal >= std::numeric_limits<sal_Int64>::max() )
+ if (tmpLongVal > std::numeric_limits<sal_Int32>::max() )
tmpIntVal = std::numeric_limits<sal_Int32>::max();
else // Casting is safe here.
- tmpIntVal = static_cast<sal_Int32>(tmpLongVal);
+ tmpIntVal = static_cast<sal_Int32>(tmpLongVal & 0xFFFFFFFF);
tmpLongVal -= tmpIntVal;
@@ -277,7 +278,7 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
}
OSL_ENSURE(nLen >= nBytesRead,"Buffer is too small!");
OSL_ENSURE(aData.getLength() >= nBytesRead,"Buffer is too small!");
- env->SetByteArrayRegion(buffer, 0, nBytesRead, reinterpret_cast<jbyte*>(&aData[0]));
+ env->SetByteArrayRegion(buffer, 0, nBytesRead, reinterpret_cast<const jbyte*>(&aData[0]));
#ifdef HSQLDB_DBG
aDataLog.write( &aData[0], nBytesRead );
#endif
diff --git a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
index f766696e0d9b..bccbec20fcd2 100644
--- a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
@@ -30,12 +30,8 @@
#include <hsqldb/HStorageAccess.hxx>
#include <hsqldb/HStorageMap.hxx>
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::document;
-using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::lang;
using namespace ::connectivity::hsqldb;
diff --git a/connectivity/source/drivers/hsqldb/accesslog.hxx b/connectivity/source/drivers/hsqldb/accesslog.hxx
index a4dc41f2d35e..81db98ae7750 100644
--- a/connectivity/source/drivers/hsqldb/accesslog.hxx
+++ b/connectivity/source/drivers/hsqldb/accesslog.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_ACCESSLOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_ACCESSLOG_HXX
+#pragma once
#ifdef HSQLDB_DBG
@@ -133,6 +132,4 @@ namespace connectivity::hsqldb
} }
#endif
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_ACCESSLOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx
index adacd5d7c166..c62c9ba5599b 100644
--- a/connectivity/source/drivers/jdbc/Blob.cxx
+++ b/connectivity/source/drivers/jdbc/Blob.cxx
@@ -132,13 +132,12 @@ sal_Int64 SAL_CALL java_sql_Blob::position( const css::uno::Sequence< sal_Int8 >
sal_Int64 SAL_CALL java_sql_Blob::positionOfBlob( const css::uno::Reference< css::sdbc::XBlob >& /*pattern*/, sal_Int64 /*start*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XBlob::positionOfBlob", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XBlob::positionOfBlob"_ustr, *this );
// this was put here in CWS warnings01. The previous implementation was defective, as it did ignore
// the pattern parameter. Since the effort for proper implementation is rather high - we would need
- // to translated patter into a byte[] -, we defer this functionality for the moment (hey, it was
+ // to translated pattern into a byte[] -, we defer this functionality for the moment (hey, it was
// unusable, anyway)
// #i57457#
- return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
index 574fd666b75b..6c1714e06352 100644
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx
@@ -33,13 +33,12 @@
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-IMPLEMENT_SERVICE_INFO(java_sql_CallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement");
+IMPLEMENT_SERVICE_INFO(java_sql_CallableStatement,u"com.sun.star.sdbcx.ACallableStatement"_ustr,u"com.sun.star.sdbc.CallableStatement"_ustr);
//************ Class: java.sql.CallableStatement
@@ -62,10 +61,10 @@ Any SAL_CALL java_sql_CallableStatement::queryInterface( const Type & rType )
css::uno::Sequence< css::uno::Type > SAL_CALL java_sql_CallableStatement::getTypes( )
{
- ::cppu::OTypeCollection aTypes( cppu::UnoType<css::sdbc::XRow>::get(),
- cppu::UnoType<css::sdbc::XOutParameters>::get());
+ css::uno::Type aTypes[] { cppu::UnoType<css::sdbc::XRow>::get(),
+ cppu::UnoType<css::sdbc::XOutParameters>::get() };
- return ::comphelper::concatSequences(aTypes.getTypes(),java_sql_PreparedStatement::getTypes());
+ return ::comphelper::concatSequences(java_sql_PreparedStatement::getTypes(), aTypes);
}
sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( )
@@ -302,12 +301,12 @@ Reference< css::sdbc::XRef > SAL_CALL java_sql_CallableStatement::getRef( sal_In
return out==nullptr ? nullptr : new java_sql_Ref( t.pEnv, out );
}
-void SAL_CALL java_sql_CallableStatement::acquire() throw()
+void SAL_CALL java_sql_CallableStatement::acquire() noexcept
{
java_sql_PreparedStatement::acquire();
}
-void SAL_CALL java_sql_CallableStatement::release() throw()
+void SAL_CALL java_sql_CallableStatement::release() noexcept
{
java_sql_PreparedStatement::release();
}
diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx
index 135512d5a245..e4ed16559555 100644
--- a/connectivity/source/drivers/jdbc/Clob.cxx
+++ b/connectivity/source/drivers/jdbc/Clob.cxx
@@ -119,14 +119,7 @@ sal_Int64 SAL_CALL java_sql_Clob::position( const OUString& searchstr, sal_Int32
sal_Int64 SAL_CALL java_sql_Clob::positionOfClob( const css::uno::Reference< css::sdbc::XClob >& /*pattern*/, sal_Int64 /*start*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XClob::positionOfClob", *this );
- // this was put here in CWS warnings01. The previous implementation was defective, as it did ignore
- // the pattern parameter. Since the effort for proper implementation is rather high - we would need
- // to translated patter into a byte[] -, we defer this functionality for the moment (hey, it was
- // unusable, anyway)
- // 2005-11-15 / #i57457# / frank.schoenheit@sun.com
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XClob::positionOfClob"_ustr, *this );
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx
index 50e6bc632bc2..3ab1b88eb33b 100644
--- a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx
+++ b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx
@@ -43,33 +43,33 @@ namespace connectivity::jdbc
do // artificial loop for easier flow control
{
- LocalRef< jclass > threadClass( m_environment );
- threadClass.set( m_environment.FindClass( "java/lang/Thread" ) );
- if ( !threadClass.is() )
- break;
-
- jmethodID currentThreadMethod( m_environment.GetStaticMethodID(
- threadClass.get(), "currentThread", "()Ljava/lang/Thread;" ) );
- if ( currentThreadMethod == nullptr )
- break;
-
- m_currentThread.set( m_environment.CallStaticObjectMethod( threadClass.get(), currentThreadMethod ) );
- if ( !m_currentThread.is() )
- break;
-
- jmethodID getContextClassLoaderMethod( m_environment.GetMethodID(
- threadClass.get(), "getContextClassLoader", "()Ljava/lang/ClassLoader;" ) );
- if ( getContextClassLoaderMethod == nullptr )
- break;
- m_oldContextClassLoader.set( m_environment.CallObjectMethod( m_currentThread.get(), getContextClassLoaderMethod ) );
- LocalRef< jthrowable > throwable( m_environment, m_environment.ExceptionOccurred() );
- if ( throwable.is() )
- break;
-
- m_setContextClassLoaderMethod = m_environment.GetMethodID(
- threadClass.get(), "setContextClassLoader", "(Ljava/lang/ClassLoader;)V" );
- if ( m_setContextClassLoaderMethod == nullptr )
- break;
+ LocalRef< jclass > threadClass( m_environment );
+ threadClass.set( m_environment.FindClass( "java/lang/Thread" ) );
+ if ( !threadClass.is() )
+ break;
+
+ jmethodID currentThreadMethod( m_environment.GetStaticMethodID(
+ threadClass.get(), "currentThread", "()Ljava/lang/Thread;" ) );
+ if ( currentThreadMethod == nullptr )
+ break;
+
+ m_currentThread.set( m_environment.CallStaticObjectMethod( threadClass.get(), currentThreadMethod ) );
+ if ( !m_currentThread.is() )
+ break;
+
+ jmethodID getContextClassLoaderMethod( m_environment.GetMethodID(
+ threadClass.get(), "getContextClassLoader", "()Ljava/lang/ClassLoader;" ) );
+ if ( getContextClassLoaderMethod == nullptr )
+ break;
+ m_oldContextClassLoader.set( m_environment.CallObjectMethod( m_currentThread.get(), getContextClassLoaderMethod ) );
+ LocalRef< jthrowable > throwable( m_environment, m_environment.ExceptionOccurred() );
+ if ( throwable.is() )
+ break;
+
+ m_setContextClassLoaderMethod = m_environment.GetMethodID(
+ threadClass.get(), "setContextClassLoader", "(Ljava/lang/ClassLoader;)V" );
+ if ( m_setContextClassLoaderMethod == nullptr )
+ break;
}
while ( false );
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index b14c1372c9a3..e2553f47c020 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -37,10 +37,7 @@ using namespace ::comphelper;
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
jclass java_sql_DatabaseMetaData::theClass = nullptr;
@@ -449,7 +446,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
for (sal_Int32 i = 1 ; i <= nCount ; ++i)
{
sColumnName = xMeta->getColumnName(i);
- for (size_t j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j)
+ for (size_t j = 0 ; j < std::size(sPrivs); ++j)
{
if ( sPrivs[j] == sColumnName )
{
@@ -460,7 +457,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
}
// fill our own resultset
- ODatabaseMetaDataResultSet* pNewPrivRes = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
+ rtl::Reference<ODatabaseMetaDataResultSet> pNewPrivRes = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
Reference< XResultSet > xTemp = xReturn;
xReturn = pNewPrivRes;
ODatabaseMetaDataResultSet::ORows aRows;
@@ -481,7 +478,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
aRows.push_back(aRow);
}
- pNewPrivRes->setRows(aRows);
+ pNewPrivRes->setRows(std::move(aRows));
}
}
}
@@ -612,8 +609,8 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS
// log the call
if ( m_aLogger.isLoggable( LogLevel::FINEST ) )
{
- OUString sCatalogLog = bCatalog ? sCatalog : OUString( "null" );
- OUString sSchemaLog = bSchema ? _rSchemaPattern : OUString( "null" );
+ OUString sCatalogLog = bCatalog ? sCatalog : u"null"_ustr;
+ OUString sSchemaLog = bSchema ? _rSchemaPattern : u"null"_ustr;
if ( _pOptionalAdditionalString )
m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG4, _pMethodName, sCatalogLog, sSchemaLog, _rLeastPattern, *_pOptionalAdditionalString );
else
diff --git a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx
index 3fb157fb2446..961fd45f5508 100644
--- a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx
+++ b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx
@@ -20,8 +20,6 @@
#include <java/sql/DriverPropertyInfo.hxx>
using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
//************ Class: java.sql.Driver
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index e3cd11cabb90..f99737c8ddfc 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -43,6 +43,7 @@
#include <unotools/confignode.hxx>
#include <strings.hxx>
+#include <utility>
#include <vector>
#include <memory>
@@ -58,8 +59,8 @@ namespace {
struct ClassMapEntry {
ClassMapEntry(
- OUString const & theClassPath, OUString const & theClassName):
- classPath(theClassPath), className(theClassName), classLoader(nullptr),
+ OUString theClassPath, OUString theClassName):
+ classPath(std::move(theClassPath)), className(std::move(theClassName)), classLoader(nullptr),
classObject(nullptr) {}
OUString classPath;
@@ -165,7 +166,7 @@ bool loadClass(
// JVM that are not easily undone). If the pushed ClassMapEntry is
// not used after all (return false, etc.) it will be pruned on next
// call because its classLoader/classObject are null:
- classMapData.map.push_back( ClassMapEntry( classPath, name ) );
+ classMapData.map.emplace_back(classPath, name);
i = std::prev(classMapData.map.end());
}
@@ -238,7 +239,7 @@ bool loadClass(
}
-IMPLEMENT_SERVICE_INFO(java_sql_Connection,"com.sun.star.sdbcx.JConnection","com.sun.star.sdbc.Connection");
+IMPLEMENT_SERVICE_INFO(java_sql_Connection,u"com.sun.star.sdbcx.JConnection"_ustr,u"com.sun.star.sdbc.Connection"_ustr);
//************ Class: java.sql.Connection
@@ -246,11 +247,9 @@ IMPLEMENT_SERVICE_INFO(java_sql_Connection,"com.sun.star.sdbcx.JConnection","com
jclass java_sql_Connection::theClass = nullptr;
java_sql_Connection::java_sql_Connection( const java_sql_Driver& _rDriver )
- :java_lang_Object()
- ,m_xContext( _rDriver.getContext() )
+ :m_xContext( _rDriver.getContext() )
,m_pDriver( &_rDriver )
,m_pDriverobject(nullptr)
- ,m_pDriverClassLoader()
,m_Driver_theClass(nullptr)
,m_aLogger( _rDriver.getLogger() )
,m_bIgnoreDriverPrivileges(true)
@@ -407,7 +406,7 @@ void SAL_CALL java_sql_Connection::setTypeMap( const Reference< css::container::
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setTypeMap", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setTypeMap"_ustr, *this );
}
@@ -436,12 +435,11 @@ Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( )
m_aLogger.log( LogLevel::FINE, STR_LOG_CREATE_STATEMENT );
SDBThreadAttach t;
- java_sql_Statement* pStatement = new java_sql_Statement( t.pEnv, *this );
- Reference< XStatement > xStmt = pStatement;
- m_aStatements.push_back( WeakReferenceHelper( xStmt ) );
+ rtl::Reference<java_sql_Statement> pStatement = new java_sql_Statement( t.pEnv, *this );
+ m_aStatements.emplace_back(Reference< XStatement >(pStatement));
m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, pStatement->getStatementObjectID() );
- return xStmt;
+ return pStatement;
}
Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement( const OUString& sql )
@@ -452,12 +450,11 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement(
SDBThreadAttach t;
- java_sql_PreparedStatement* pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sql );
- Reference< XPreparedStatement > xReturn( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ rtl::Reference<java_sql_PreparedStatement> pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sql );
+ m_aStatements.emplace_back(Reference< XPreparedStatement >( pStatement ));
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, pStatement->getStatementObjectID() );
- return xReturn;
+ return pStatement;
}
Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const OUString& sql )
@@ -468,12 +465,11 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const
SDBThreadAttach t;
- java_sql_CallableStatement* pStatement = new java_sql_CallableStatement( t.pEnv, *this, sql );
- Reference< XPreparedStatement > xStmt( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xStmt));
+ rtl::Reference<java_sql_CallableStatement> pStatement = new java_sql_CallableStatement( t.pEnv, *this, sql );
+ m_aStatements.emplace_back(Reference< XPreparedStatement >( pStatement ));
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, pStatement->getStatementObjectID() );
- return xStmt;
+ return pStatement;
}
OUString SAL_CALL java_sql_Connection::nativeSQL( const OUString& sql )
@@ -525,14 +521,10 @@ Any SAL_CALL java_sql_Connection::getWarnings( )
SQLException aAsException( java_sql_SQLWarning( warn_base, *this ) );
// translate to warning
- SQLWarning aWarning;
- aWarning.Context = aAsException.Context;
- aWarning.Message = aAsException.Message;
- aWarning.SQLState = aAsException.SQLState;
- aWarning.ErrorCode = aAsException.ErrorCode;
- aWarning.NextException = aAsException.NextException;
-
- return makeAny( aWarning );
+ SQLWarning aWarning(aAsException.Message, aAsException.Context, aAsException.SQLState,
+ aAsException.ErrorCode, aAsException.NextException);
+
+ return Any( aWarning );
}
return Any();
@@ -707,7 +699,7 @@ OUString java_sql_Connection::impl_getJavaDriverClassPath_nothrow(const OUString
if ( aNamesRoot.isValid() && aNamesRoot.hasByName( _sDriverClass ) )
{
::utl::OConfigurationNode aRegisterObj = aNamesRoot.openNode( _sDriverClass );
- OSL_VERIFY( aRegisterObj.getNodeValue( "Path" ) >>= sURL );
+ OSL_VERIFY( aRegisterObj.getNodeValue( u"Path"_ustr ) >>= sURL );
}
return sURL;
}
@@ -731,17 +723,17 @@ bool java_sql_Connection::construct(const OUString& url,
Sequence< NamedValue > aSystemProperties;
::comphelper::NamedValueCollection aSettings( info );
- sDriverClass = aSettings.getOrDefault( "JavaDriverClass", sDriverClass );
- sDriverClassPath = aSettings.getOrDefault( "JavaDriverClassPath", sDriverClassPath);
+ sDriverClass = aSettings.getOrDefault( u"JavaDriverClass"_ustr, sDriverClass );
+ sDriverClassPath = aSettings.getOrDefault( u"JavaDriverClassPath"_ustr, sDriverClassPath);
if ( sDriverClassPath.isEmpty() )
sDriverClassPath = impl_getJavaDriverClassPath_nothrow(sDriverClass);
- bAutoRetrievingEnabled = aSettings.getOrDefault( "IsAutoRetrievingEnabled", bAutoRetrievingEnabled );
- sGeneratedValueStatement = aSettings.getOrDefault( "AutoRetrievingStatement", sGeneratedValueStatement );
- m_bIgnoreDriverPrivileges = aSettings.getOrDefault( "IgnoreDriverPrivileges", m_bIgnoreDriverPrivileges );
- m_bIgnoreCurrency = aSettings.getOrDefault( "IgnoreCurrency", m_bIgnoreCurrency );
- aSystemProperties = aSettings.getOrDefault( "SystemProperties", aSystemProperties );
- m_aCatalogRestriction = aSettings.getOrDefault( "ImplicitCatalogRestriction", Any() );
- m_aSchemaRestriction = aSettings.getOrDefault( "ImplicitSchemaRestriction", Any() );
+ bAutoRetrievingEnabled = aSettings.getOrDefault( u"IsAutoRetrievingEnabled"_ustr, bAutoRetrievingEnabled );
+ sGeneratedValueStatement = aSettings.getOrDefault( u"AutoRetrievingStatement"_ustr, sGeneratedValueStatement );
+ m_bIgnoreDriverPrivileges = aSettings.getOrDefault( u"IgnoreDriverPrivileges"_ustr, m_bIgnoreDriverPrivileges );
+ m_bIgnoreCurrency = aSettings.getOrDefault( u"IgnoreCurrency"_ustr, m_bIgnoreCurrency );
+ aSystemProperties = aSettings.getOrDefault( u"SystemProperties"_ustr, aSystemProperties );
+ m_aCatalogRestriction = aSettings.getOrDefault( u"ImplicitCatalogRestriction"_ustr, Any() );
+ m_aSchemaRestriction = aSettings.getOrDefault( u"ImplicitSchemaRestriction"_ustr, Any() );
loadDriverFromProperties( sDriverClass, sDriverClassPath, aSystemProperties );
diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx
index 1d5424389ce7..efbe25272bea 100644
--- a/connectivity/source/drivers/jdbc/JDriver.cxx
+++ b/connectivity/source/drivers/jdbc/JDriver.cxx
@@ -47,7 +47,7 @@ java_sql_Driver::~java_sql_Driver()
OUString SAL_CALL java_sql_Driver::getImplementationName( )
{
- return "com.sun.star.comp.sdbc.JDBCDriver";
+ return u"com.sun.star.comp.sdbc.JDBCDriver"_ustr;
// this name is referenced in the configuration and in the jdbc.xml
// Please take care when changing it.
}
@@ -60,7 +60,7 @@ sal_Bool SAL_CALL java_sql_Driver::supportsService( const OUString& _rServiceNam
Sequence< OUString > SAL_CALL java_sql_Driver::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr };
}
Reference< XConnection > SAL_CALL java_sql_Driver::connect( const OUString& url, const
@@ -68,12 +68,11 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const OUString& url,
{
m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_CONNECTING_URL, url );
- Reference< XConnection > xOut;
+ rtl::Reference< java_sql_Connection > xOut;
if ( acceptsURL(url ) )
{
- java_sql_Connection* pConnection = new java_sql_Connection( *this );
- xOut = pConnection;
- if ( !pConnection->construct(url,info) )
+ xOut = new java_sql_Connection( *this );
+ if ( !xOut->construct(url,info) )
xOut.clear(); // an error occurred and the java driver didn't throw an exception
else
m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_SUCCESS );
@@ -108,109 +107,106 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const
{
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
+ Sequence< OUString > aBooleanValues{ u"false"_ustr, u"true"_ustr };
- Sequence< OUString > aBooleanValues(2);
- aBooleanValues[0] = "false";
- aBooleanValues[1] = "true";
-
- aDriverInfo.push_back(DriverPropertyInfo(
- "JavaDriverClass"
- ,"The JDBC driver class name."
+ return
+ {
+ {
+ u"JavaDriverClass"_ustr
+ ,u"The JDBC driver class name."_ustr
,true
,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "JavaDriverClassPath"
- ,"The class path where to look for the JDBC driver."
+ ,Sequence< OUString >()
+ },
+ {
+ u"JavaDriverClassPath"_ustr
+ ,u"The class path where to look for the JDBC driver."_ustr
,true
- , ""
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "SystemProperties"
- ,"Additional properties to set at java.lang.System before loading the driver."
+ , u""_ustr
+ ,Sequence< OUString >()
+ },
+ {
+ u"SystemProperties"_ustr
+ ,u"Additional properties to set at java.lang.System before loading the driver."_ustr
,true
- , ""
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "ParameterNameSubstitution"
- ,"Change named parameters with '?'."
+ , u""_ustr
+ ,Sequence< OUString >()
+ },
+ {
+ u"ParameterNameSubstitution"_ustr
+ ,u"Change named parameters with '?'."_ustr
,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "IgnoreDriverPrivileges"
- ,"Ignore the privileges from the database driver."
+ ,u"false"_ustr
+ ,aBooleanValues
+ },
+ {
+ u"IgnoreDriverPrivileges"_ustr
+ ,u"Ignore the privileges from the database driver."_ustr
,false
- , "false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "IsAutoRetrievingEnabled"
- ,"Retrieve generated values."
+ , u"false"_ustr
+ ,aBooleanValues
+ },
+ {
+ u"IsAutoRetrievingEnabled"_ustr
+ ,u"Retrieve generated values."_ustr
,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "AutoRetrievingStatement"
- ,"Auto-increment statement."
+ ,u"false"_ustr
+ ,aBooleanValues
+ },
+ {
+ u"AutoRetrievingStatement"_ustr
+ ,u"Auto-increment statement."_ustr
,false
,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "GenerateASBeforeCorrelationName"
- ,"Generate AS before table correlation names."
+ ,Sequence< OUString >()
+ },
+ {
+ u"GenerateASBeforeCorrelationName"_ustr
+ ,u"Generate AS before table correlation names."_ustr
,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "IgnoreCurrency"
- ,"Ignore the currency field from the ResultsetMetaData."
+ ,u"false"_ustr
+ ,aBooleanValues
+ },
+ {
+ u"IgnoreCurrency"_ustr
+ ,u"Ignore the currency field from the ResultsetMetaData."_ustr
,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "EscapeDateTime"
- ,"Escape date time format."
+ ,u"false"_ustr
+ ,aBooleanValues
+ },
+ {
+ u"EscapeDateTime"_ustr
+ ,u"Escape date time format."_ustr
,false
- ,"true"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "TypeInfoSettings"
- ,"Defines how the type info of the database metadata should be manipulated."
+ ,u"true"_ustr
+ ,aBooleanValues
+ },
+ {
+ u"TypeInfoSettings"_ustr
+ ,u"Defines how the type info of the database metadata should be manipulated."_ustr
,false
- ,OUString( )
- ,Sequence< OUString > ())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "ImplicitCatalogRestriction"
- ,"The catalog which should be used in getTables calls, when the caller passed NULL."
+ ,OUString()
+ ,Sequence< OUString > ()
+ },
+ {
+ u"ImplicitCatalogRestriction"_ustr
+ ,u"The catalog which should be used in getTables calls, when the caller passed NULL."_ustr
,false
,OUString( )
- ,Sequence< OUString > ())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "ImplicitSchemaRestriction"
- ,"The schema which should be used in getTables calls, when the caller passed NULL."
+ ,Sequence< OUString > ()
+ },
+ {
+ u"ImplicitSchemaRestriction"_ustr
+ ,u"The schema which should be used in getTables calls, when the caller passed NULL."_ustr
,false
,OUString( )
- ,Sequence< OUString > ())
- );
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ ,Sequence< OUString > ()
+ }
+ };
}
::connectivity::SharedResources aResources;
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
}
sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( )
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx
index 147e09c0f362..da53ee7f50bb 100644
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ b/connectivity/source/drivers/jdbc/JStatement.cxx
@@ -31,7 +31,7 @@
#include <comphelper/sequence.hxx>
#include <TConnection.hxx>
#include <comphelper/types.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
@@ -124,9 +124,10 @@ Sequence< Type > SAL_CALL java_sql_Statement_Base::getTypes( )
Sequence< Type > aOldTypes = java_sql_Statement_BASE::getTypes();
if ( m_pConnection.is() && !m_pConnection->isAutoRetrievingEnabled() )
{
- auto newEnd = std::remove(aOldTypes.begin(), aOldTypes.end(),
+ auto [begin, end] = asNonConstRange(aOldTypes);
+ auto newEnd = std::remove(begin, end,
cppu::UnoType<XGeneratedResultSet>::get());
- aOldTypes.realloc(std::distance(aOldTypes.begin(), newEnd));
+ aOldTypes.realloc(std::distance(begin, newEnd));
}
return ::comphelper::concatSequences(aTypes.getTypes(),aOldTypes);
@@ -279,7 +280,7 @@ Reference< XConnection > SAL_CALL java_sql_Statement_Base::getConnection( )
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
@@ -377,9 +378,9 @@ Any SAL_CALL java_sql_Statement_Base::getWarnings( )
if( out )
{
java_sql_SQLWarning_BASE warn_base( t.pEnv, out );
- return makeAny(
+ return Any(
static_cast< css::sdbc::SQLException >(
- java_sql_SQLWarning(warn_base,*static_cast<cppu::OWeakObject*>(this))));
+ java_sql_SQLWarning(warn_base,getXWeak())));
}
return Any();
@@ -575,31 +576,71 @@ void java_sql_Statement_Base::setCursorName(const OUString &_par0)
::cppu::IPropertyArrayHelper* java_sql_Statement_Base::createArrayHelper( ) const
{
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
- PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
- PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
- PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
- PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
- PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
+ PROPERTY_ID_ESCAPEPROCESSING,
+ cppu::UnoType<bool>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
+ PROPERTY_ID_MAXFIELDSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
+ PROPERTY_ID_MAXROWS,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
+ PROPERTY_ID_QUERYTIMEOUT,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
+ PROPERTY_ID_USEBOOKMARKS,
+ cppu::UnoType<bool>::get(),
+ 0
+ }
+ }
+ };
}
@@ -792,24 +833,24 @@ void java_sql_Statement::createStatement(JNIEnv* _pEnv)
}
-IMPLEMENT_SERVICE_INFO(java_sql_Statement,"com.sun.star.sdbcx.JStatement","com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(java_sql_Statement,u"com.sun.star.sdbcx.JStatement"_ustr,u"com.sun.star.sdbc.Statement"_ustr);
-void SAL_CALL java_sql_Statement_Base::acquire() throw()
+void SAL_CALL java_sql_Statement_Base::acquire() noexcept
{
java_sql_Statement_BASE::acquire();
}
-void SAL_CALL java_sql_Statement_Base::release() throw()
+void SAL_CALL java_sql_Statement_Base::release() noexcept
{
java_sql_Statement_BASE::release();
}
-void SAL_CALL java_sql_Statement::acquire() throw()
+void SAL_CALL java_sql_Statement::acquire() noexcept
{
OStatement_BASE2::acquire();
}
-void SAL_CALL java_sql_Statement::release() throw()
+void SAL_CALL java_sql_Statement::release() noexcept
{
OStatement_BASE2::release();
}
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index 479699750e07..65d6680d745e 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -29,13 +29,9 @@
#include <comphelper/logging.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <memory>
-
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
@@ -170,22 +166,22 @@ namespace
if ( _pEnvironment->IsInstanceOf( jThrow, java_sql_SQLException_BASE::st_getMyClass() ) )
{
- std::unique_ptr< java_sql_SQLException_BASE > pException( new java_sql_SQLException_BASE( _pEnvironment, jThrow ) );
- _out_rException = SQLException( pException->getMessage(), _rxContext,
- pException->getSQLState(), pException->getErrorCode(), Any() );
+ java_sql_SQLException_BASE aException( _pEnvironment, jThrow );
+ _out_rException = SQLException( aException.getMessage(), _rxContext,
+ aException.getSQLState(), aException.getErrorCode(), Any() );
return true;
}
else if ( _pEnvironment->IsInstanceOf( jThrow, java_lang_Throwable::st_getMyClass() ) )
{
- std::unique_ptr< java_lang_Throwable > pThrow( new java_lang_Throwable( _pEnvironment, jThrow ) );
+ java_lang_Throwable aThrow( _pEnvironment, jThrow );
#if OSL_DEBUG_LEVEL > 0
- pThrow->printStackTrace();
+ aThrow.printStackTrace();
#endif
- OUString sMessage = pThrow->getMessage();
+ OUString sMessage = aThrow.getMessage();
if ( sMessage.isEmpty() )
- sMessage = pThrow->getLocalizedMessage();
+ sMessage = aThrow.getLocalizedMessage();
if( sMessage.isEmpty() )
- sMessage = pThrow->toString();
+ sMessage = aThrow.toString();
_out_rException = SQLException( sMessage, _rxContext, OUString(), -1, Any() );
return true;
}
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 083f1917e72a..65ff309c019c 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -40,7 +40,6 @@
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
@@ -48,7 +47,7 @@ using namespace ::com::sun::star::lang;
//************ Class: java.sql.PreparedStatement
-IMPLEMENT_SERVICE_INFO(java_sql_PreparedStatement,"com.sun.star.sdbcx.JPreparedStatement","com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(java_sql_PreparedStatement,u"com.sun.star.sdbcx.JPreparedStatement"_ustr,u"com.sun.star.sdbc.PreparedStatement"_ustr);
java_sql_PreparedStatement::java_sql_PreparedStatement( JNIEnv * pEnv, java_sql_Connection& _rCon, const OUString& sql )
: OStatement_BASE2( pEnv, _rCon )
@@ -143,7 +142,7 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c
css::uno::Reference< css::sdbc::XConnection > SAL_CALL java_sql_PreparedStatement::getConnection( )
{
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
@@ -296,25 +295,25 @@ void SAL_CALL java_sql_PreparedStatement::setNull( sal_Int32 parameterIndex, sal
void SAL_CALL java_sql_PreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const css::uno::Reference< css::sdbc::XClob >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setClob", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setClob"_ustr, *this );
}
void SAL_CALL java_sql_PreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const css::uno::Reference< css::sdbc::XBlob >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setBlob", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setBlob"_ustr, *this );
}
void SAL_CALL java_sql_PreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const css::uno::Reference< css::sdbc::XArray >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setArray", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setArray"_ustr, *this );
}
void SAL_CALL java_sql_PreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const css::uno::Reference< css::sdbc::XRef >& /*x*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setRef", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XParameters::setRef"_ustr, *this );
}
@@ -354,7 +353,7 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter
{
ORowSetValue aValue;
aValue.fill(x);
- const OUString sValue = aValue;
+ const OUString sValue = aValue.getString();
if ( !sValue.isEmpty() )
pBigDecimal.reset(new java_math_BigDecimal(sValue));
else
@@ -640,12 +639,12 @@ css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL java_sql_PreparedS
return out==nullptr ? nullptr : new java_sql_ResultSetMetaData( t.pEnv, out, *m_pConnection );
}
-void SAL_CALL java_sql_PreparedStatement::acquire() throw()
+void SAL_CALL java_sql_PreparedStatement::acquire() noexcept
{
OStatement_BASE2::acquire();
}
-void SAL_CALL java_sql_PreparedStatement::release() throw()
+void SAL_CALL java_sql_PreparedStatement::release() noexcept
{
OStatement_BASE2::release();
}
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index 0144ea5fd87b..e88fb9600138 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -58,7 +58,7 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-IMPLEMENT_SERVICE_INFO(java_sql_ResultSet,"com.sun.star.sdbcx.JResultSet","com.sun.star.sdbc.ResultSet");
+IMPLEMENT_SERVICE_INFO(java_sql_ResultSet,u"com.sun.star.sdbcx.JResultSet"_ustr,u"com.sun.star.sdbc.ResultSet"_ustr);
//************ Class: java.sql.ResultSet
@@ -74,7 +74,7 @@ java_sql_ResultSet::java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java
SDBThreadAttach::addRef();
osl_atomic_increment(&m_refCount);
if ( pStmt )
- m_xStatement = *pStmt;
+ m_xStatement = pStmt;
osl_atomic_decrement(&m_refCount);
}
@@ -104,7 +104,8 @@ void java_sql_ResultSet::disposing()
::osl::MutexGuard aGuard(m_aMutex);
if( object )
{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
+ SDBThreadAttach t;
+ assert(t.pEnv && "Java environment has been deleted!");
static jmethodID mID(nullptr);
callVoidMethod_ThrowSQL("close", mID);
clearObject(*t.pEnv);
@@ -451,7 +452,7 @@ sal_Bool SAL_CALL java_sql_ResultSet::previous( )
Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement( )
{
- return m_xStatement;
+ return cppu::getXWeak(m_xStatement.get());
}
@@ -514,7 +515,7 @@ css::uno::Any SAL_CALL java_sql_ResultSet::getWarnings( )
if( out )
{
java_sql_SQLWarning_BASE warn_base( t.pEnv, out );
- return makeAny(
+ return Any(
static_cast< css::sdbc::SQLException >(
java_sql_SQLWarning(warn_base,*this)));
}
@@ -730,7 +731,7 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con
catch(const Exception&)
{
Any anyEx = ::cppu::getCaughtException();
- ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateBinaryStream", *this, anyEx );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XRowUpdate::updateBinaryStream"_ustr, *this, anyEx );
}
}
@@ -762,7 +763,7 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex,
catch(const Exception&)
{
Any anyEx = ::cppu::getCaughtException();
- ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateCharacterStream", *this, anyEx );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XRowUpdate::updateCharacterStream"_ustr, *this, anyEx );
}
}
@@ -873,25 +874,41 @@ void java_sql_ResultSet::setFetchSize(sal_Int32 _par0)
::cppu::IPropertyArrayHelper* java_sql_ResultSet::createArrayHelper( ) const
{
- Sequence< Property > aProps(5);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY
+ }
+ }
+ };
}
::cppu::IPropertyArrayHelper & java_sql_ResultSet::getInfoHelper()
@@ -978,12 +995,12 @@ void java_sql_ResultSet::getFastPropertyValue(
}
}
-void SAL_CALL java_sql_ResultSet::acquire() throw()
+void SAL_CALL java_sql_ResultSet::acquire() noexcept
{
java_sql_ResultSet_BASE::acquire();
}
-void SAL_CALL java_sql_ResultSet::release() throw()
+void SAL_CALL java_sql_ResultSet::release() noexcept
{
java_sql_ResultSet_BASE::release();
}
diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
index fdf5bfe69c29..b5827ea991e7 100644
--- a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
@@ -21,10 +21,7 @@
#include <java/sql/Connection.hxx>
using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
diff --git a/connectivity/source/drivers/jdbc/SQLException.cxx b/connectivity/source/drivers/jdbc/SQLException.cxx
index 55bf0996c941..49fa95c456d5 100644
--- a/connectivity/source/drivers/jdbc/SQLException.cxx
+++ b/connectivity/source/drivers/jdbc/SQLException.cxx
@@ -22,7 +22,6 @@
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
//************ Class: java.sql.SQLException
@@ -31,7 +30,7 @@ java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE&
_rContext,
_rException.getSQLState(),
_rException.getErrorCode(),
- makeAny(_rException.getNextException())
+ Any(_rException.getNextException())
)
{
}
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index 4a4d5069ea18..ad133ee5726d 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -32,7 +32,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
void java_util_Properties::setProperty(const OUString& key, const OUString& value)
{
@@ -182,7 +181,7 @@ jobject connectivity::convertTypeMapToJavaMap(const Reference< css::container::X
{
css::uno::Sequence< OUString > aNames = _rMap->getElementNames();
if ( aNames.hasElements() )
- ::dbtools::throwFeatureNotImplementedSQLException( "Type maps", nullptr );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"Type maps"_ustr, nullptr );
}
return nullptr;
}
diff --git a/connectivity/source/drivers/macab/MacabAddressBook.cxx b/connectivity/source/drivers/macab/MacabAddressBook.cxx
index a14b7abee9b9..7ade1ac0a830 100644
--- a/connectivity/source/drivers/macab/MacabAddressBook.cxx
+++ b/connectivity/source/drivers/macab/MacabAddressBook.cxx
@@ -82,6 +82,13 @@ MacabAddressBook::MacabAddressBook( )
m_xMacabRecords(nullptr),
m_bRetrievedGroups(false)
{
+ if(m_aAddressBook == nullptr)
+ {
+ // TODO: tell the user to reset the permission via "tccutil reset AddressBook"
+ // or the system preferences and try again, this time granting the access
+ throw RuntimeException(
+ "failed to access the macOS address book - permission not granted?" );
+ }
}
@@ -106,8 +113,8 @@ MacabAddressBook::~MacabAddressBook()
const OUString & MacabAddressBook::getDefaultTableName()
{
/* This string probably needs to be localized. */
- static const OUString aDefaultTableName
- (OUString("Address Book"));
+ static constexpr OUString aDefaultTableName
+ (u"Address Book"_ustr);
return aDefaultTableName;
}
diff --git a/connectivity/source/drivers/macab/MacabAddressBook.hxx b/connectivity/source/drivers/macab/MacabAddressBook.hxx
index 23fec939f701..a12ba6c5be12 100644
--- a/connectivity/source/drivers/macab/MacabAddressBook.hxx
+++ b/connectivity/source/drivers/macab/MacabAddressBook.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABADDRESSBOOK_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABADDRESSBOOK_HXX
+#pragma once
#include "MacabRecords.hxx"
#include "MacabGroup.hxx"
@@ -33,31 +32,29 @@
namespace connectivity::macab
{
- class MacabAddressBook
- {
- protected:
- ABAddressBookRef m_aAddressBook;
- MacabRecords *m_xMacabRecords;
- std::vector<MacabGroup *> m_xMacabGroups;
- bool m_bRetrievedGroups;
+ class MacabAddressBook
+ {
+ protected:
+ ABAddressBookRef m_aAddressBook;
+ MacabRecords *m_xMacabRecords;
+ std::vector<MacabGroup *> m_xMacabGroups;
+ bool m_bRetrievedGroups;
- public:
- MacabAddressBook();
- ~MacabAddressBook();
- static const OUString & getDefaultTableName();
+ public:
+ MacabAddressBook();
+ ~MacabAddressBook();
+ static const OUString & getDefaultTableName();
- MacabRecords *getMacabRecords();
- std::vector<MacabGroup *> getMacabGroups();
+ MacabRecords *getMacabRecords();
+ std::vector<MacabGroup *> getMacabGroups();
- MacabGroup *getMacabGroup(std::u16string_view _groupName);
- MacabRecords *getMacabRecords(std::u16string_view _tableName);
+ MacabGroup *getMacabGroup(std::u16string_view _groupName);
+ MacabRecords *getMacabRecords(std::u16string_view _tableName);
- MacabGroup *getMacabGroupMatch(const OUString& _groupName);
- MacabRecords *getMacabRecordsMatch(const OUString& _tableName);
- };
+ MacabGroup *getMacabGroupMatch(const OUString& _groupName);
+ MacabRecords *getMacabRecordsMatch(const OUString& _tableName);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABADDRESSBOOK_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabCatalog.cxx b/connectivity/source/drivers/macab/MacabCatalog.cxx
index 96ff62fd5b6a..d6485ab1c971 100644
--- a/connectivity/source/drivers/macab/MacabCatalog.cxx
+++ b/connectivity/source/drivers/macab/MacabCatalog.cxx
@@ -80,7 +80,7 @@ void MacabCatalog::refreshUsers()
const OUString& MacabCatalog::getDot()
{
- static const OUString sDot = ".";
+ static constexpr OUString sDot = u"."_ustr;
return sDot;
}
diff --git a/connectivity/source/drivers/macab/MacabCatalog.hxx b/connectivity/source/drivers/macab/MacabCatalog.hxx
index 88aad76bede3..8a12125b1284 100644
--- a/connectivity/source/drivers/macab/MacabCatalog.hxx
+++ b/connectivity/source/drivers/macab/MacabCatalog.hxx
@@ -17,38 +17,35 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCATALOG_HXX
+#pragma once
#include <sdbcx/VCatalog.hxx>
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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCATALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabColumns.cxx b/connectivity/source/drivers/macab/MacabColumns.cxx
index 6eaa51aa7906..ef6c0a6d255f 100644
--- a/connectivity/source/drivers/macab/MacabColumns.cxx
+++ b/connectivity/source/drivers/macab/MacabColumns.cxx
@@ -36,7 +36,7 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-sdbcx::ObjectType MacabColumns::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > MacabColumns::createObject(const OUString& _rName)
{
const Any aCatalog;
const OUString sCatalogName;
@@ -45,7 +45,7 @@ sdbcx::ObjectType MacabColumns::createObject(const OUString& _rName)
Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(
aCatalog, sSchemaName, sTableName, _rName);
- sdbcx::ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
if (xResult.is())
{
Reference< XRow > xRow(xResult,UNO_QUERY);
@@ -54,7 +54,7 @@ sdbcx::ObjectType MacabColumns::createObject(const OUString& _rName)
{
if (xRow->getString(4) == _rName)
{
- OColumn* pRet = new OColumn(
+ xRet = new OColumn(
_rName,
xRow->getString(6),
xRow->getString(13),
@@ -70,7 +70,6 @@ sdbcx::ObjectType MacabColumns::createObject(const OUString& _rName)
sCatalogName,
sSchemaName,
sTableName);
- xRet = pRet;
break;
}
}
diff --git a/connectivity/source/drivers/macab/MacabColumns.hxx b/connectivity/source/drivers/macab/MacabColumns.hxx
index 1a85da155d62..1da4021734c3 100644
--- a/connectivity/source/drivers/macab/MacabColumns.hxx
+++ b/connectivity/source/drivers/macab/MacabColumns.hxx
@@ -17,29 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCOLUMNS_HXX
+#pragma once
#include "MacabTable.hxx"
#include <connectivity/sdbcx/VCollection.hxx>
namespace connectivity::macab
{
- class MacabColumns : public sdbcx::OCollection
- {
- protected:
- MacabTable* m_pTable;
+ class MacabColumns : public sdbcx::OCollection
+ {
+ protected:
+ MacabTable* m_pTable;
- virtual sdbcx::ObjectType 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCOLUMNS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabConnection.cxx b/connectivity/source/drivers/macab/MacabConnection.cxx
index 4e5a27354e54..eaa6cf523222 100644
--- a/connectivity/source/drivers/macab/MacabConnection.cxx
+++ b/connectivity/source/drivers/macab/MacabConnection.cxx
@@ -27,6 +27,7 @@
#include "MacabCatalog.hxx"
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+#include <cppuhelper/weak.hxx>
using namespace connectivity::macab;
using namespace com::sun::star::uno;
@@ -295,8 +296,7 @@ Reference< XTablesSupplier > MacabConnection::createCatalog()
Reference< XTablesSupplier > xTab = m_xCatalog;
if (!m_xCatalog.is())
{
- MacabCatalog *pCat = new MacabCatalog(this);
- xTab = pCat;
+ xTab = new MacabCatalog(this);
m_xCatalog = xTab;
}
return xTab;
@@ -309,10 +309,8 @@ MacabAddressBook* MacabConnection::getAddressBook() const
extern "C" SAL_DLLPUBLIC_EXPORT void* createMacabConnection( void* _pDriver )
{
- MacabConnection* pConnection = new MacabConnection( static_cast< MacabDriver* >( _pDriver ) );
// by definition, the pointer crossing library boundaries as void ptr is acquired once
- pConnection->acquire();
- return pConnection;
+ return cppu::acquire(new MacabConnection( static_cast< MacabDriver* >( _pDriver ) ));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabConnection.hxx b/connectivity/source/drivers/macab/MacabConnection.hxx
index 73ee0a731a76..b9fa3c58e23e 100644
--- a/connectivity/source/drivers/macab/MacabConnection.hxx
+++ b/connectivity/source/drivers/macab/MacabConnection.hxx
@@ -17,13 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONNECTION_HXX
+#pragma once
-#include <map>
#include <connectivity/CommonTools.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
@@ -33,83 +30,79 @@
namespace connectivity::macab
{
- typedef ::cppu::WeakComponentImplHelper<css::sdbc::XConnection,
- css::sdbc::XWarningsSupplier,
- css::lang::XServiceInfo
- > OMetaConnection_BASE;
-
- class MacabDriver;
- class MacabAddressBook;
-
- typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray;
-
- 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONNECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
index 540e333aa639..b0b04fc08f21 100644
--- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
@@ -30,7 +30,9 @@
#include <com/sun/star/sdbc/ColumnSearch.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+#include <rtl/ref.hxx>
#include <vector>
@@ -729,15 +731,14 @@ sal_Bool SAL_CALL MacabDatabaseMetaData::supportsBatchUpdates( )
Reference< XConnection > SAL_CALL MacabDatabaseMetaData::getConnection( )
{
- return m_xConnection.get();
+ return m_xConnection;
}
Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTableTypes( )
{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- static ODatabaseMetaDataResultSet::ORows aRows = [&]
+ static ODatabaseMetaDataResultSet::ORows aRows = []
{
static constexpr OUStringLiteral aTable = u"TABLE";
ODatabaseMetaDataResultSet::ORows tmp;
@@ -747,16 +748,15 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTableTypes( )
tmp.push_back(aRow);
return tmp;
}();
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::vector(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTypeInfo( )
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
- static ODatabaseMetaDataResultSet::ORows aRows = [&]()
+ static ODatabaseMetaDataResultSet::ORows aRows = []()
{
ODatabaseMetaDataResultSet::ORows tmp;
ODatabaseMetaDataResultSet::ORow aRow(19);
@@ -805,8 +805,8 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTypeInfo( )
return tmp;
}();
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::vector(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCatalogs( )
@@ -832,8 +832,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns(
const OUString& tableNamePattern,
const OUString& columnNamePattern)
{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
MacabRecords *aRecords;
OUString sTableName;
@@ -909,8 +908,8 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns(
}
}
}
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
@@ -919,13 +918,12 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
const OUString&,
const Sequence< OUString >& types)
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
// check whether we have tables in the requested types
// for the moment, we answer only the "TABLE" table type
// when no types are given at all, we return all the tables
- static constexpr OUStringLiteral aTable = u"TABLE";
+ static constexpr OUString aTable = u"TABLE"_ustr;
bool bTableFound = false;
const OUString* p = types.getConstArray(),
* pEnd = p + types.getLength();
@@ -944,7 +942,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
p++;
}
if (!bTableFound)
- return xRef;
+ return pResult;
static ODatabaseMetaDataResultSet::ORows aRows = [&]()
{
@@ -960,7 +958,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
aRow[3] = new ORowSetValueDecorator(xRecords->getName());
- aRow[4] = new ORowSetValueDecorator(OUString(aTable));
+ aRow[4] = new ORowSetValueDecorator(aTable);
aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
tmp.push_back(aRow);
@@ -971,8 +969,8 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
}
return tmp;
}();
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::vector(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedureColumns(
@@ -992,8 +990,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedures(
Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getVersionColumns(
const Any&, const OUString&, const OUString& table )
{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
ODatabaseMetaDataResultSet::ORows aRows;
@@ -1016,8 +1013,8 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getVersionColumns(
aRows.push_back(aRow);
}
- pResult->setRows(aRows);
- return xRef;
+ pResult->setRows(std::move(aRows));
+ return pResult;
}
Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getExportedKeys(
diff --git a/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx
index 46cb6769bf0e..d5d127fa1025 100644
--- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx
+++ b/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABDATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABDATABASEMETADATA_HXX
+#pragma once
#include "MacabConnection.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -27,172 +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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABDATABASEMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx
index 4667c690a8b1..04caae0609a9 100644
--- a/connectivity/source/drivers/macab/MacabDriver.cxx
+++ b/connectivity/source/drivers/macab/MacabDriver.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/lang/NullPointerException.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <strings.hrc>
#include <cppuhelper/supportsservice.hxx>
@@ -115,7 +115,7 @@ bool MacabImplModule::impl_loadModule()
OSL_ENSURE( !m_hConnectorModule && !m_pConnectionFactoryFunc,
"MacabImplModule::impl_loadModule: inconsistence: inconsistency (never attempted load before, but some values already set)!");
- const OUString sModuleName( SAL_MODULENAME( "macabdrv1" ) );
+ static constexpr OUString sModuleName( u"" SAL_MODULENAME( "macabdrv1" ) ""_ustr );
m_hConnectorModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, SAL_LOADMODULE_NOW ); // LAZY! #i61335#
OSL_ENSURE( m_hConnectorModule, "MacabImplModule::impl_loadModule: could not load the implementation library!" );
if ( !m_hConnectorModule )
diff --git a/connectivity/source/drivers/macab/MacabDriver.hxx b/connectivity/source/drivers/macab/MacabDriver.hxx
index ca7707228164..f12db3514acd 100644
--- a/connectivity/source/drivers/macab/MacabDriver.hxx
+++ b/connectivity/source/drivers/macab/MacabDriver.hxx
@@ -17,12 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABDRIVER_HXX
+#pragma once
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/compbase.hxx>
@@ -35,131 +33,129 @@
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;
+ // 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
+ // 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();
- };
+ @precond our mutex is locked
+ */
+ void impl_shutdownImplementationModule();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABDRIVER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabGroup.hxx b/connectivity/source/drivers/macab/MacabGroup.hxx
index 65240661b138..a6379dda2a57 100644
--- a/connectivity/source/drivers/macab/MacabGroup.hxx
+++ b/connectivity/source/drivers/macab/MacabGroup.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABGROUP_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABGROUP_HXX
+#pragma once
#include "MacabRecords.hxx"
@@ -30,12 +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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABGROUP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabHeader.cxx b/connectivity/source/drivers/macab/MacabHeader.cxx
index 46f0c177d3fc..da270dd05ac8 100644
--- a/connectivity/source/drivers/macab/MacabHeader.cxx
+++ b/connectivity/source/drivers/macab/MacabHeader.cxx
@@ -290,10 +290,6 @@ MacabHeader::iterator::iterator ()
}
-MacabHeader::iterator::~iterator ()
-{
-}
-
MacabHeader::iterator& MacabHeader::iterator::operator= (MacabHeader *_record)
{
id = 0;
diff --git a/connectivity/source/drivers/macab/MacabHeader.hxx b/connectivity/source/drivers/macab/MacabHeader.hxx
index 839a755fb6f1..2c110990e985 100644
--- a/connectivity/source/drivers/macab/MacabHeader.hxx
+++ b/connectivity/source/drivers/macab/MacabHeader.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABHEADER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABHEADER_HXX
+#pragma once
#include <sal/config.h>
@@ -28,38 +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();
- ~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;
+ };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABHEADER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx b/connectivity/source/drivers/macab/MacabPreparedStatement.cxx
index cbb3dc75608c..6d72345b6021 100644
--- a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx
+++ b/connectivity/source/drivers/macab/MacabPreparedStatement.cxx
@@ -78,7 +78,7 @@ void MacabPreparedStatement::getNextParameter(OUString &rParameter) const
::dbtools::throwGenericSQLException(sError,*const_cast<MacabPreparedStatement *>(this));
}
- rParameter = (*m_aParameterRow)[m_nParameterIndex];
+ rParameter = (*m_aParameterRow)[m_nParameterIndex].getString();
m_nParameterIndex++;
}
@@ -131,7 +131,7 @@ Reference< XResultSetMetaData > SAL_CALL MacabPreparedStatement::getMetaData()
m_xMetaData = new MacabResultSetMetaData(getOwnConnection(),sTableName);
setMacabFields();
}
- Reference< XResultSetMetaData > xMetaData = m_xMetaData.get();
+ Reference< XResultSetMetaData > xMetaData = m_xMetaData;
return xMetaData;
}
diff --git a/connectivity/source/drivers/macab/MacabPreparedStatement.hxx b/connectivity/source/drivers/macab/MacabPreparedStatement.hxx
index 42c401efb1dd..1a759800b509 100644
--- a/connectivity/source/drivers/macab/MacabPreparedStatement.hxx
+++ b/connectivity/source/drivers/macab/MacabPreparedStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABPREPAREDSTATEMENT_HXX
+#pragma once
#include "MacabStatement.hxx"
#include "MacabResultSetMetaData.hxx"
@@ -29,86 +28,84 @@
namespace connectivity::macab
{
- 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;
-
- /// @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;
-
- 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);
-
- // OComponentHelper
- virtual void SAL_CALL disposing() override;
-
- // 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;
-
- // 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;
- };
+ 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;
+
+ /// @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;
+
+ 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);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ // 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;
+
+ // 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABPREPAREDSTATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabRecord.hxx b/connectivity/source/drivers/macab/MacabRecord.hxx
index 3183ec9109e1..93d41ee92c35 100644
--- a/connectivity/source/drivers/macab/MacabRecord.hxx
+++ b/connectivity/source/drivers/macab/MacabRecord.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORD_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORD_HXX
+#pragma once
#include <sal/config.h>
@@ -35,40 +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);
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORD_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx
index 737cdee7d6f8..07d462425e65 100644
--- a/connectivity/source/drivers/macab/MacabRecords.cxx
+++ b/connectivity/source/drivers/macab/MacabRecords.cxx
@@ -344,7 +344,7 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records,
/* While searching through the properties for required properties, these
* sal_Bools will keep track of what we have found.
*/
- bool bFoundRequiredProperties[requiredProperties.size()];
+ auto const bFoundRequiredProperties = std::make_unique<bool[]>(requiredProperties.size());
/* We have three MacabHeaders: headerDataForProperty is where we
@@ -530,34 +530,34 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert
*/
if(_propertyValue != nullptr)
{
- sal_Int32 i;
+ sal_Int32 i;
- sal_Int32 multiLength = ABMultiValueCount(static_cast<ABMutableMultiValueRef>(const_cast<void *>(_propertyValue)));
- CFStringRef multiLabel, localizedMultiLabel;
- OUString multiLabelString;
- OUString multiPropertyString;
- OUString headerNameString;
- ABPropertyType multiType = static_cast<ABPropertyType>(ABMultiValuePropertyType(static_cast<ABMutableMultiValueRef>(const_cast<void *>(_propertyValue))) - 0x100);
+ sal_Int32 multiLength = ABMultiValueCount(static_cast<ABMutableMultiValueRef>(const_cast<void *>(_propertyValue)));
+ CFStringRef multiLabel, localizedMultiLabel;
+ OUString multiLabelString;
+ OUString multiPropertyString;
+ OUString headerNameString;
+ ABPropertyType multiType = static_cast<ABPropertyType>(ABMultiValuePropertyType(static_cast<ABMutableMultiValueRef>(const_cast<void *>(_propertyValue))) - 0x100);
- length = multiLength;
- headerNames = new macabfield *[multiLength];
- multiPropertyString = CFStringToOUString(_propertyName);
+ length = multiLength;
+ headerNames = new macabfield *[multiLength];
+ multiPropertyString = CFStringToOUString(_propertyName);
- /* Go through each element, and - since each element is a scalar -
- * just create a new macabfield for it.
- */
- for(i = 0; i < multiLength; i++)
- {
- multiLabel = ABMultiValueCopyLabelAtIndex(static_cast<ABMutableMultiValueRef>(const_cast<void *>(_propertyValue)), i);
- localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel);
- multiLabelString = CFStringToOUString(localizedMultiLabel);
- CFRelease(multiLabel);
- CFRelease(localizedMultiLabel);
- headerNameString = multiPropertyString + ": " + fixLabel(multiLabelString);
- headerNames[i] = new macabfield;
- headerNames[i]->value = OUStringToCFString(headerNameString);
- headerNames[i]->type = multiType;
- }
+ /* Go through each element, and - since each element is a scalar -
+ * just create a new macabfield for it.
+ */
+ for(i = 0; i < multiLength; i++)
+ {
+ multiLabel = ABMultiValueCopyLabelAtIndex(static_cast<ABMutableMultiValueRef>(const_cast<void *>(_propertyValue)), i);
+ localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel);
+ multiLabelString = CFStringToOUString(localizedMultiLabel);
+ CFRelease(multiLabel);
+ CFRelease(localizedMultiLabel);
+ headerNameString = multiPropertyString + ": " + fixLabel(multiLabelString);
+ headerNames[i] = new macabfield;
+ headerNames[i]->value = OUStringToCFString(headerNameString);
+ headerNames[i]->type = multiType;
+ }
}
break;
@@ -653,77 +653,77 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert
*/
if(_propertyValue != nullptr)
{
- /* Assume all keys are strings */
- sal_Int32 numRecords = static_cast<sal_Int32>(CFDictionaryGetCount(static_cast<CFDictionaryRef>(_propertyValue)));
+ /* Assume all keys are strings */
+ sal_Int32 numRecords = static_cast<sal_Int32>(CFDictionaryGetCount(static_cast<CFDictionaryRef>(_propertyValue)));
- /* The only method for getting info out of a CFDictionary, of both
- * keys and values, is to all of them all at once, so these
- * variables will hold them.
- */
- CFStringRef *dictKeys;
- CFTypeRef *dictValues;
-
- sal_Int32 i,j,k;
- OUString dictKeyString, propertyNameString;
- ABPropertyType dictType;
- MacabHeader **dictHeaders = new MacabHeader *[numRecords];
- OUString dictLabelString;
- CFStringRef dictLabel, localizedDictKey;
-
- /* Get the keys and values */
- dictKeys = static_cast<CFStringRef *>(malloc(sizeof(CFStringRef)*numRecords));
- dictValues = static_cast<CFTypeRef *>(malloc(sizeof(CFTypeRef)*numRecords));
- CFDictionaryGetKeysAndValues(static_cast<CFDictionaryRef>(_propertyValue), reinterpret_cast<const void **>(dictKeys), dictValues);
-
- propertyNameString = CFStringToOUString(_propertyName);
-
- length = 0;
- /* Go through each element - assuming that the key is a string but
- * that the value could be anything. Since the value could be
- * anything, we can't assume that it is scalar (it could even be
- * another dictionary), so we attempt to get its type using
- * the method getABTypeFromCFType and then run this method
- * recursively on that element, storing the MacabHeader that
- * results. Then, we just combine all of the MacabHeaders into
- * one.
- */
- for(i = 0; i < numRecords; i++)
- {
- dictType = getABTypeFromCFType( CFGetTypeID(dictValues[i]) );
- localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]);
- dictKeyString = CFStringToOUString(localizedDictKey);
- dictLabelString = propertyNameString + ": " + fixLabel(dictKeyString);
- dictLabel = OUStringToCFString(dictLabelString);
- dictHeaders[i] = createHeaderForProperty(dictType, dictValues[i], dictLabel);
- if (!dictHeaders[i])
- dictHeaders[i] = new MacabHeader();
- length += dictHeaders[i]->getSize();
- CFRelease(dictLabel);
- CFRelease(localizedDictKey);
- }
+ /* The only method for getting info out of a CFDictionary, of both
+ * keys and values, is to all of them all at once, so these
+ * variables will hold them.
+ */
+ CFStringRef *dictKeys;
+ CFTypeRef *dictValues;
- /* Combine all of the macabfields in each MacabHeader into the
- * headerNames array, which (at the end of this method) is used
- * to create the MacabHeader that is returned.
- */
- headerNames = new macabfield *[length];
- for(i = 0, j = 0, k = 0; i < length; i++,k++)
- {
- while(dictHeaders[j]->getSize() == k)
+ sal_Int32 i,j,k;
+ OUString dictKeyString, propertyNameString;
+ ABPropertyType dictType;
+ MacabHeader **dictHeaders = new MacabHeader *[numRecords];
+ OUString dictLabelString;
+ CFStringRef dictLabel, localizedDictKey;
+
+ /* Get the keys and values */
+ dictKeys = static_cast<CFStringRef *>(malloc(sizeof(CFStringRef)*numRecords));
+ dictValues = static_cast<CFTypeRef *>(malloc(sizeof(CFTypeRef)*numRecords));
+ CFDictionaryGetKeysAndValues(static_cast<CFDictionaryRef>(_propertyValue), reinterpret_cast<const void **>(dictKeys), dictValues);
+
+ propertyNameString = CFStringToOUString(_propertyName);
+
+ length = 0;
+ /* Go through each element - assuming that the key is a string but
+ * that the value could be anything. Since the value could be
+ * anything, we can't assume that it is scalar (it could even be
+ * another dictionary), so we attempt to get its type using
+ * the method getABTypeFromCFType and then run this method
+ * recursively on that element, storing the MacabHeader that
+ * results. Then, we just combine all of the MacabHeaders into
+ * one.
+ */
+ for(i = 0; i < numRecords; i++)
{
- j++;
- k = 0;
+ dictType = getABTypeFromCFType( CFGetTypeID(dictValues[i]) );
+ localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]);
+ dictKeyString = CFStringToOUString(localizedDictKey);
+ dictLabelString = propertyNameString + ": " + fixLabel(dictKeyString);
+ dictLabel = OUStringToCFString(dictLabelString);
+ dictHeaders[i] = createHeaderForProperty(dictType, dictValues[i], dictLabel);
+ if (!dictHeaders[i])
+ dictHeaders[i] = new MacabHeader();
+ length += dictHeaders[i]->getSize();
+ CFRelease(dictLabel);
+ CFRelease(localizedDictKey);
}
- headerNames[i] = dictHeaders[j]->copy(k);
- }
+ /* Combine all of the macabfields in each MacabHeader into the
+ * headerNames array, which (at the end of this method) is used
+ * to create the MacabHeader that is returned.
+ */
+ headerNames = new macabfield *[length];
+ for(i = 0, j = 0, k = 0; i < length; i++,k++)
+ {
+ while(dictHeaders[j]->getSize() == k)
+ {
+ j++;
+ k = 0;
+ }
- for(i = 0; i < numRecords; i++)
- delete dictHeaders[i];
+ headerNames[i] = dictHeaders[j]->copy(k);
+ }
- delete [] dictHeaders;
- free(dictKeys);
- free(dictValues);
+ for(i = 0; i < numRecords; i++)
+ delete dictHeaders[i];
+
+ delete [] dictHeaders;
+ free(dictKeys);
+ free(dictValues);
}
break;
@@ -1099,11 +1099,6 @@ MacabRecords::iterator::iterator ()
}
-MacabRecords::iterator::~iterator ()
-{
-}
-
-
MacabRecords::iterator& MacabRecords::iterator::operator= (MacabRecords *_records)
{
id = 0;
diff --git a/connectivity/source/drivers/macab/MacabRecords.hxx b/connectivity/source/drivers/macab/MacabRecords.hxx
index 7e7da60a5486..f38705a12e86 100644
--- a/connectivity/source/drivers/macab/MacabRecords.hxx
+++ b/connectivity/source/drivers/macab/MacabRecords.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORDS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORDS_HXX
+#pragma once
#include <sal/config.h>
@@ -36,94 +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();
- ~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;
+ };
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABRECORDS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx
index da2d2dafd3ed..e8784ba3a8a8 100644
--- a/connectivity/source/drivers/macab/MacabResultSet.cxx
+++ b/connectivity/source/drivers/macab/MacabResultSet.cxx
@@ -33,6 +33,7 @@
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
#include <resource/sharedresources.hxx>
+#include <rtl/ref.hxx>
#include <strings.hrc>
using namespace connectivity::macab;
@@ -64,14 +65,14 @@ MacabResultSet::~MacabResultSet()
void MacabResultSet::allMacabRecords()
{
- MacabConnection* pConnection = static_cast< MacabConnection *>(m_xStatement->getConnection().get());
+ rtl::Reference<MacabConnection> pConnection = static_cast< MacabConnection *>(m_xStatement->getConnection().get());
m_aMacabRecords = pConnection->getAddressBook()->getMacabRecords(m_sTableName);
}
void MacabResultSet::someMacabRecords(const MacabCondition *pCondition)
{
- MacabConnection* pConnection = static_cast< MacabConnection *>(m_xStatement->getConnection().get());
+ rtl::Reference<MacabConnection> pConnection = static_cast< MacabConnection *>(m_xStatement->getConnection().get());
MacabRecords* allRecords;
allRecords = pConnection->getAddressBook()->getMacabRecords(m_sTableName);
@@ -156,12 +157,12 @@ Any SAL_CALL MacabResultSet::queryInterface(const Type & rType)
return aRet;
}
-void SAL_CALL MacabResultSet::acquire() throw()
+void SAL_CALL MacabResultSet::acquire() noexcept
{
MacabResultSet_BASE::acquire();
}
-void SAL_CALL MacabResultSet::release() throw()
+void SAL_CALL MacabResultSet::release() noexcept
{
MacabResultSet_BASE::release();
}
@@ -393,8 +394,7 @@ Date SAL_CALL MacabResultSet::getDate(sal_Int32)
::dbtools::throwFunctionNotSupportedSQLException("getDate", nullptr);
- Date aRet;
- return aRet;
+ return Date();
}
Time SAL_CALL MacabResultSet::getTime(sal_Int32)
@@ -404,8 +404,7 @@ Time SAL_CALL MacabResultSet::getTime(sal_Int32)
::dbtools::throwFunctionNotSupportedSQLException("getTime", nullptr);
- css::util::Time nRet;
- return nRet;
+ return css::util::Time();
}
DateTime SAL_CALL MacabResultSet::getTimestamp(sal_Int32 columnIndex)
@@ -513,7 +512,7 @@ Reference< XResultSetMetaData > SAL_CALL MacabResultSet::getMetaData()
if (!m_xMetaData.is())
m_xMetaData = new MacabResultSetMetaData(m_xStatement->getOwnConnection(), m_sTableName);
- Reference< XResultSetMetaData > xMetaData = m_xMetaData.get();
+ Reference< XResultSetMetaData > xMetaData = m_xMetaData;
return xMetaData;
}
@@ -668,7 +667,7 @@ Reference< XInterface > SAL_CALL MacabResultSet::getStatement()
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
- Reference< XStatement > xStatement = m_xStatement.get();
+ Reference< XStatement > xStatement = m_xStatement;
return xStatement;
}
@@ -884,7 +883,7 @@ Any SAL_CALL MacabResultSet::getBookmark()
{
if(uidField->type == kABStringProperty)
{
- return makeAny(CFStringToOUString( static_cast<CFStringRef>(uidField->value) ));
+ return Any(CFStringToOUString( static_cast<CFStringRef>(uidField->value) ));
}
}
}
@@ -980,28 +979,47 @@ Sequence< sal_Int32 > SAL_CALL MacabResultSet::deleteRows(const Sequence< Any
IPropertyArrayHelper* MacabResultSet::createArrayHelper() const
{
- Sequence< Property > aProps(6);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
- PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
+ return new OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
+ PROPERTY_ID_ISBOOKMARKABLE,
+ cppu::UnoType<bool>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY
+ }
+ }
+ };
}
IPropertyArrayHelper & MacabResultSet::getInfoHelper()
diff --git a/connectivity/source/drivers/macab/MacabResultSet.hxx b/connectivity/source/drivers/macab/MacabResultSet.hxx
index d0d8061f417c..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() throw() override;
- virtual void SAL_CALL release() throw() 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.cxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx
index d0ed7298f92b..e08d92cfceb6 100644
--- a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx
+++ b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx
@@ -23,6 +23,7 @@
#include "MacabRecords.hxx"
#include "MacabAddressBook.hxx"
#include "macabutilities.hxx"
+#include <connectivity/dbexception.hxx>
#include <strings.hrc>
using namespace connectivity::macab;
diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx
index 6db5f240ac24..16dc1d34ea8d 100644
--- a/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx
+++ b/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx
@@ -23,59 +23,58 @@
#include <connectivity/CommonTools.hxx>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <cppuhelper/implbase.hxx>
-#include <connectivity/dbexception.hxx>
#include <rtl/ref.hxx>
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 > () throw()
- { 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.cxx b/connectivity/source/drivers/macab/MacabStatement.cxx
index 407c90527eef..95b922ce6bc7 100644
--- a/connectivity/source/drivers/macab/MacabStatement.cxx
+++ b/connectivity/source/drivers/macab/MacabStatement.cxx
@@ -32,6 +32,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <connectivity/dbexception.hxx>
#include <resource/sharedresources.hxx>
+#include <rtl/ref.hxx>
#include <strings.hrc>
using namespace connectivity::macab;
@@ -46,7 +47,7 @@ using namespace com::sun::star::util;
namespace connectivity::macab
{
- void impl_throwError(const char* pErrorId)
+ void impl_throwError(TranslateId pErrorId)
{
::connectivity::SharedResources aResources;
const OUString sError( aResources.getResourceString(pErrorId) );
@@ -288,7 +289,7 @@ OUString MacabCommonStatement::getTableName() const
void MacabCommonStatement::setMacabFields(MacabResultSet *pResult) const
{
::rtl::Reference<connectivity::OSQLColumns> xColumns; // selected columns
- MacabResultSetMetaData *pMeta; // meta information - holds the list of AddressBook fields
+ rtl::Reference<MacabResultSetMetaData> pMeta; // meta information - holds the list of AddressBook fields
xColumns = m_aSQLIterator.getSelectColumns();
if (!xColumns.is())
@@ -397,8 +398,7 @@ Reference< XResultSet > SAL_CALL MacabCommonStatement::executeQuery(
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(rBHelper.bDisposed);
- MacabResultSet* pResult = new MacabResultSet(this);
- Reference< XResultSet > xRS = pResult;
+ rtl::Reference<MacabResultSet> pResult = new MacabResultSet(this);
OUString aErr;
m_pParseTree = m_aParser.parseTree(aErr, sql).release();
@@ -428,9 +428,9 @@ Reference< XResultSet > SAL_CALL MacabCommonStatement::executeQuery(
pResult->setTableName(sTableName);
- setMacabFields(pResult); // SELECT which columns ?
- selectRecords(pResult); // WHERE which condition ?
- sortRecords(pResult); // ORDER BY which columns ?
+ setMacabFields(pResult.get()); // SELECT which columns ?
+ selectRecords(pResult.get()); // WHERE which condition ?
+ sortRecords(pResult.get()); // ORDER BY which columns ?
}
// To be continued: DISTINCT
// etc...
@@ -446,7 +446,7 @@ Reference< XResultSet > SAL_CALL MacabCommonStatement::executeQuery(
}
m_xResultSet = Reference<XResultSet>(pResult);
- return xRS;
+ return pResult;
}
Reference< XConnection > SAL_CALL MacabCommonStatement::getConnection( )
@@ -472,7 +472,7 @@ Any SAL_CALL MacabCommonStatement::getWarnings( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(rBHelper.bDisposed);
- return makeAny(m_aLastWarning);
+ return Any(m_aLastWarning);
}
void SAL_CALL MacabCommonStatement::clearWarnings( )
@@ -487,31 +487,71 @@ void SAL_CALL MacabCommonStatement::clearWarnings( )
{
// this properties are defined by the service statement
// they must be in alphabetic order
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
- PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
- PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
- PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
- PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
- PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
+ PROPERTY_ID_ESCAPEPROCESSING,
+ cppu::UnoType<bool>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
+ PROPERTY_ID_MAXFIELDSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
+ PROPERTY_ID_MAXROWS,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
+ PROPERTY_ID_QUERYTIMEOUT,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
+ PROPERTY_ID_USEBOOKMARKS,
+ cppu::UnoType<bool>::get(),
+ 0
+ }
+ }
+ };
}
::cppu::IPropertyArrayHelper & MacabCommonStatement::getInfoHelper()
@@ -568,12 +608,12 @@ void MacabCommonStatement::getFastPropertyValue(Any&,sal_Int32 nHandle) const
}
}
-void SAL_CALL MacabCommonStatement::acquire() throw()
+void SAL_CALL MacabCommonStatement::acquire() noexcept
{
MacabCommonStatement_BASE::acquire();
}
-void SAL_CALL MacabCommonStatement::release() throw()
+void SAL_CALL MacabCommonStatement::release() noexcept
{
MacabCommonStatement_BASE::release();
}
diff --git a/connectivity/source/drivers/macab/MacabStatement.hxx b/connectivity/source/drivers/macab/MacabStatement.hxx
index 83142fc56618..8c72bd55974b 100644
--- a/connectivity/source/drivers/macab/MacabStatement.hxx
+++ b/connectivity/source/drivers/macab/MacabStatement.hxx
@@ -24,6 +24,7 @@
#include <connectivity/sqliterator.hxx>
#include <connectivity/sqlparse.hxx>
#include <com/sun/star/sdbc/XStatement.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/util/XCancellable.hpp>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/implbase.hxx>
@@ -32,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() throw() override;
- virtual void SAL_CALL acquire() throw() 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.cxx b/connectivity/source/drivers/macab/MacabTable.cxx
index 75da75bc1035..1628cd297bfd 100644
--- a/connectivity/source/drivers/macab/MacabTable.cxx
+++ b/connectivity/source/drivers/macab/MacabTable.cxx
@@ -71,8 +71,8 @@ void MacabTable::refreshColumns()
if (xResult.is())
{
- Reference< XRow > xRow(xResult, UNO_QUERY);
- while (xResult->next())
+ Reference< XRow > xRow(xResult, UNO_QUERY);
+ while (xResult->next())
aVector.push_back(xRow->getString(4));
}
}
@@ -80,7 +80,7 @@ void MacabTable::refreshColumns()
if (m_xColumns)
m_xColumns->reFill(aVector);
else
- m_xColumns = new MacabColumns(this,m_aMutex,aVector);
+ m_xColumns.reset(new MacabColumns(this, m_aMutex, aVector));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabTable.hxx b/connectivity/source/drivers/macab/MacabTable.hxx
index 3db8ab0aae50..ac57c49c7f0c 100644
--- a/connectivity/source/drivers/macab/MacabTable.hxx
+++ b/connectivity/source/drivers/macab/MacabTable.hxx
@@ -17,41 +17,38 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABTABLE_HXX
+#pragma once
#include "MacabConnection.hxx"
#include <connectivity/sdbcx/VTable.hxx>
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; }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABTABLE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabTables.cxx b/connectivity/source/drivers/macab/MacabTables.cxx
index c70aa87f87d5..e7aba053a48a 100644
--- a/connectivity/source/drivers/macab/MacabTables.cxx
+++ b/connectivity/source/drivers/macab/MacabTables.cxx
@@ -36,7 +36,7 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-sdbcx::ObjectType MacabTables::createObject(const OUString& _rName)
+css::uno::Reference< css::beans::XPropertySet > MacabTables::createObject(const OUString& _rName)
{
OUString aName,aSchema;
aSchema = "%";
@@ -46,20 +46,19 @@ sdbcx::ObjectType MacabTables::createObject(const OUString& _rName)
Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), aSchema, aName, aTypes);
- sdbcx::ObjectType xRet;
+ css::uno::Reference< css::beans::XPropertySet > xRet;
if (xResult.is())
{
Reference< XRow > xRow(xResult, UNO_QUERY);
if (xResult->next()) // there can be only one table with this name
{
- MacabTable* pRet = new MacabTable(
+ xRet = new MacabTable(
this,
static_cast<MacabCatalog&>(m_rParent).getConnection(),
aName,
xRow->getString(4),
xRow->getString(5),
"");
- xRet = pRet;
}
}
::comphelper::disposeComponent(xResult);
diff --git a/connectivity/source/drivers/macab/MacabTables.hxx b/connectivity/source/drivers/macab/MacabTables.hxx
index 43922585e46b..d9ccad86da13 100644
--- a/connectivity/source/drivers/macab/MacabTables.hxx
+++ b/connectivity/source/drivers/macab/MacabTables.hxx
@@ -17,36 +17,33 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABTABLES_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
namespace connectivity::macab
{
- class MacabTables : public sdbcx::OCollection
- {
- css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
-
- protected:
- virtual sdbcx::ObjectType 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)
- { }
-
- virtual void disposing() override;
- };
+ 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;
+
+ 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABTABLES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/macabcondition.hxx b/connectivity/source/drivers/macab/macabcondition.hxx
index 15c2478197b8..32e7b7071cf3 100644
--- a/connectivity/source/drivers/macab/macabcondition.hxx
+++ b/connectivity/source/drivers/macab/macabcondition.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONDITION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONDITION_HXX
+#pragma once
#include <sal/config.h>
@@ -163,6 +162,4 @@ class MacabConditionAnd : public MacabConditionBoolean
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONDITION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/macaborder.hxx b/connectivity/source/drivers/macab/macaborder.hxx
index dfdf5ce5a950..36151cb76ea6 100644
--- a/connectivity/source/drivers/macab/macaborder.hxx
+++ b/connectivity/source/drivers/macab/macaborder.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABORDER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABORDER_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include "MacabHeader.hxx"
@@ -30,38 +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;
+ };
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx
index d0027c8da6ed..f89553c9ea27 100644
--- a/connectivity/source/drivers/macab/macabutilities.hxx
+++ b/connectivity/source/drivers/macab/macabutilities.hxx
@@ -17,11 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABUTILITIES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABUTILITIES_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
+#include <unotools/resmgr.hxx>
#include <time.h>
#include <premac.h>
@@ -32,109 +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);
- UniChar unichars[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);
- CFRelease(sOrig);
+ CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars.get());
+ CFRelease(sOrig);
- return OUString(reinterpret_cast<sal_Unicode *>(unichars));
- }
+ 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(const char* pErrorId);
+ void impl_throwError(TranslateId pErrorId);
}
-#endif // _ CONNECTIVITY_MACAB_UTILITIES_HXX_
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
new file mode 100644
index 000000000000..37cfb087a70f
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
+#include "MMozillaBootstrap.hxx"
+#include "MNSProfileDiscover.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::mozilla;
+using namespace connectivity::mozab;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+MozillaBootstrap::MozillaBootstrap()
+ : OMozillaBootstrap_BASE(m_aMutex)
+{
+ m_ProfileAccess.reset(new ProfileAccess);
+ bootupProfile(css::mozilla::MozillaProductType_Mozilla,OUString());
+}
+
+MozillaBootstrap::~MozillaBootstrap()
+{
+}
+
+void MozillaBootstrap::disposing()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ OMozillaBootstrap_BASE::disposing();
+}
+
+OUString SAL_CALL MozillaBootstrap::getImplementationName( )
+{
+ return u"com.sun.star.comp.mozilla.MozillaBootstrap"_ustr;
+}
+
+sal_Bool SAL_CALL MozillaBootstrap::supportsService( const OUString& _rServiceName )
+{
+ return cppu::supportsService(this, _rServiceName);
+}
+
+Sequence< OUString > SAL_CALL MozillaBootstrap::getSupportedServiceNames( )
+{
+ // which service is supported
+ // for more information @see com.sun.star.mozilla.MozillaBootstrap
+ return { u"com.sun.star.mozilla.MozillaBootstrap"_ustr };
+}
+
+
+// XProfileDiscover
+::sal_Int32 SAL_CALL MozillaBootstrap::getProfileCount( css::mozilla::MozillaProductType product)
+{
+ return m_ProfileAccess->getProfileCount(product);
+}
+::sal_Int32 SAL_CALL MozillaBootstrap::getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list )
+{
+ return m_ProfileAccess->getProfileList(product,list);
+}
+OUString SAL_CALL MozillaBootstrap::getDefaultProfile( css::mozilla::MozillaProductType product )
+{
+ return m_ProfileAccess->getDefaultProfile(product);
+}
+OUString SAL_CALL MozillaBootstrap::getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName )
+{
+ return m_ProfileAccess->getProfilePath(product,profileName);
+}
+sal_Bool SAL_CALL MozillaBootstrap::isProfileLocked( css::mozilla::MozillaProductType /*product*/, const OUString& /*profileName*/ )
+{
+ return true;
+}
+sal_Bool SAL_CALL MozillaBootstrap::getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName )
+{
+ return m_ProfileAccess->getProfileExists(product,profileName);
+}
+
+// XProfileManager
+::sal_Int32 SAL_CALL MozillaBootstrap::bootupProfile( css::mozilla::MozillaProductType, const OUString& )
+{
+ return -1;
+}
+::sal_Int32 SAL_CALL MozillaBootstrap::shutdownProfile( )
+{
+ return -1;
+}
+css::mozilla::MozillaProductType SAL_CALL MozillaBootstrap::getCurrentProduct( )
+{
+ return css::mozilla::MozillaProductType_Default;
+}
+OUString SAL_CALL MozillaBootstrap::getCurrentProfile( )
+{
+ return OUString();
+}
+sal_Bool SAL_CALL MozillaBootstrap::isCurrentProfileLocked( )
+{
+ return true;
+}
+OUString SAL_CALL MozillaBootstrap::setCurrentProfile( css::mozilla::MozillaProductType, const OUString& )
+{
+ return OUString();
+}
+
+// XProxyRunner
+::sal_Int32 SAL_CALL MozillaBootstrap::Run( const css::uno::Reference< css::mozilla::XCodeProxy >& )
+{
+ return -1;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_moz_MozillaBootstrap_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new connectivity::mozab::MozillaBootstrap());
+}
+
+/* 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
new file mode 100644
index 000000000000..7c040554137a
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase.hxx>
+
+
+namespace connectivity::mozab
+{
+ typedef ::cppu::WeakComponentImplHelper< css::mozilla::XMozillaBootstrap,
+ css::lang::XServiceInfo > OMozillaBootstrap_BASE;
+ class ProfileAccess;
+ 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();
+
+ // 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;
+
+ // 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;
+
+ // 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;
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
new file mode 100644
index 000000000000..8b8bf0939a5b
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "MNSFolders.hxx"
+
+#ifdef UNIX
+#include <string.h>
+#endif // End UNIX
+
+#ifdef _WIN32
+#if !defined WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <stdlib.h>
+#include <shlobj.h>
+#include <objidl.h>
+#endif // End _WIN32
+#include <osl/security.hxx>
+#include <osl/file.hxx>
+#include <osl/thread.h>
+
+using namespace ::com::sun::star::mozilla;
+
+namespace
+{
+
+ OUString lcl_getUserDataDirectory()
+ {
+ ::osl::Security aSecurity;
+ OUString aConfigPath;
+
+ #if defined(_WIN32) || defined(MACOSX)
+ aSecurity.getConfigDir( aConfigPath );
+ #else
+ //This is to find the dir under which .mozilla/.thunderbird is created.
+ //mozilla doesn't honour XDG_CONFIG_HOME, so raw home dir required here
+ //not xdg-config dir
+ aSecurity.getHomeDir( aConfigPath );
+ #endif
+
+ return aConfigPath + "/";
+ }
+
+
+ const size_t NB_PRODUCTS = 3;
+ const size_t NB_CANDIDATES = 4;
+
+ // The order (index) of entries in DefaultProductDir and
+ // ProductRootEnvironmentVariable *must* match the constants
+ // (minus 1) in offapi/com/sun/star/mozilla/MozillaProductType.idl
+ // DO NOT CHANGE THE ORDER; ADD ONLY TO THE END
+ const char* DefaultProductDir[NB_PRODUCTS][NB_CANDIDATES] =
+ {
+ #if defined(_WIN32)
+ { "Mozilla/SeaMonkey/", nullptr, nullptr, nullptr },
+ { "Mozilla/Firefox/", nullptr, nullptr, nullptr },
+ { "Thunderbird/", "Mozilla/Thunderbird/", nullptr, nullptr }
+ #elif defined(MACOSX)
+ { "../Mozilla/SeaMonkey/", nullptr, nullptr, nullptr },
+ { "Firefox/", nullptr, nullptr, nullptr },
+ { "../Thunderbird/", nullptr, nullptr, nullptr }
+ #else
+ { ".mozilla/seamonkey/", nullptr, nullptr, nullptr },
+ { ".mozilla/firefox/", nullptr, nullptr, nullptr },
+ { ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/", ".icedove/" }
+ #endif
+ };
+
+ const char* ProductRootEnvironmentVariable[NB_PRODUCTS] =
+ {
+ "MOZILLA_PROFILE_ROOT",
+ "MOZILLA_FIREFOX_PROFILE_ROOT",
+ "MOZILLA_THUNDERBIRD_PROFILE_ROOT",
+ };
+
+
+ OUString const & lcl_guessProfileRoot( MozillaProductType _product )
+ {
+ size_t productIndex = static_cast<int>(_product) - 1;
+
+ static OUString s_productDirectories[NB_PRODUCTS];
+
+ if ( s_productDirectories[ productIndex ].isEmpty() )
+ {
+ OUString sProductPath;
+
+ // check whether we have an environment variable which help us
+ const char* pProfileByEnv = getenv( ProductRootEnvironmentVariable[ productIndex ] );
+ if ( pProfileByEnv )
+ {
+ sProductPath = OUString( pProfileByEnv, rtl_str_getLength( pProfileByEnv ), osl_getThreadTextEncoding() );
+ // assume that this is fine, no further checks
+ }
+ else
+ {
+ OUString sProductDirCandidate;
+ const char pProfileRegistry[] = "profiles.ini";
+
+ // check all possible candidates
+ for ( size_t i=0; i<NB_CANDIDATES; ++i )
+ {
+ if ( nullptr == DefaultProductDir[ productIndex ][ i ] )
+ break;
+
+ sProductDirCandidate = lcl_getUserDataDirectory() +
+ OUString::createFromAscii( DefaultProductDir[ productIndex ][ i ] );
+
+ // check existence
+ ::osl::DirectoryItem aRegistryItem;
+ ::osl::FileBase::RC result = ::osl::DirectoryItem::get( sProductDirCandidate + pProfileRegistry, aRegistryItem );
+ if ( result == ::osl::FileBase::E_None )
+ {
+ ::osl::FileStatus aStatus( osl_FileStatus_Mask_Validate );
+ result = aRegistryItem.getFileStatus( aStatus );
+ if ( result == ::osl::FileBase::E_None )
+ {
+ // the registry file exists
+ break;
+ }
+ }
+ }
+
+ ::osl::FileBase::getSystemPathFromFileURL( sProductDirCandidate, sProductPath );
+ }
+
+ s_productDirectories[ productIndex ] = sProductPath;
+ }
+
+ return s_productDirectories[ productIndex ];
+ }
+}
+
+
+const OUString & getRegistryDir(MozillaProductType product)
+{
+ if (product == MozillaProductType_Default)
+ return EMPTY_OUSTRING;
+
+ return lcl_guessProfileRoot( product );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx
new file mode 100644
index 000000000000..f61b808223a9
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/mozilla/MozillaProductType.hpp>
+
+#include <rtl/ustring.hxx>
+
+const OUString& getRegistryDir(css::mozilla::MozillaProductType product);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
new file mode 100644
index 000000000000..98a1b6ff64bc
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "MNSINIParser.hxx"
+#include <com/sun/star/io/IOException.hpp>
+#include <osl/file.h>
+#include <rtl/byteseq.hxx>
+#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
+
+IniParser::IniParser(OUString const & rIniName)
+{
+ OUString iniUrl;
+ if (osl_File_E_None != osl_getFileURLFromSystemPath(rIniName.pData, &iniUrl.pData))
+ return;
+
+
+ oslFileHandle handle=nullptr;
+ oslFileError fileError = osl_File_E_INVAL;
+ try{
+ if (!iniUrl.isEmpty())
+ fileError = osl_openFile(iniUrl.pData, &handle, osl_File_OpenFlag_Read);
+ }
+ catch(const css::io::IOException&)
+ {
+ SAL_WARN("connectivity.mozab", "couldn't open file: " << iniUrl );
+ }
+
+ if (osl_File_E_None == fileError)
+ {
+ rtl::ByteSequence seq;
+ sal_uInt64 nSize = 0;
+
+ osl_getFileSize(handle, &nSize);
+ OUString sectionName( u"no name section"_ustr );
+ while (true)
+ {
+ sal_uInt64 nPos;
+ if (osl_File_E_None != osl_getFilePos(handle, &nPos) || nPos >= nSize)
+ break;
+ if (osl_File_E_None != osl_readLine(handle, reinterpret_cast<sal_Sequence **>(&seq)))
+ break;
+ OString line(reinterpret_cast<const char *>(seq.getConstArray()), seq.getLength() );
+ sal_Int32 nIndex = line.indexOf('=');
+ if (nIndex >= 1)
+ {
+ ini_Section *aSection = &mAllSection[sectionName];
+ struct ini_NameValue nameValue;
+ nameValue.sName = OStringToOUString(
+ o3tl::trim(line.subView(0,nIndex)), RTL_TEXTENCODING_ASCII_US );
+ nameValue.sValue = OStringToOUString(
+ o3tl::trim(line.subView(nIndex+1)), RTL_TEXTENCODING_UTF8 );
+
+ aSection->vVector.push_back(nameValue);
+
+ }
+ else
+ {
+ sal_Int32 nIndexStart = line.indexOf('[');
+ sal_Int32 nIndexEnd = line.indexOf(']');
+ if ( nIndexEnd > nIndexStart && nIndexStart >=0)
+ {
+ sectionName = OStringToOUString(
+ o3tl::trim(line.subView(nIndexStart + 1,nIndexEnd - nIndexStart -1)), RTL_TEXTENCODING_ASCII_US );
+ if (sectionName.isEmpty())
+ sectionName = "no name section";
+ }
+ }
+ }
+ osl_closeFile(handle);
+ }
+ else
+ {
+ SAL_INFO("connectivity.mozab", "couldn't open file: " << iniUrl );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
new file mode 100644
index 000000000000..27746364a33a
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+#include <map>
+#include <vector>
+
+struct ini_NameValue
+{
+ OUString sName;
+ OUString sValue;
+};
+
+typedef std::vector<
+ ini_NameValue
+> NameValueVector;
+
+struct ini_Section
+{
+ NameValueVector vVector;
+};
+typedef std::map<OUString,
+ ini_Section
+ >IniSectionMap;
+
+
+class IniParser
+{
+ IniSectionMap mAllSection;
+public:
+ IniSectionMap& getAllSection() { return mAllSection; }
+ /// @throws css::io::IOException
+ explicit IniParser(OUString const & rIniName);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
new file mode 100644
index 000000000000..804c8ccc66d8
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
@@ -0,0 +1,212 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <utility>
+
+#include "MNSProfileDiscover.hxx"
+#include "MNSFolders.hxx"
+#include "MNSINIParser.hxx"
+
+namespace connectivity::mozab
+{
+ ProfileStruct::ProfileStruct()
+ {
+ }
+
+ ProfileStruct::ProfileStruct(OUString aProfileName,
+ OUString aProfilePath)
+ : profileName(std::move(aProfileName))
+ , profilePath(std::move(aProfilePath))
+ {
+ }
+
+ const OUString& ProfileStruct::getProfilePath() const
+ {
+ return profilePath;
+ }
+
+ ProfileAccess::~ProfileAccess()
+ {
+ }
+
+ ProfileAccess::ProfileAccess()
+ {
+ LoadProductsInfo();
+ }
+
+ void ProfileAccess::LoadProductsInfo()
+ {
+ //tdf#39279: LO should search Thunderbird first then Seamonkey and finally Firefox
+ //load thunderbird profiles to m_ProductProfileList
+ LoadXPToolkitProfiles(MozillaProductType_Thunderbird);
+
+ //load SeaMonkey 2 profiles to m_ProductProfileList
+ LoadXPToolkitProfiles(MozillaProductType_Mozilla);
+
+ //load firefox profiles to m_ProductProfileList
+ //firefox profile does not contain address book, but maybe others need them
+ LoadXPToolkitProfiles(MozillaProductType_Firefox);
+ }
+ //Thunderbird and firefox profiles are saved in profiles.ini
+ void ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product)
+ {
+ sal_Int32 index=static_cast<sal_Int32>(product);
+ ProductStruct &rProduct = m_ProductProfileList[index];
+
+ OUString regDir = getRegistryDir(product);
+ OUString profilesIni = regDir + "profiles.ini";
+ IniParser parser( profilesIni );
+ IniSectionMap &rAllSection = parser.getAllSection();
+
+ for(auto& rSection : rAllSection)
+ {
+ ini_Section *aSection = &rSection.second;
+ OUString profileName;
+ OUString profilePath;
+ OUString sIsRelative;
+ OUString sIsDefault;
+
+ for(auto& rValue : aSection->vVector)
+ {
+ struct ini_NameValue * aValue = &rValue;
+ if ( aValue->sName == "Name" )
+ {
+ profileName = aValue->sValue;
+ }
+ else if ( aValue->sName == "IsRelative" )
+ {
+ sIsRelative = aValue->sValue;
+ }
+ else if ( aValue->sName == "Path" )
+ {
+ profilePath = aValue->sValue;
+ }
+ else if ( aValue->sName == "Default" )
+ {
+ sIsDefault = aValue->sValue;
+ }
+ }
+ if (!(profileName.isEmpty() && profilePath.isEmpty()))
+ {
+ sal_Int32 isRelative = 0;
+ if (!sIsRelative.isEmpty())
+ {
+ isRelative = sIsRelative.toInt32();
+ }
+
+ OUString fullProfilePath;
+ if(isRelative)
+ {
+ fullProfilePath = regDir + profilePath;
+ }
+ else
+ {
+ fullProfilePath = profilePath;
+ }
+
+ rProduct.mProfileList[profileName] = ProfileStruct(profileName,fullProfilePath);
+
+ sal_Int32 isDefault = 0;
+ if (!sIsDefault.isEmpty())
+ {
+ isDefault = sIsDefault.toInt32();
+ }
+ if (isDefault)
+ rProduct.mCurrentProfileName = profileName;
+
+ }
+
+ // Depending on TB versions, some generate "default" profile
+ // others "default-release" profile
+ // See https://support.mozilla.org/gl/questions/1264072
+ // for some background info (the link quotes Firefox but it seems
+ // the same for TB).
+ if (profileName == "default-release")
+ {
+ rProduct.mCurrentProfileName = profileName;
+ break;
+ }
+ }
+ }
+
+ OUString ProfileAccess::getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName )
+ {
+ sal_Int32 index=static_cast<sal_Int32>(product);
+ ProductStruct &rProduct = m_ProductProfileList[index];
+ if (rProduct.mProfileList.empty() || rProduct.mProfileList.find(profileName) == rProduct.mProfileList.end())
+ {
+ //Profile not found
+ return OUString();
+ }
+ else
+ return rProduct.mProfileList[profileName].getProfilePath();
+ }
+
+ ::sal_Int32 ProfileAccess::getProfileCount( css::mozilla::MozillaProductType product)
+ {
+ sal_Int32 index=static_cast<sal_Int32>(product);
+ ProductStruct &rProduct = m_ProductProfileList[index];
+ return static_cast< ::sal_Int32 >(rProduct.mProfileList.size());
+ }
+ ::sal_Int32 ProfileAccess::getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list )
+ {
+ sal_Int32 index=static_cast<sal_Int32>(product);
+ ProductStruct &rProduct = m_ProductProfileList[index];
+ list.realloc(static_cast<sal_Int32>(rProduct.mProfileList.size()));
+ auto listRange = list.getArray();
+ sal_Int32 i=0;
+ for(const auto& rEntry : rProduct.mProfileList)
+ {
+ const ProfileStruct& rProfile = rEntry.second;
+ listRange[i] = rProfile.getProfileName();
+ i++;
+ }
+
+ return static_cast< ::sal_Int32 >(rProduct.mProfileList.size());
+ }
+
+ OUString ProfileAccess::getDefaultProfile( css::mozilla::MozillaProductType product )
+ {
+ sal_Int32 index=static_cast<sal_Int32>(product);
+ ProductStruct &rProduct = m_ProductProfileList[index];
+ if (!rProduct.mCurrentProfileName.isEmpty())
+ {
+ //default profile set in mozilla registry
+ return rProduct.mCurrentProfileName;
+ }
+ if (rProduct.mProfileList.empty())
+ {
+ //there are not any profiles
+ return OUString();
+ }
+ const ProfileStruct& rProfile = (*rProduct.mProfileList.begin()).second;
+ return rProfile.getProfileName();
+ }
+
+ bool ProfileAccess::getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName )
+ {
+ sal_Int32 index=static_cast<sal_Int32>(product);
+ ProductStruct &rProduct = m_ProductProfileList[index];
+ return rProduct.mProfileList.find(profileName) != rProduct.mProfileList.end();
+ }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
new file mode 100644
index 000000000000..5c60dc87e544
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <com/sun/star/mozilla/MozillaProductType.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+#include <map>
+
+using namespace com::sun::star::mozilla;
+namespace connectivity::mozab { class ProfileStruct; }
+
+typedef std::map<OUString, ::connectivity::mozab::ProfileStruct> ProfileList;
+namespace connectivity::mozab
+{
+ class ProfileStruct
+ {
+ 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;
+ };
+
+ //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);
+ };
+
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/README b/connectivity/source/drivers/mozab/bootstrap/README
new file mode 100644
index 000000000000..cea68d86cc56
--- /dev/null
+++ b/connectivity/source/drivers/mozab/bootstrap/README
@@ -0,0 +1,3 @@
+this provides com.sun.star.mozilla.MozillaBootstrap which is used by at least
+xmlsecurity/source/xmlsec/nss/nssinitializer.cxx to find a user's
+firefox/thunderbird profile to use its certs
diff --git a/connectivity/source/drivers/mysqlc/DataAccess.xcu b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component
index 2b652ec87649..bfc0afe389ef 100644
--- a/connectivity/source/drivers/mysqlc/DataAccess.xcu
+++ b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
@@ -15,21 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
-<oor:node xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="DataAccess" oor:package="org.openoffice.Office">
- <node oor:name="UserDefinedDriverSettings">
- <node oor:name="org.openoffice.comp.connectivity.mysql_native.Driver" oor:op="replace">
- <prop oor:name="DriverName">
- <value>org.openoffice.comp.connectivity.mysql_native.Driver</value>
- </prop>
- <prop oor:name="DriverPageDisplayName">
- <value>MySQL native driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName">
- <value>MySQL native driver</value>
- </prop>
- <prop oor:name="DriverDsnPrefix">
- <value>sdbc:mysqlc:</value>
- </prop>
- </node>
- </node>
-</oor:node>
+
+<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap"
+ constructor="connectivity_moz_MozillaBootstrap_get_implementation" single-instance="true">
+ <service name="com.sun.star.mozilla.MozillaBootstrap"/>
+ </implementation>
+</component>
diff --git a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
index ad98bfa1a7fa..7f4b0232e0c8 100644
--- a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
@@ -29,11 +29,8 @@ using namespace connectivity;
using namespace connectivity::mysql;
using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OMySQLCatalog::OMySQLCatalog(const Reference<XConnection>& _xConnection)
: OCatalog(_xConnection)
@@ -44,7 +41,8 @@ OMySQLCatalog::OMySQLCatalog(const Reference<XConnection>& _xConnection)
void OMySQLCatalog::refreshObjects(const Sequence<OUString>& _sKindOfObject,
::std::vector<OUString>& _rNames)
{
- Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), "%", "%", _sKindOfObject);
+ Reference<XResultSet> xResult
+ = m_xMetaData->getTables(Any(), u"%"_ustr, u"%"_ustr, _sKindOfObject);
fillNames(xResult, _rNames);
}
@@ -52,10 +50,9 @@ void OMySQLCatalog::refreshTables()
{
::std::vector<OUString> aVector;
- Sequence<OUString> sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else...
+ Sequence<OUString> sTableTypes{
+ u"VIEW"_ustr, u"TABLE"_ustr, u"%"_ustr
+ }; // this last one just to be sure to include anything else...
refreshObjects(sTableTypes, aVector);
@@ -67,7 +64,7 @@ void OMySQLCatalog::refreshTables()
void OMySQLCatalog::refreshViews()
{
- Sequence<OUString> aTypes{ "VIEW" };
+ Sequence<OUString> aTypes{ u"VIEW"_ustr };
// let's simply assume the server is new enough to support views. Current drivers
// as of this writing might not return the proper information in getTableTypes, so
@@ -89,7 +86,7 @@ void OMySQLCatalog::refreshUsers()
::std::vector<OUString> aVector;
Reference<XStatement> xStmt = m_xConnection->createStatement();
Reference<XResultSet> xResult = xStmt->executeQuery(
- "SELECT grantee FROM information_schema.user_privileges GROUP BY grantee");
+ u"SELECT grantee FROM information_schema.user_privileges GROUP BY grantee"_ustr);
if (xResult.is())
{
Reference<XRow> xRow(xResult, UNO_QUERY);
diff --git a/connectivity/source/drivers/mysql_jdbc/YColumns.cxx b/connectivity/source/drivers/mysql_jdbc/YColumns.cxx
index 54beb77ca061..8861037e9a0d 100644
--- a/connectivity/source/drivers/mysql_jdbc/YColumns.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YColumns.cxx
@@ -26,10 +26,6 @@ using namespace connectivity::sdbcx;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OMySQLColumns::OMySQLColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::std::vector<OUString>& _rVector)
@@ -66,7 +62,7 @@ void OMySQLColumn::construct()
Sequence<OUString> SAL_CALL OMySQLColumn::getSupportedServiceNames()
{
- return { "com.sun.star.sdbcx.Column" };
+ return { u"com.sun.star.sdbcx.Column"_ustr };
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index d575ad874995..2707ddf7f8e8 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -17,8 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <mysql/YDriver.hxx>
#include <mysql/YCatalog.hxx>
+#include <o3tl/string_view.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
@@ -44,8 +49,8 @@ namespace
{
OUString getJavaDriverClass(css::uno::Sequence<css::beans::PropertyValue> const& info)
{
- return comphelper::NamedValueCollection(info).getOrDefault("JavaDriverClass",
- OUString("com.mysql.jdbc.Driver"));
+ return comphelper::NamedValueCollection::getOrDefault(info, u"JavaDriverClass",
+ u"com.mysql.jdbc.Driver"_ustr);
}
}
@@ -75,11 +80,10 @@ void ODriverDelegator::disposing()
for (auto const& connection : m_aConnections)
{
- Reference<XInterface> xTemp = connection.first.get();
+ Reference<XConnection> xTemp(connection.xConn);
::comphelper::disposeComponent(xTemp);
}
m_aConnections.clear();
- TWeakPairVector().swap(m_aConnections);
ODriverDelegator_BASE::disposing();
}
@@ -93,11 +97,14 @@ enum class T_DRIVERTYPE
Native
};
-bool isOdbcUrl(const OUString& _sUrl) { return _sUrl.startsWith("sdbc:mysql:odbc:"); }
+bool isOdbcUrl(std::u16string_view _sUrl) { return o3tl::starts_with(_sUrl, u"sdbc:mysql:odbc:"); }
-bool isNativeUrl(const OUString& _sUrl) { return _sUrl.startsWith("sdbc:mysql:mysqlc:"); }
+bool isNativeUrl(std::u16string_view _sUrl)
+{
+ return o3tl::starts_with(_sUrl, u"sdbc:mysql:mysqlc:");
+}
-T_DRIVERTYPE lcl_getDriverType(const OUString& _sUrl)
+T_DRIVERTYPE lcl_getDriverType(std::u16string_view _sUrl)
{
T_DRIVERTYPE eRet = T_DRIVERTYPE::Jdbc;
if (isOdbcUrl(_sUrl))
@@ -107,9 +114,9 @@ T_DRIVERTYPE lcl_getDriverType(const OUString& _sUrl)
return eRet;
}
-OUString transformUrl(const OUString& _sUrl)
+OUString transformUrl(std::u16string_view _sUrl)
{
- OUString sNewUrl = _sUrl.copy(11);
+ OUString sNewUrl(_sUrl.substr(11));
if (isOdbcUrl(_sUrl))
sNewUrl = "sdbc:" + sNewUrl;
else if (isNativeUrl(_sUrl))
@@ -150,36 +157,30 @@ Sequence<PropertyValue> lcl_convertProperties(T_DRIVERTYPE _eType,
if (_eType == T_DRIVERTYPE::Odbc)
{
- aProps.push_back(PropertyValue("Silent", 0, makeAny(true), PropertyState_DIRECT_VALUE));
- aProps.push_back(PropertyValue("PreventGetVersionColumns", 0, makeAny(true),
- PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("Silent", 0, Any(true), PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("PreventGetVersionColumns", 0, Any(true), PropertyState_DIRECT_VALUE);
}
else if (_eType == T_DRIVERTYPE::Jdbc)
{
if (!jdc)
{
- aProps.push_back(PropertyValue("JavaDriverClass", 0,
- makeAny(OUString("com.mysql.jdbc.Driver")),
- PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("JavaDriverClass", 0, Any(u"com.mysql.jdbc.Driver"_ustr),
+ PropertyState_DIRECT_VALUE);
}
}
else
{
- aProps.push_back(
- PropertyValue("PublicConnectionURL", 0, makeAny(_sUrl), PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("PublicConnectionURL", 0, Any(_sUrl), PropertyState_DIRECT_VALUE);
}
- aProps.push_back(
- PropertyValue("IsAutoRetrievingEnabled", 0, makeAny(true), PropertyState_DIRECT_VALUE));
- aProps.push_back(PropertyValue("AutoRetrievingStatement", 0,
- makeAny(OUString("SELECT LAST_INSERT_ID()")),
- PropertyState_DIRECT_VALUE));
- aProps.push_back(
- PropertyValue("ParameterNameSubstitution", 0, makeAny(true), PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("IsAutoRetrievingEnabled", 0, Any(true), PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("AutoRetrievingStatement", 0, Any(u"SELECT LAST_INSERT_ID()"_ustr),
+ PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("ParameterNameSubstitution", 0, Any(true), PropertyState_DIRECT_VALUE);
return Sequence<PropertyValue>(aProps.data(), aProps.size());
}
}
-Reference<XDriver> ODriverDelegator::loadDriver(const OUString& url,
+Reference<XDriver> ODriverDelegator::loadDriver(std::u16string_view url,
const Sequence<PropertyValue>& info)
{
Reference<XDriver> xDriver;
@@ -224,8 +225,8 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
Sequence<PropertyValue> aConvertedProperties = lcl_convertProperties(eType, info, url);
if (eType == T_DRIVERTYPE::Jdbc)
{
- ::comphelper::NamedValueCollection aSettings(info);
- OUString sIanaName = aSettings.getOrDefault("CharSet", OUString());
+ OUString sIanaName = ::comphelper::NamedValueCollection::getOrDefault(
+ info, u"CharSet", OUString());
if (!sIanaName.isEmpty())
{
::dbtools::OCharsetMap aLookupIanaName;
@@ -236,7 +237,7 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
OUString sAdd;
if (RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding())
{
- static const char s_sCharSetOp[] = "useUnicode=true&";
+ static constexpr OUString s_sCharSetOp = u"useUnicode=true&"_ustr;
if (!sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp))
{
sAdd = s_sCharSetOp;
@@ -255,13 +256,10 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
if (xConnection.is())
{
// now we have to set the URL to get the correct answer for metadata()->getURL()
- auto pMetaConnection
- = comphelper::getUnoTunnelImplementation<OMetaConnection>(xConnection);
+ auto pMetaConnection = comphelper::getFromUnoTunnel<OMetaConnection>(xConnection);
if (pMetaConnection)
pMetaConnection->setURL(url);
- m_aConnections.push_back(
- TWeakPair(WeakReferenceHelper(xConnection),
- TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection)));
+ m_aConnections.push_back({ xConnection, nullptr, pMetaConnection });
}
}
}
@@ -280,34 +278,30 @@ sal_Bool SAL_CALL ODriverDelegator::acceptsURL(const OUString& url)
Sequence<DriverPropertyInfo> SAL_CALL
ODriverDelegator::getPropertyInfo(const OUString& url, const Sequence<PropertyValue>& info)
{
- std::vector<DriverPropertyInfo> aDriverInfo;
if (!acceptsURL(url))
return Sequence<DriverPropertyInfo>();
- Sequence<OUString> aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence<OUString> aBoolean{ u"0"_ustr, u"1"_ustr };
- aDriverInfo.push_back(DriverPropertyInfo("CharSet", "CharSet of the database.", false,
- OUString(), Sequence<OUString>()));
- aDriverInfo.push_back(DriverPropertyInfo("SuppressVersionColumns",
- "Display version columns (when available).", false,
- "0", aBoolean));
+ std::vector<DriverPropertyInfo> aDriverInfo{
+ { u"CharSet"_ustr, u"CharSet of the database."_ustr, false, {}, {} },
+ { u"SuppressVersionColumns"_ustr, u"Display version columns (when available)."_ustr, false,
+ u"0"_ustr, aBoolean }
+ };
const T_DRIVERTYPE eType = lcl_getDriverType(url);
if (eType == T_DRIVERTYPE::Jdbc)
{
- aDriverInfo.push_back(DriverPropertyInfo("JavaDriverClass", "The JDBC driver class name.",
- true, getJavaDriverClass(info),
- Sequence<OUString>()));
+ aDriverInfo.emplace_back("JavaDriverClass", "The JDBC driver class name.", true,
+ getJavaDriverClass(info), Sequence<OUString>());
}
else if (eType == T_DRIVERTYPE::Native)
{
- aDriverInfo.push_back(DriverPropertyInfo(
- "LocalSocket", "The file path of a socket to connect to a local MySQL server.", false,
- OUString(), Sequence<OUString>()));
- aDriverInfo.push_back(DriverPropertyInfo(
- "NamedPipe", "The name of a pipe to connect to a local MySQL server.", false,
- OUString(), Sequence<OUString>()));
+ aDriverInfo.emplace_back("LocalSocket",
+ "The file path of a socket to connect to a local MySQL server.",
+ false, OUString(), Sequence<OUString>());
+ aDriverInfo.emplace_back("NamedPipe",
+ "The name of a pipe to connect to a local MySQL server.", false,
+ OUString(), Sequence<OUString>());
}
return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size());
@@ -323,40 +317,38 @@ ODriverDelegator::getDataDefinitionByConnection(const Reference<XConnection>& co
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(ODriverDelegator_BASE::rBHelper.bDisposed);
- Reference<XTablesSupplier> xTab;
- auto pConnection = comphelper::getUnoTunnelImplementation<OMetaConnection>(connection);
+ rtl::Reference<OMySQLCatalog> xTab;
+ auto pConnection = comphelper::getFromUnoTunnel<OMetaConnection>(connection);
if (pConnection)
{
- TWeakPairVector::iterator i
- = std::find_if(m_aConnections.begin(), m_aConnections.end(),
- [&pConnection](const TWeakPairVector::value_type& rConnection) {
- return rConnection.second.second == pConnection;
- });
+ auto i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
+ [&pConnection](const TConnectionInfo& rConnection) {
+ return rConnection.pMetaConn == pConnection;
+ });
if (i != m_aConnections.end())
{
- xTab.set(i->second.first.get(), UNO_QUERY);
+ xTab = i->xCatalog.get();
if (!xTab.is())
{
xTab = new OMySQLCatalog(connection);
- i->second.first = WeakReferenceHelper(xTab);
+ i->xCatalog = xTab.get();
}
}
} // if (pConnection)
if (!xTab.is())
{
- TWeakPairVector::iterator i
- = std::find_if(m_aConnections.begin(), m_aConnections.end(),
- [&connection](const TWeakPairVector::value_type& rConnection) {
- Reference<XConnection> xTemp(rConnection.first.get(), UNO_QUERY);
- return xTemp == connection;
- });
+ auto i = std::find_if(m_aConnections.begin(), m_aConnections.end(),
+ [&connection](const TConnectionInfo& rConnection) {
+ Reference<XConnection> xTemp(rConnection.xConn);
+ return xTemp == connection;
+ });
if (i != m_aConnections.end())
{
- xTab.set(i->second.first.get(), UNO_QUERY);
+ xTab = i->xCatalog.get();
if (!xTab.is())
{
xTab = new OMySQLCatalog(connection);
- i->second.first = WeakReferenceHelper(xTab);
+ i->xCatalog = xTab.get();
}
}
}
@@ -380,7 +372,7 @@ ODriverDelegator::getDataDefinitionByURL(const OUString& url, const Sequence<Pro
OUString SAL_CALL ODriverDelegator::getImplementationName()
{
- return "org.openoffice.comp.drivers.MySQL.Driver";
+ return u"org.openoffice.comp.drivers.MySQL.Driver"_ustr;
}
sal_Bool SAL_CALL ODriverDelegator::supportsService(const OUString& _rServiceName)
@@ -390,7 +382,7 @@ sal_Bool SAL_CALL ODriverDelegator::supportsService(const OUString& _rServiceNam
Sequence<OUString> SAL_CALL ODriverDelegator::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr, u"com.sun.star.sdbcx.Driver"_ustr };
}
} // namespace connectivity
diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
index 374825d32abb..dfb3e37a186f 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
@@ -19,7 +19,6 @@
#include <mysql/YTable.hxx>
#include <mysql/YTables.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <comphelper/property.hxx>
@@ -49,7 +48,7 @@ namespace
class OMySQLKeysHelper : public OKeysHelper
{
protected:
- virtual OUString getDropForeignKey() const override { return " DROP FOREIGN KEY "; }
+ virtual OUString getDropForeignKey() const override { return u" DROP FOREIGN KEY "_ustr; }
public:
OMySQLKeysHelper(OTableHelper* _pTable, ::osl::Mutex& _rMutex,
@@ -117,21 +116,6 @@ sdbcx::OCollection* OMySQLTable::createIndexes(const ::std::vector<OUString>& _r
return new OIndexesHelper(this, m_aMutex, _rNames);
}
-Sequence<sal_Int8> OMySQLTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OMySQLTable::getSomething(const Sequence<sal_Int8>& rId)
-{
- return (isUnoTunnelId<OMySQLTable>(rId)) ? reinterpret_cast<sal_Int64>(this)
- : OTable_TYPEDEF::getSomething(rId);
-}
-
// XAlterTable
void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
const Reference<XPropertySet>& descriptor)
@@ -198,9 +182,9 @@ void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
{
if (sTypeName.indexOf(s_sAutoIncrement) == -1)
{
- sTypeName += OUStringLiteral(u" ") + s_sAutoIncrement;
+ sTypeName += OUString::Concat(" ") + s_sAutoIncrement;
descriptor->setPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME),
- makeAny(sTypeName));
+ Any(sTypeName));
}
}
else
@@ -212,7 +196,7 @@ void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
{
sTypeName = sTypeName.copy(0, nIndex);
descriptor->setPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME),
- makeAny(sTypeName));
+ Any(sTypeName));
}
}
}
@@ -268,18 +252,17 @@ void OMySQLTable::alterColumnType(sal_Int32 nNewType, const OUString& _rColName,
OUString sSql
= getAlterTableColumnPart() + " CHANGE " + ::dbtools::quoteName(sQuote, _rColName) + " ";
- OColumn* pColumn = new OColumn(true);
- Reference<XPropertySet> xProp = pColumn;
- ::comphelper::copyProperties(_xDescriptor, xProp);
- xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),
- makeAny(nNewType));
+ rtl::Reference<OColumn> pColumn = new OColumn(true);
+ ::comphelper::copyProperties(_xDescriptor, pColumn);
+ pColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),
+ Any(nNewType));
sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(
- xProp, getConnection(), static_cast<OTables*>(m_pTables), getTypeCreatePattern()));
+ pColumn, getConnection(), static_cast<OTables*>(m_pTables), getTypeCreatePattern()));
executeStatement(sSql);
}
-OUString OMySQLTable::getTypeCreatePattern() const { return "(M,D)"; }
+OUString OMySQLTable::getTypeCreatePattern() const { return u"(M,D)"_ustr; }
void OMySQLTable::alterDefaultValue(std::u16string_view _sNewDefault, const OUString& _rColName)
{
@@ -301,7 +284,7 @@ void OMySQLTable::dropDefaultValue(const OUString& _rColName)
OUString OMySQLTable::getAlterTableColumnPart() const
{
- OUString sSql("ALTER TABLE ");
+ OUString sSql(u"ALTER TABLE "_ustr);
OUString sComposedName(
::dbtools::composeTableName(getMetaData(), m_CatalogName, m_SchemaName, m_Name, true,
@@ -315,7 +298,7 @@ void OMySQLTable::executeStatement(const OUString& _rStatement)
{
OUString sSQL = _rStatement;
if (sSQL.endsWith(","))
- sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, ")");
+ sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, u")");
Reference<XStatement> xStmt = getConnection()->createStatement();
if (xStmt.is())
@@ -325,6 +308,6 @@ void OMySQLTable::executeStatement(const OUString& _rStatement)
}
}
-OUString OMySQLTable::getRenameStart() const { return "RENAME TABLE "; }
+OUString OMySQLTable::getRenameStart() const { return u"RENAME TABLE "_ustr; }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql_jdbc/YTables.cxx b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
index e21e05fb2914..b333db670623 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTables.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
@@ -37,26 +37,24 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace dbtools;
-sdbcx::ObjectType OTables::createObject(const OUString& _rName)
+css::uno::Reference<css::beans::XPropertySet> OTables::createObject(const OUString& _rName)
{
OUString sCatalog, sSchema, sTable;
::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable,
::dbtools::EComposeRule::InDataManipulation);
- Sequence<OUString> sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else...
+ Sequence<OUString> sTableTypes{
+ u"VIEW"_ustr, u"TABLE"_ustr, u"%"_ustr
+ }; // this last one just to be sure to include anything else...
Any aCatalog;
if (!sCatalog.isEmpty())
aCatalog <<= sCatalog;
Reference<XResultSet> xResult = m_xMetaData->getTables(aCatalog, sSchema, sTable, sTableTypes);
- sdbcx::ObjectType xRet;
+ rtl::Reference<OMySQLTable> xRet;
if (xResult.is())
{
Reference<XRow> xRow(xResult, UNO_QUERY);
@@ -67,10 +65,9 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName)
| Privilege::UPDATE | Privilege::INSERT
| Privilege::SELECT;
- OMySQLTable* pRet = new OMySQLTable(
- this, static_cast<OMySQLCatalog&>(m_rParent).getConnection(), sTable,
- xRow->getString(4), xRow->getString(5), sSchema, sCatalog, nPrivileges);
- xRet = pRet;
+ xRet = new OMySQLTable(this, static_cast<OMySQLCatalog&>(m_rParent).getConnection(),
+ sTable, xRow->getString(4), xRow->getString(5), sSchema,
+ sCatalog, nPrivileges);
}
::comphelper::disposeComponent(xResult);
}
@@ -92,8 +89,8 @@ Reference<XPropertySet> OTables::createDescriptor()
}
// XAppend
-sdbcx::ObjectType OTables::appendObject(const OUString& _rForName,
- const Reference<XPropertySet>& descriptor)
+css::uno::Reference<css::beans::XPropertySet>
+OTables::appendObject(const OUString& _rForName, const Reference<XPropertySet>& descriptor)
{
createTable(descriptor);
return createObject(_rForName);
@@ -113,7 +110,7 @@ void OTables::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
::dbtools::qualifiedNameComponents(m_xMetaData, _sElementName, sCatalog, sSchema, sTable,
::dbtools::EComposeRule::InDataManipulation);
- OUString aSql("DROP ");
+ OUString aSql(u"DROP "_ustr);
Reference<XPropertySet> xProp(xObject, UNO_QUERY);
bool bIsView = xProp.is()
@@ -155,7 +152,7 @@ OUString OTables::adjustSQL(const OUString& _sSql)
sal_Int32 nPos = nIndex + strlen(s_sUNSIGNED);
OUString sNewUnsigned(sSQL.copy(nPos, nParen - nPos + 1));
sSQL = sSQL.replaceAt(nIndex, strlen(s_sUNSIGNED) + sNewUnsigned.getLength(),
- sNewUnsigned + s_sUNSIGNED);
+ rtl::Concat2View(sNewUnsigned + s_sUNSIGNED));
nIndex = sSQL.indexOf(s_sUNSIGNED, nIndex + strlen(s_sUNSIGNED) + sNewUnsigned.getLength());
}
return sSQL;
@@ -180,13 +177,13 @@ void OTables::appendNew(const OUString& _rsNewTable)
insertElement(_rsNewTable, nullptr);
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners);
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rsNewTable), Any(), Any());
+ OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
+ aListenerLoop.next()->elementInserted(aEvent);
}
-OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
+OUString OTables::getNameForObject(const css::uno::Reference<css::beans::XPropertySet>& _xObject)
{
OSL_ENSURE(_xObject.is(), "OTables::getNameForObject: Object is NULL!");
return ::dbtools::composeTableName(m_xMetaData, _xObject,
diff --git a/connectivity/source/drivers/mysql_jdbc/YUser.cxx b/connectivity/source/drivers/mysql_jdbc/YUser.cxx
index b683fe2b2757..6944aa7e4c3f 100644
--- a/connectivity/source/drivers/mysql_jdbc/YUser.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YUser.cxx
@@ -27,6 +27,7 @@
#include <TConnection.hxx>
#include <strings.hrc>
#include <comphelper/types.hxx>
+#include <utility>
using namespace connectivity;
using namespace connectivity::mysql;
@@ -37,17 +38,17 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-OMySQLUser::OMySQLUser(const css::uno::Reference<css::sdbc::XConnection>& _xConnection)
+OMySQLUser::OMySQLUser(css::uno::Reference<css::sdbc::XConnection> _xConnection)
: connectivity::sdbcx::OUser(true)
- , m_xConnection(_xConnection)
+ , m_xConnection(std::move(_xConnection))
{
construct();
}
-OMySQLUser::OMySQLUser(const css::uno::Reference<css::sdbc::XConnection>& _xConnection,
+OMySQLUser::OMySQLUser(css::uno::Reference<css::sdbc::XConnection> _xConnection,
const OUString& Name)
: connectivity::sdbcx::OUser(Name, true)
- , m_xConnection(_xConnection)
+ , m_xConnection(std::move(_xConnection))
{
construct();
}
@@ -116,7 +117,7 @@ void OMySQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_I
Any aCatalog;
if (!sCatalog.isEmpty())
aCatalog <<= sCatalog;
- xRes = xMeta->getColumnPrivileges(aCatalog, sSchema, sTable, "%");
+ xRes = xMeta->getColumnPrivileges(aCatalog, sSchema, sTable, u"%"_ustr);
}
break;
}
diff --git a/connectivity/source/drivers/mysql_jdbc/YUsers.cxx b/connectivity/source/drivers/mysql_jdbc/YUsers.cxx
index 17fc788179c1..43a032d35ff0 100644
--- a/connectivity/source/drivers/mysql_jdbc/YUsers.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YUsers.cxx
@@ -23,6 +23,7 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <TConnection.hxx>
+#include <utility>
using namespace ::comphelper;
using namespace connectivity;
@@ -30,37 +31,31 @@ using namespace connectivity::mysql;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OUsers::OUsers(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::std::vector<OUString>& _rVector,
- const css::uno::Reference<css::sdbc::XConnection>& _xConnection,
+ css::uno::Reference<css::sdbc::XConnection> _xConnection,
connectivity::sdbcx::IRefreshableUsers* _pParent)
: sdbcx::OCollection(_rParent, true, _rMutex, _rVector)
- , m_xConnection(_xConnection)
+ , m_xConnection(std::move(_xConnection))
, m_pParent(_pParent)
{
}
-sdbcx::ObjectType OUsers::createObject(const OUString& _rName)
+css::uno::Reference<css::beans::XPropertySet> OUsers::createObject(const OUString& _rName)
{
return new OMySQLUser(m_xConnection, _rName);
}
void OUsers::impl_refresh() { m_pParent->refreshUsers(); }
-Reference<XPropertySet> OUsers::createDescriptor()
-{
- OUserExtend* pNew = new OUserExtend(m_xConnection);
- return pNew;
-}
+Reference<XPropertySet> OUsers::createDescriptor() { return new OUserExtend(m_xConnection); }
// XAppend
-sdbcx::ObjectType OUsers::appendObject(const OUString& _rForName,
- const Reference<XPropertySet>& descriptor)
+css::uno::Reference<css::beans::XPropertySet>
+OUsers::appendObject(const OUString& _rForName, const Reference<XPropertySet>& descriptor)
{
- OUString aSql("GRANT USAGE ON * TO ");
+ OUString aSql(u"GRANT USAGE ON * TO "_ustr);
OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString();
aSql += ::dbtools::quoteName(aQuote, _rForName) + " @\"%\" ";
OUString sPassword;
@@ -82,7 +77,7 @@ sdbcx::ObjectType OUsers::appendObject(const OUString& _rForName,
// XDrop
void OUsers::dropObject(sal_Int32 /*_nPos*/, const OUString& _sElementName)
{
- OUString aSql("DROP USER ");
+ OUString aSql(u"DROP USER "_ustr);
OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString();
aSql += ::dbtools::quoteName(aQuote, _sElementName);
diff --git a/connectivity/source/drivers/mysql_jdbc/YViews.cxx b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
index 4bdeca9596b3..6fbeaeef25ba 100644
--- a/connectivity/source/drivers/mysql_jdbc/YViews.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
@@ -32,14 +32,11 @@ using namespace connectivity;
using namespace connectivity::mysql;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace dbtools;
typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-sdbcx::ObjectType OViews::createObject(const OUString& _rName)
+css::uno::Reference<css::beans::XPropertySet> OViews::createObject(const OUString& _rName)
{
OUString sCatalog, sSchema, sTable;
::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable,
@@ -59,14 +56,14 @@ void OViews::disposing()
Reference<XPropertySet> OViews::createDescriptor()
{
Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- connectivity::sdbcx::OView* pNew
+ rtl::Reference<connectivity::sdbcx::OView> pNew
= new connectivity::sdbcx::OView(true, xConnection->getMetaData());
return pNew;
}
// XAppend
-sdbcx::ObjectType OViews::appendObject(const OUString& _rForName,
- const Reference<XPropertySet>& descriptor)
+css::uno::Reference<css::beans::XPropertySet>
+OViews::appendObject(const OUString& _rForName, const Reference<XPropertySet>& descriptor)
{
createView(descriptor);
return createObject(_rForName);
@@ -83,7 +80,7 @@ void OViews::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
if (bIsNew)
return;
- OUString aSql("DROP VIEW");
+ OUString aSql(u"DROP VIEW"_ustr);
Reference<XPropertySet> xProp(xObject, UNO_QUERY);
aSql += ::dbtools::composeTableName(m_xMetaData, xProp,
@@ -106,7 +103,7 @@ void OViews::createView(const Reference<XPropertySet>& descriptor)
{
Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- OUString aSql("CREATE VIEW ");
+ OUString aSql(u"CREATE VIEW "_ustr);
OUString sCommand;
aSql += ::dbtools::composeTableName(m_xMetaData, descriptor,
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx b/connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx
new file mode 100644
index 000000000000..dfe88d9b4b17
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mysqlc_catalog.hxx"
+#include "mysqlc_tables.hxx"
+#include "mysqlc_views.hxx"
+#include "mysqlc_users.hxx"
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <comphelper/types.hxx>
+
+connectivity::mysqlc::Catalog::Catalog(
+ const css::uno::Reference<css::sdbc::XConnection>& rConnection)
+ : OCatalog(rConnection)
+ , m_xConnection(rConnection)
+{
+}
+
+//----- OCatalog -------------------------------------------------------------
+void connectivity::mysqlc::Catalog::refreshTables()
+{
+ css::uno::Reference<css::sdbc::XResultSet> xTables
+ = m_xMetaData->getTables(css::uno::Any(), u"%"_ustr, u"%"_ustr, {});
+
+ if (!xTables.is())
+ return;
+
+ ::std::vector<OUString> aTableNames;
+
+ fillNames(xTables, aTableNames);
+
+ if (!m_pTables)
+ m_pTables.reset(new Tables(m_xConnection->getMetaData(), *this, m_aMutex, aTableNames));
+ else
+ m_pTables->reFill(aTableNames);
+}
+
+void connectivity::mysqlc::Catalog::refreshViews()
+{
+ css::uno::Reference<css::sdbc::XResultSet> xViews
+ = m_xMetaData->getTables(css::uno::Any(), u"%"_ustr, u"%"_ustr, { u"VIEW"_ustr });
+
+ if (!xViews.is())
+ return;
+
+ ::std::vector<OUString> aViewNames;
+
+ fillNames(xViews, aViewNames);
+
+ if (!m_pViews)
+ m_pViews.reset(new Views(m_xConnection, *this, m_aMutex, aViewNames));
+ else
+ m_pViews->reFill(aViewNames);
+}
+
+//----- IRefreshableGroups ---------------------------------------------------
+void connectivity::mysqlc::Catalog::refreshGroups()
+{
+ // TODO: implement me
+}
+
+//----- IRefreshableUsers ----------------------------------------------------
+void connectivity::mysqlc::Catalog::refreshUsers()
+{
+ css::uno::Reference<css::sdbc::XStatement> statement = m_xConnection->createStatement();
+ css::uno::Reference<css::sdbc::XResultSet> xUsers = statement->executeQuery(
+ u"SELECT grantee FROM information_schema.user_privileges GROUP BY grantee"_ustr);
+
+ if (!xUsers.is())
+ return;
+
+ ::std::vector<OUString> aUserNames;
+
+ css::uno::Reference<css::sdbc::XRow> xRow(xUsers, css::uno::UNO_QUERY);
+ while (xUsers->next())
+ {
+ aUserNames.push_back(xRow->getString(1));
+ }
+ xRow.clear();
+ ::comphelper::disposeComponent(xUsers);
+
+ if (!m_pUsers)
+ m_pUsers.reset(new Users(m_xConnection->getMetaData(), *this, m_aMutex, aUserNames));
+ else
+ m_pUsers->reFill(aUserNames);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_catalog.hxx b/connectivity/source/drivers/mysqlc/mysqlc_catalog.hxx
new file mode 100644
index 000000000000..1bea18c7667b
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_catalog.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sdbcx/VCatalog.hxx>
+
+namespace connectivity::mysqlc
+{
+class Catalog : public ::connectivity::sdbcx::OCatalog
+{
+ css::uno::Reference<css::sdbc::XConnection> m_xConnection;
+
+public:
+ explicit Catalog(const css::uno::Reference<css::sdbc::XConnection>& rConnection);
+
+ // OCatalog
+ virtual void refreshTables() override;
+ virtual void refreshViews() override;
+
+ // IRefreshableGroups
+ virtual void refreshGroups() override;
+
+ // IRefreshableUsers
+ virtual void refreshUsers() override;
+
+ sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); }
+};
+
+} // namespace connectivity::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_column.cxx b/connectivity/source/drivers/mysqlc/mysqlc_column.cxx
new file mode 100644
index 000000000000..953d4117c247
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_column.cxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mysqlc_column.hxx"
+
+#include <TConnection.hxx>
+
+connectivity::mysqlc::Column::Column()
+ : OColumn(true) // case sensitive
+{
+ construct();
+}
+
+void connectivity::mysqlc::Column::construct()
+{
+ m_sAutoIncrement = "auto_increment";
+ registerProperty(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION),
+ PROPERTY_ID_AUTOINCREMENTCREATION, 0, &m_sAutoIncrement,
+ cppu::UnoType<decltype(m_sAutoIncrement)>::get());
+}
+
+::cppu::IPropertyArrayHelper*
+ connectivity::mysqlc::Column::createArrayHelper(sal_Int32 /*_nId*/) const
+{
+ return doCreateArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper& SAL_CALL connectivity::mysqlc::Column::getInfoHelper()
+{
+ return *Column_PROP::getArrayHelper(isNew() ? 1 : 0);
+}
+
+css::uno::Sequence<OUString> SAL_CALL connectivity::mysqlc::Column::getSupportedServiceNames()
+{
+ return { u"com.sun.star.sdbcx.Column"_ustr };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_column.hxx b/connectivity/source/drivers/mysqlc/mysqlc_column.hxx
new file mode 100644
index 000000000000..f69ef1afcea7
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_column.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <connectivity/sdbcx/VColumn.hxx>
+
+namespace connectivity::mysqlc
+{
+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;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_columns.cxx b/connectivity/source/drivers/mysqlc/mysqlc_columns.cxx
new file mode 100644
index 000000000000..b34b36b45cbe
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_columns.cxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mysqlc_columns.hxx"
+#include "mysqlc_column.hxx"
+
+connectivity::mysqlc::Columns::Columns(Table& rTable, osl::Mutex& rMutex,
+ const ::std::vector<OUString>& rVector)
+ : OColumnsHelper(rTable,
+ true, // case sensitivity
+ rMutex, rVector,
+ /*bUseHardRef*/ true)
+{
+ OColumnsHelper::setParent(&rTable);
+}
+
+css::uno::Reference<css::beans::XPropertySet> connectivity::mysqlc::Columns::createDescriptor()
+{
+ return new Column;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_columns.hxx b/connectivity/source/drivers/mysqlc/mysqlc_columns.hxx
new file mode 100644
index 000000000000..34230db37bb5
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_columns.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "mysqlc_table.hxx"
+
+#include <connectivity/TColumnsHelper.hxx>
+
+namespace connectivity::mysqlc
+{
+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::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 600e131b89b1..631208f70293 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -17,8 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "mysqlc_catalog.hxx"
#include "mysqlc_connection.hxx"
#include "mysqlc_databasemetadata.hxx"
+#include <com/sun/star/sdbc/SQLException.hpp>
#include "mysqlc_driver.hxx"
#include "mysqlc_statement.hxx"
@@ -27,20 +29,17 @@
#include <com/sun/star/beans/NamedValue.hpp>
-#include <osl/diagnose.h>
-#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/servicehelper.hxx>
using namespace connectivity::mysqlc;
using namespace com::sun::star::uno;
using namespace com::sun::star::container;
-using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
using ::osl::MutexGuard;
-#define MYSQLC_URI_PREFIX "sdbc:mysqlc:"
-
namespace
{
void lcl_executeUpdate(MYSQL* pMySql, const OString& sql)
@@ -53,6 +52,7 @@ void lcl_executeUpdate(MYSQL* pMySql, const OString& sql)
OConnection::OConnection(MysqlCDriver& _rDriver)
: OMetaConnection_BASE(m_aMutex)
, m_mysql()
+ , m_xCatalog(nullptr)
, m_xMetaData(nullptr)
, m_xDriver(&_rDriver)
{
@@ -73,15 +73,12 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
mysql_library_init(0, nullptr, nullptr);
mysql_init(&m_mysql);
- // use TCP as connection
- mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
- mysql_options(&m_mysql, MYSQL_OPT_PROTOCOL, &protocol);
- OString charset_name{ "utf8mb4" };
+ OString charset_name{ "utf8mb4"_ostr };
mysql_options(&m_mysql, MYSQL_SET_CHARSET_NAME, charset_name.getStr());
sal_Int32 nIndex;
OUString token;
- OUString aHostName("localhost");
+ OUString aHostName(u"localhost"_ustr);
sal_Int32 nPort = 3306;
OUString aDbName;
@@ -90,7 +87,7 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
// parse url. Url has the following format:
// external server: sdbc:mysqlc:[hostname]:[port]/[dbname]
- if (url.startsWith(MYSQLC_URI_PREFIX))
+ if (url.startsWith("sdbc:mysqlc:"))
{
nIndex = 12;
}
@@ -164,15 +161,22 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
OString pass_str = OUStringToOString(aPass, m_settings.encoding);
OString schema_str = OUStringToOString(aDbName, m_settings.encoding);
OString socket_str;
+
+ // use TCP as connection by default
+ mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
if (unixSocketPassed)
{
socket_str = OUStringToOString(sUnixSocket, m_settings.encoding);
+ protocol = MYSQL_PROTOCOL_SOCKET;
}
else if (namedPipePassed)
{
socket_str = OUStringToOString(sNamedPipe, m_settings.encoding);
+ protocol = MYSQL_PROTOCOL_PIPE;
}
+ mysql_options(&m_mysql, MYSQL_OPT_PROTOCOL, &protocol);
+
// flags can also be passed as last parameter
if (!mysql_real_connect(&m_mysql, host_str.getStr(), user_str.getStr(), pass_str.getStr(),
schema_str.getStr(), nPort, socket_str.getStr(),
@@ -184,23 +188,22 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
// Check if the server is 4.1 or above
if (getMysqlVersion() < 40100)
{
- throw SQLException("MariaDB LibreOffice Connector requires MySQL Server 4.1 or above",
+ throw SQLException(u"MariaDB LibreOffice Connector requires MySQL Server 4.1 or above"_ustr,
*this, OUString(), 0, Any());
}
- lcl_executeUpdate(&m_mysql,
- OString{ "SET session sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'" });
- lcl_executeUpdate(&m_mysql, OString{ "SET NAMES utf8mb4" });
+ lcl_executeUpdate(&m_mysql, "SET session sql_mode='ANSI_QUOTES,NO_AUTO_VALUE_ON_ZERO'"_ostr);
+ lcl_executeUpdate(&m_mysql, "SET NAMES utf8mb4"_ostr);
}
OUString OConnection::getImplementationName()
{
- return "com.sun.star.sdbc.drivers.mysqlc.OConnection";
+ return u"com.sun.star.sdbc.drivers.mysqlc.OConnection"_ustr;
}
css::uno::Sequence<OUString> OConnection::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.Connection" };
+ return { u"com.sun.star.sdbc.Connection"_ustr };
}
sal_Bool OConnection::supportsService(OUString const& ServiceName)
@@ -215,8 +218,8 @@ Reference<XStatement> SAL_CALL OConnection::createStatement()
// create a statement
// the statement can only be executed once
- Reference<XStatement> xReturn = new OStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ rtl::Reference<OStatement> xReturn = new OStatement(this);
+ m_aStatements.push_back(xReturn.get());
return xReturn;
}
@@ -237,8 +240,8 @@ Reference<XPreparedStatement> SAL_CALL OConnection::prepareStatement(const OUStr
mysql_sqlstate(&m_mysql), nErrorNum, *this,
getConnectionEncoding());
- Reference<XPreparedStatement> xStatement = new OPreparedStatement(this, pStmt);
- m_aStatements.push_back(WeakReferenceHelper(xStatement));
+ rtl::Reference<OPreparedStatement> xStatement = new OPreparedStatement(this, pStmt);
+ m_aStatements.push_back(xStatement.get());
return xStatement;
}
@@ -253,8 +256,6 @@ Reference<XPreparedStatement> SAL_CALL OConnection::prepareCall(const OUString&
OUString SAL_CALL OConnection::nativeSQL(const OUString& /*_sSql*/)
{
- MutexGuard aGuard(m_aMutex);
-
// const OUString sSqlStatement = transFormPreparedStatement( _sSql );
// TODO
return OUString();
@@ -431,7 +432,7 @@ void OConnection::disposing()
for (auto const& statement : m_aStatements)
{
- Reference<XComponent> xComp(statement.get(), UNO_QUERY);
+ rtl::Reference<OCommonStatement> xComp(statement.get());
if (xComp.is())
{
xComp->dispose();
@@ -460,13 +461,12 @@ OUString OConnection::transFormPreparedStatement(const OUString& _sSQL)
{
try
{
- Sequence<Any> aArgs(1);
Reference<XConnection> xCon = this;
- aArgs[0] <<= NamedValue("ActiveConnection", makeAny(xCon));
+ Sequence<Any> aArgs{ Any(NamedValue(u"ActiveConnection"_ustr, Any(xCon))) };
m_xParameterSubstitution.set(
m_xDriver->getFactory()->createInstanceWithArguments(
- "org.openoffice.comp.helper.ParameterSubstitution", aArgs),
+ u"org.openoffice.comp.helper.ParameterSubstitution"_ustr, aArgs),
UNO_QUERY);
}
catch (const Exception&)
@@ -486,4 +486,36 @@ OUString OConnection::transFormPreparedStatement(const OUString& _sSQL)
return sSqlStatement;
}
+//----- XUnoTunnel ----------------------------------------------------------
+// virtual
+sal_Int64 SAL_CALL OConnection::getSomething(const css::uno::Sequence<sal_Int8>& rId)
+{
+ return comphelper::getSomethingImpl(rId, this);
+}
+
+// static
+const Sequence<sal_Int8>& OConnection::getUnoTunnelId()
+{
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
+}
+
+Reference<XTablesSupplier> OConnection::createCatalog()
+{
+ MutexGuard aGuard(m_aMutex);
+
+ // m_xCatalog is a weak reference. Reuse it if it still exists.
+ Reference<XTablesSupplier> xCatalog = m_xCatalog;
+ if (xCatalog.is())
+ {
+ return xCatalog;
+ }
+ else
+ {
+ xCatalog = new Catalog(this);
+ m_xCatalog = xCatalog;
+ return m_xCatalog;
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
index 283b1d964d4b..dd7138fff464 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
@@ -17,29 +17,27 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_CONNECTION_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_CONNECTION_HXX
+#pragma once
#include <memory>
#include "mysqlc_subcomponent.hxx"
#include "mysqlc_types.hxx"
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/sdbc/ColumnSearch.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
-#include <cppuhelper/compbase3.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <rtl/string.hxx>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase.hxx>
#include <rtl/ref.hxx>
+#include <unotools/weakref.hxx>
#include <mysql.h>
@@ -57,12 +55,10 @@ class ODatabaseMetaData;
namespace mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
-using ::com::sun::star::sdbc::SQLWarning;
-using ::com::sun::star::uno::RuntimeException;
+class OCommonStatement;
-typedef ::cppu::WeakComponentImplHelper3<css::sdbc::XConnection, css::sdbc::XWarningsSupplier,
- css::lang::XServiceInfo>
+typedef ::cppu::WeakComponentImplHelper<css::sdbc::XConnection, css::sdbc::XWarningsSupplier,
+ css::lang::XUnoTunnel, css::lang::XServiceInfo>
OMetaConnection_BASE;
struct ConnectionSettings
@@ -81,9 +77,7 @@ class MysqlCDriver;
typedef OMetaConnection_BASE OConnection_BASE;
-typedef std::vector<css::uno::WeakReferenceHelper> OWeakRefArray;
-
-class OConnection final : public OBase_Mutex, public OConnection_BASE
+class OConnection final : public cppu::BaseMutex, public OConnection_BASE
{
private:
MYSQL m_mysql;
@@ -93,11 +87,11 @@ private:
// Data attributes
+ css::uno::WeakReference<css::sdbcx::XTablesSupplier> m_xCatalog;
css::uno::WeakReference<css::sdbc::XDatabaseMetaData> m_xMetaData;
- OWeakRefArray m_aStatements; // vector containing a list
- // of all the Statement objects
- // for this Connection
+ // vector containing a list of all the Statement objects for this Connection.
+ std::vector<unotools::WeakReference<OCommonStatement>> m_aStatements;
rtl::Reference<MysqlCDriver> m_xDriver; // Pointer to the owning driver object
public:
@@ -115,6 +109,12 @@ public:
rtl_TextEncoding getConnectionEncoding() const { return m_settings.encoding; }
+ /**
+ * Create and/or connect to the sdbcx Catalog. This is completely
+ * unrelated to the SQL "Catalog".
+ */
+ css::uno::Reference<css::sdbcx::XTablesSupplier> createCatalog();
+
// OComponentHelper
virtual void SAL_CALL disposing() override;
@@ -125,6 +125,10 @@ public:
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) override;
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
+
// XConnection
css::uno::Reference<css::sdbc::XStatement> SAL_CALL createStatement() override;
@@ -182,6 +186,5 @@ public:
//inline OUString getPattern(OUString p) { return (p.getLength()) ? p : ASC2OU("%"); }
} /* mysqlc */
} /* connectivity */
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_CONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index 77e20700b135..c3c073f276b2 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/sdbc/Deferrability.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <comphelper/sequence.hxx>
+#include <o3tl/string_view.hxx>
#include <sal/log.hxx>
#include <rtl/ustrbuf.hxx>
@@ -32,7 +33,6 @@
using namespace connectivity::mysqlc;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
static std::string wild("%");
@@ -41,8 +41,6 @@ static void lcl_setRows_throw(const Reference<XResultSet>& _xResultSet, sal_Int3
const std::vector<std::vector<Any>>& _rRows)
{
Reference<XInitialization> xIni(_xResultSet, UNO_QUERY);
- Sequence<Any> aArgs(2);
- aArgs[0] <<= _nType;
Sequence<Sequence<Any>> aRows(_rRows.size());
@@ -55,7 +53,7 @@ static void lcl_setRows_throw(const Reference<XResultSet>& _xResultSet, sal_Int3
}
++pRowsIter;
}
- aArgs[1] <<= aRows;
+ Sequence<Any> aArgs{ Any(_nType), Any(aRows) };
xIni->initialize(aArgs);
}
@@ -160,11 +158,11 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength() { return 256; }
sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns() { return true; }
-OUString SAL_CALL ODatabaseMetaData::getCatalogTerm() { return "n/a"; }
+OUString SAL_CALL ODatabaseMetaData::getCatalogTerm() { return u"n/a"_ustr; }
-OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString() { return "\""; }
+OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString() { return u"`"_ustr; }
-OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters() { return "#@"; }
+OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters() { return u"#@"_ustr; }
sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames() { return true; }
@@ -351,7 +349,7 @@ OUString SAL_CALL ODatabaseMetaData::getURL()
OUString SAL_CALL ODatabaseMetaData::getUserName()
{
Reference<XStatement> statement = m_rConnection.createStatement();
- Reference<XResultSet> rs = statement->executeQuery("select user()");
+ Reference<XResultSet> rs = statement->executeQuery(u"select user()"_ustr);
Reference<XRow> xRow(rs, UNO_QUERY_THROW);
(void)rs->next(); // the first and only result
// e.g. root@localhost
@@ -365,9 +363,9 @@ OUString SAL_CALL ODatabaseMetaData::getUserName()
return userWithConnection;
}
-OUString SAL_CALL ODatabaseMetaData::getDriverName() { return "MySQL Connector/OO.org"; }
+OUString SAL_CALL ODatabaseMetaData::getDriverName() { return u"MySQL Connector/OO.org"_ustr; }
-OUString SAL_CALL ODatabaseMetaData::getDriverVersion() { return "0.9.2"; }
+OUString SAL_CALL ODatabaseMetaData::getDriverVersion() { return u"0.9.2"_ustr; }
OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion()
{
@@ -375,11 +373,11 @@ OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion()
m_rConnection.getConnectionEncoding());
}
-OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName() { return "MySQL"; }
+OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName() { return u"MySQL"_ustr; }
-OUString SAL_CALL ODatabaseMetaData::getProcedureTerm() { return "procedure"; }
+OUString SAL_CALL ODatabaseMetaData::getProcedureTerm() { return u"procedure"_ustr; }
-OUString SAL_CALL ODatabaseMetaData::getSchemaTerm() { return "database"; }
+OUString SAL_CALL ODatabaseMetaData::getSchemaTerm() { return u"database"_ustr; }
sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion()
{
@@ -402,7 +400,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion()
OUString SAL_CALL ODatabaseMetaData::getSQLKeywords()
{
- return "ACCESSIBLE, ADD, ALL,"
+ return u"ACCESSIBLE, ADD, ALL,"
"ALTER, ANALYZE, AND, AS, ASC, ASENSITIVE, BEFORE,"
"BETWEEN, BIGINT, BINARY, BLOB, BOTH, BY, CALL,"
"CASCADE, CASE, CHANGE, CHAR, CHARACTER, CHECK,"
@@ -444,43 +442,43 @@ OUString SAL_CALL ODatabaseMetaData::getSQLKeywords()
"VARCHARACTER, VARYING, WHEN, WHERE, WHILE, WITH,"
"WRITE, X509, XOR, YEAR_MONTH, ZEROFILL"
"GENERAL, IGNORE_SERVER_IDS, MASTER_HEARTBEAT_PERIOD,"
- "MAXVALUE, RESIGNAL, SIGNAL, SLOW";
+ "MAXVALUE, RESIGNAL, SIGNAL, SLOW"_ustr;
}
-OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape() { return "\\"; }
+OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape() { return u"\\"_ustr; }
OUString SAL_CALL ODatabaseMetaData::getStringFunctions()
{
- return "ASCII,BIN,BIT_LENGTH,CHAR,CHARACTER_LENGTH,CHAR_LENGTH,CONCAT,"
+ return u"ASCII,BIN,BIT_LENGTH,CHAR,CHARACTER_LENGTH,CHAR_LENGTH,CONCAT,"
"CONCAT_WS,CONV,ELT,EXPORT_SET,FIELD,FIND_IN_SET,HEX,INSERT,"
"INSTR,LCASE,LEFT,LENGTH,LOAD_FILE,LOCATE,LOCATE,LOWER,LPAD,"
"LTRIM,MAKE_SET,MATCH,MID,OCT,OCTET_LENGTH,ORD,POSITION,"
"QUOTE,REPEAT,REPLACE,REVERSE,RIGHT,RPAD,RTRIM,SOUNDEX,"
"SPACE,STRCMP,SUBSTRING,SUBSTRING,SUBSTRING,SUBSTRING,"
- "SUBSTRING_INDEX,TRIM,UCASE,UPPER";
+ "SUBSTRING_INDEX,TRIM,UCASE,UPPER"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions()
{
- return "DAYOFWEEK,WEEKDAY,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,"
+ return u"DAYOFWEEK,WEEKDAY,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,"
"MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,PERIOD_ADD,"
"PERIOD_DIFF,TO_DAYS,FROM_DAYS,DATE_FORMAT,TIME_FORMAT,"
"CURDATE,CURRENT_DATE,CURTIME,CURRENT_TIME,NOW,SYSDATE,"
"CURRENT_TIMESTAMP,UNIX_TIMESTAMP,FROM_UNIXTIME,"
- "SEC_TO_TIME,TIME_TO_SEC";
+ "SEC_TO_TIME,TIME_TO_SEC"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getSystemFunctions()
{
- return "DATABASE,USER,SYSTEM_USER,"
- "SESSION_USER,PASSWORD,ENCRYPT,LAST_INSERT_ID,VERSION";
+ return u"DATABASE,USER,SYSTEM_USER,"
+ "SESSION_USER,PASSWORD,ENCRYPT,LAST_INSERT_ID,VERSION"_ustr;
}
OUString SAL_CALL ODatabaseMetaData::getNumericFunctions()
{
- return "ABS,ACOS,ASIN,ATAN,ATAN2,BIT_COUNT,CEILING,COS,"
+ return u"ABS,ACOS,ASIN,ATAN,ATAN2,BIT_COUNT,CEILING,COS,"
"COT,DEGREES,EXP,FLOOR,LOG,LOG10,MAX,MIN,MOD,PI,POW,"
- "POWER,RADIANS,RAND,ROUND,SIN,SQRT,TAN,TRUNCATE";
+ "POWER,RADIANS,RAND,ROUND,SIN,SQRT,TAN,TRUNCATE"_ustr;
}
sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar() { return false; }
@@ -555,9 +553,10 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTableTypes()
const char* const table_types[] = { "TABLE", "VIEW" };
sal_Int32 const requiredVersion[] = { 0, 50000 };
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
@@ -565,9 +564,8 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTableTypes()
{
if (m_rConnection.getMysqlVersion() >= requiredVersion[i])
{
- std::vector<Any> aRow{ Any() };
- aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(table_types[i], encoding)));
- rRows.push_back(aRow);
+ rRows.push_back(
+ { { Any(), Any(mysqlc_sdbc_driver::convert(table_types[i], encoding)) } });
}
}
lcl_setRows_throw(xResultSet, 5, rRows);
@@ -576,9 +574,10 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTableTypes()
Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTypeInfo()
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
@@ -586,32 +585,19 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTypeInfo()
unsigned int i = 0;
while (mysqlc_types[i].typeName)
{
- std::vector<Any> aRow{ Any() };
-
- aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].typeName, encoding)));
- aRow.push_back(makeAny(mysqlc_types[i].dataType));
- aRow.push_back(makeAny(mysqlc_types[i].precision));
- aRow.push_back(
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalPrefix, encoding)));
- aRow.push_back(
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalSuffix, encoding)));
- aRow.push_back(
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].createParams, encoding)));
- aRow.push_back(makeAny(mysqlc_types[i].nullable));
- aRow.push_back(makeAny(mysqlc_types[i].caseSensitive));
- aRow.push_back(makeAny(mysqlc_types[i].searchable));
- aRow.push_back(makeAny(mysqlc_types[i].isUnsigned));
- aRow.push_back(makeAny(mysqlc_types[i].fixedPrecScale));
- aRow.push_back(makeAny(mysqlc_types[i].autoIncrement));
- aRow.push_back(
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].localTypeName, encoding)));
- aRow.push_back(makeAny(mysqlc_types[i].minScale));
- aRow.push_back(makeAny(mysqlc_types[i].maxScale));
- aRow.push_back(makeAny(sal_Int32(0)));
- aRow.push_back(makeAny(sal_Int32(0)));
- aRow.push_back(makeAny(sal_Int32(10)));
+ rRows.push_back(
+ { { Any(), Any(mysqlc_sdbc_driver::convert(mysqlc_types[i].typeName, encoding)),
+ Any(mysqlc_types[i].dataType), Any(mysqlc_types[i].precision),
+ Any(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalPrefix, encoding)),
+ Any(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalSuffix, encoding)),
+ Any(mysqlc_sdbc_driver::convert(mysqlc_types[i].createParams, encoding)),
+ Any(mysqlc_types[i].nullable), Any(mysqlc_types[i].caseSensitive),
+ Any(mysqlc_types[i].searchable), Any(mysqlc_types[i].isUnsigned),
+ Any(mysqlc_types[i].fixedPrecScale), Any(mysqlc_types[i].autoIncrement),
+ Any(mysqlc_sdbc_driver::convert(mysqlc_types[i].localTypeName, encoding)),
+ Any(mysqlc_types[i].minScale), Any(mysqlc_types[i].maxScale), Any(sal_Int32(0)),
+ Any(sal_Int32(0)), Any(sal_Int32(10)) } });
- rRows.push_back(aRow);
i++;
}
@@ -621,27 +607,26 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTypeInfo()
Reference<XResultSet> SAL_CALL ODatabaseMetaData::getCatalogs()
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
return xResultSet;
}
Reference<XResultSet> SAL_CALL ODatabaseMetaData::getSchemas()
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
- OUString sSql
- = m_rConnection.getMysqlVersion() > 49999
- ? OUString{ "SELECT SCHEMA_NAME AS TABLE_SCHEM, CATALOG_NAME AS TABLE_CATALOG "
- "FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME" }
- : OUString{ "SHOW DATABASES" };
-
Reference<XStatement> statement = m_rConnection.createStatement();
- Reference<XInterface> executed = statement->executeQuery(sSql);
+ Reference<XInterface> executed = statement->executeQuery(
+ u"SELECT SCHEMA_NAME AS TABLE_SCHEM, CATALOG_NAME AS TABLE_CATALOG FROM INFORMATION_SCHEMA.SCHEMATA \
+ WHERE SCHEMA_NAME NOT IN ('information_schema', 'mysql', 'performance_schema') \
+ ORDER BY SCHEMA_NAME"_ustr);
Reference<XResultSet> rs(executed, UNO_QUERY_THROW);
Reference<XResultSetMetaDataSupplier> supp(executed, UNO_QUERY_THROW);
Reference<XResultSetMetaData> rs_meta = supp->getMetaData();
@@ -651,20 +636,12 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getSchemas()
while (rs->next())
{
std::vector<Any> aRow{ Any() };
- bool informationSchema = false;
for (sal_uInt32 i = 1; i <= columns; i++)
{
OUString columnStringValue = xRow->getString(i);
- if (i == 1)
- { // TABLE_SCHEM
- informationSchema = columnStringValue.equalsIgnoreAsciiCase("information_schema");
- }
- aRow.push_back(makeAny(columnStringValue));
- }
- if (!informationSchema)
- {
- rRows.push_back(aRow);
+ aRow.push_back(Any(columnStringValue));
}
+ rRows.push_back(aRow);
}
lcl_setRows_throw(xResultSet, 1, rRows);
@@ -676,12 +653,12 @@ Reference<XResultSet>
const OUString& table,
const OUString& columnNamePattern)
{
- OUString query("SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA AS "
+ OUString query(u"SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA AS "
"TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, NULL AS GRANTOR, "
"GRANTEE, PRIVILEGE_TYPE AS PRIVILEGE, IS_GRANTABLE FROM "
"INFORMATION_SCHEMA.COLUMN_PRIVILEGES WHERE TABLE_SCHEMA LIKE "
"'?' AND TABLE_NAME='?' AND COLUMN_NAME LIKE '?' ORDER BY "
- "COLUMN_NAME, PRIVILEGE_TYPE");
+ "COLUMN_NAME, PRIVILEGE_TYPE"_ustr);
query = query.replaceFirst("?", schema);
query = query.replaceFirst("?", table);
@@ -750,34 +727,35 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getColumns(const Any& /*catalo
Reference<XResultSet> rs = statement->executeQuery(query);
Reference<XRow> xRow(rs, UNO_QUERY_THROW);
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> aRows;
while (rs->next())
{
std::vector<Any> aRow{ Any() }; // 0. element is unused
// catalog name
- aRow.push_back(makeAny(xRow->getString(1)));
+ aRow.emplace_back(xRow->getString(1));
// schema name
- aRow.push_back(makeAny(xRow->getString(2)));
+ aRow.emplace_back(xRow->getString(2));
// table name
- aRow.push_back(makeAny(xRow->getString(3)));
+ aRow.emplace_back(xRow->getString(3));
// column name
- aRow.push_back(makeAny(xRow->getString(4)));
+ aRow.emplace_back(xRow->getString(4));
// data type
OUString sDataType = xRow->getString(5);
- aRow.push_back(makeAny(mysqlc_sdbc_driver::mysqlStrToOOOType(sDataType)));
+ aRow.emplace_back(mysqlc_sdbc_driver::mysqlStrToOOOType(sDataType));
// type name
- aRow.push_back(makeAny(sDataType)); // TODO
+ aRow.emplace_back(sDataType); // TODO
// column size
sal_Int32 nColumnSize = 0;
OUString sColumnType = xRow->getString(14);
sal_Int32 nCharMaxLen = xRow->getShort(6);
bool bIsCharMax = !xRow->wasNull();
if (sDataType.equalsIgnoreAsciiCase("year"))
- nColumnSize = sColumnType.copy(6, 1).toInt32(); // 'year(' length is 5
+ nColumnSize = o3tl::toInt32(sColumnType.subView(6, 1)); // 'year(' length is 5
else if (sDataType.equalsIgnoreAsciiCase("date"))
nColumnSize = 10;
else if (sDataType.equalsIgnoreAsciiCase("time"))
@@ -789,34 +767,34 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getColumns(const Any& /*catalo
nColumnSize = xRow->getShort(7); // numeric precision
else
nColumnSize = nCharMaxLen;
- aRow.push_back(makeAny(nColumnSize));
- aRow.push_back(Any()); // buffer length - unused
+ aRow.emplace_back(nColumnSize);
+ aRow.emplace_back(); // buffer length - unused
// decimal digits (scale)
- aRow.push_back(makeAny(xRow->getShort(8)));
+ aRow.emplace_back(xRow->getShort(8));
// num_prec_radix
- aRow.push_back(makeAny(sal_Int32(10)));
+ aRow.emplace_back(sal_Int32(10));
// nullable
OUString sIsNullable = xRow->getString(13);
if (xRow->wasNull())
- aRow.push_back(makeAny(ColumnValue::NULLABLE_UNKNOWN));
+ aRow.emplace_back(ColumnValue::NULLABLE_UNKNOWN);
else if (sIsNullable.equalsIgnoreAsciiCase("YES"))
- aRow.push_back(makeAny(ColumnValue::NULLABLE));
+ aRow.emplace_back(ColumnValue::NULLABLE);
else
- aRow.push_back(makeAny(ColumnValue::NO_NULLS));
+ aRow.emplace_back(ColumnValue::NO_NULLS);
// remarks
- aRow.push_back(makeAny(xRow->getString(9)));
+ aRow.emplace_back(xRow->getString(9));
// default
- aRow.push_back(makeAny(xRow->getString(10)));
+ aRow.emplace_back(xRow->getString(10));
- aRow.push_back(Any{}); // sql_data_type - unused
- aRow.push_back(Any{}); // sql_datetime_sub - unused
+ aRow.emplace_back(); // sql_data_type - unused
+ aRow.emplace_back(); // sql_datetime_sub - unused
// character octet length
- aRow.push_back(makeAny(xRow->getString(11)));
+ aRow.emplace_back(xRow->getString(11));
// ordinal position
- aRow.push_back(makeAny(xRow->getString(12)));
+ aRow.emplace_back(xRow->getString(12));
// is nullable
- aRow.push_back(makeAny(sIsNullable));
+ aRow.emplace_back(sIsNullable);
aRows.push_back(aRow);
}
lcl_setRows_throw(xResultSet, 1, aRows);
@@ -832,25 +810,20 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTables(const Any& /*catalog
"SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA AS TABLE_SCHEM, TABLE_NAME,"
"IF(STRCMP(TABLE_TYPE,'BASE TABLE'), TABLE_TYPE, 'TABLE') AS TABLE_TYPE, TABLE_COMMENT AS "
"REMARKS "
- "FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA LIKE '?' AND TABLE_NAME LIKE '?' "
+ "FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema', 'mysql', "
+ "'performance_schema') AND TABLE_SCHEMA LIKE '?' AND TABLE_NAME LIKE '?' "
};
if (types.getLength() == 1)
{
- buffer.append("AND TABLE_TYPE LIKE '");
- buffer.append(types[0]);
- buffer.append("'");
+ buffer.append("AND TABLE_TYPE LIKE '" + types[0] + "'");
}
else if (types.getLength() > 1)
{
- buffer.append("AND (TABLE_TYPE LIKE '");
- buffer.append(types[0]);
- buffer.append("'");
+ buffer.append("AND (TABLE_TYPE LIKE '" + types[0] + "'");
for (sal_Int32 i = 1; i < types.getLength(); ++i)
{
- buffer.append(" OR TABLE_TYPE LIKE '");
- buffer.append(types[i]);
- buffer.append("'");
+ buffer.append(" OR TABLE_TYPE LIKE '" + types[i] + "'");
}
buffer.append(")");
}
@@ -881,9 +854,10 @@ Reference<XResultSet>
const OUString& /*schemaPattern*/,
const OUString& /*procedureNamePattern*/)
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
// TODO IMPL
SAL_WARN("connectivity.mysqlc", "method not implemented");
@@ -895,9 +869,10 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getVersionColumns(const Any& /
const OUString& /* schema */,
const OUString& /* table */)
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
lcl_setRows_throw(xResultSet, 16, rRows);
return xResultSet;
@@ -907,9 +882,10 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getExportedKeys(const Any& /*c
const OUString& /*schema */,
const OUString& /*table */)
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
// TODO implement
SAL_WARN("connectivity.mysqlc", "method not implemented");
@@ -921,11 +897,12 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getImportedKeys(const Any& /*c
const OUString& schema,
const OUString& table)
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
- OUString query("SELECT refi.CONSTRAINT_CATALOG," // 1: foreign catalog
+ OUString query(u"SELECT refi.CONSTRAINT_CATALOG," // 1: foreign catalog
" k.COLUMN_NAME," // 2: foreign column name
" refi.UNIQUE_CONSTRAINT_CATALOG," // 3: primary catalog FIXME
" k.REFERENCED_TABLE_SCHEMA," // 4: primary schema
@@ -940,7 +917,7 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getImportedKeys(const Any& /*c
"refi.CONSTRAINT_NAME "
" and k.TABLE_NAME = refi.TABLE_NAME "
" WHERE k.REFERENCED_TABLE_SCHEMA LIKE "
- "'?' AND refi.TABLE_NAME='?'");
+ "'?' AND refi.TABLE_NAME='?'"_ustr);
query = query.replaceFirst("?", schema); // TODO what if schema is NULL?
query = query.replaceFirst("?", table);
@@ -954,34 +931,34 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getImportedKeys(const Any& /*c
std::vector<Any> aRow{ Any() }; // 0. element is unused
// primary key catalog
- aRow.push_back(makeAny(xRow->getString(3)));
+ aRow.push_back(Any(xRow->getString(3)));
// primary key schema
- aRow.push_back(makeAny(xRow->getString(4)));
+ aRow.push_back(Any(xRow->getString(4)));
// primary key table
- aRow.push_back(makeAny(xRow->getString(5)));
+ aRow.push_back(Any(xRow->getString(5)));
// primary column name
- aRow.push_back(makeAny(xRow->getString(6)));
+ aRow.push_back(Any(xRow->getString(6)));
// fk table catalog
- aRow.push_back(makeAny(xRow->getString(1)));
+ aRow.push_back(Any(xRow->getString(1)));
// fk schema
- aRow.push_back(makeAny(xRow->getString(11)));
+ aRow.push_back(Any(xRow->getString(11)));
// fk table
- aRow.push_back(makeAny(xRow->getString(10)));
+ aRow.push_back(Any(xRow->getString(10)));
// fk column name
- aRow.push_back(makeAny(xRow->getString(2)));
+ aRow.push_back(Any(xRow->getString(2)));
// KEY_SEQ
- aRow.push_back(makeAny(sal_Int32{ 0 })); // TODO
+ aRow.push_back(Any(sal_Int32{ 0 })); // TODO
// update rule
- aRow.push_back(makeAny(xRow->getShort(7)));
+ aRow.push_back(Any(xRow->getShort(7)));
// delete rule
- aRow.push_back(makeAny(xRow->getShort(8)));
+ aRow.push_back(Any(xRow->getShort(8)));
// foreign key name
- aRow.push_back(makeAny(xRow->getString(9)));
+ aRow.push_back(Any(xRow->getString(9)));
// primary key name
- aRow.push_back(makeAny(OUString{})); // TODO
+ aRow.push_back(Any(OUString{})); // TODO
// deferrability
- aRow.push_back(makeAny(Deferrability::NONE));
+ aRow.push_back(Any(Deferrability::NONE));
aRows.push_back(aRow);
}
lcl_setRows_throw(xResultSet, 1, aRows);
@@ -992,12 +969,12 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getPrimaryKeys(const Any& /*ca
const OUString& schema,
const OUString& table)
{
- OUString query("SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA "
+ OUString query(u"SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA "
"AS TABLE_SCHEM, TABLE_NAME, "
"COLUMN_NAME, SEQ_IN_INDEX AS KEY_SEQ,"
"INDEX_NAME AS PK_NAME FROM INFORMATION_SCHEMA.STATISTICS "
"WHERE TABLE_SCHEMA LIKE '?' AND TABLE_NAME LIKE '?' AND INDEX_NAME='PRIMARY' "
- "ORDER BY TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX");
+ "ORDER BY TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX"_ustr);
// TODO use prepared stmt instead
// TODO escape schema, table name ?
@@ -1015,9 +992,10 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getIndexInfo(const Any& /*cata
sal_Bool /*unique*/,
sal_Bool /*approximate*/)
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
// TODO
SAL_WARN("connectivity.mysqlc", "method not implemented");
@@ -1031,9 +1009,10 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getBestRowIdentifier(const Any
sal_Int32 /*scope*/,
sal_Bool /*nullable*/)
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
// TODO
SAL_WARN("connectivity.mysqlc", "method not implemented");
@@ -1042,11 +1021,23 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getBestRowIdentifier(const Any
}
Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTablePrivileges(
- const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*tableNamePattern*/)
+ const Any& /* catalog */, const OUString& schemaPattern, const OUString& tableNamePattern)
{
- // TODO
- SAL_WARN("connectivity.mysqlc", "method not implemented");
- throw SQLException("getTablePrivileges method not implemented", *this, "IM001", 0, Any());
+ OUString query(u"SELECT TABLE_SCHEMA TABLE_CAT, "
+ "NULL TABLE_SCHEM, "
+ "TABLE_NAME, "
+ "NULL GRANTOR,"
+ "GRANTEE, "
+ "PRIVILEGE_TYPE PRIVILEGE, "
+ "IS_GRANTABLE "
+ "FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES "
+ "WHERE TABLE_SCHEMA LIKE '?' "
+ "AND TABLE_NAME='?'"_ustr);
+ query = query.replaceFirst("?", schemaPattern);
+ query = query.replaceFirst("?", tableNamePattern);
+ Reference<XStatement> statement = m_rConnection.createStatement();
+ Reference<XResultSet> rs = statement->executeQuery(query);
+ return rs;
}
Reference<XResultSet> SAL_CALL ODatabaseMetaData::getCrossReference(
@@ -1054,9 +1045,10 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getCrossReference(
const OUString& /*primaryTable_*/, const Any& /*foreignCatalog*/,
const OUString& /*foreignSchema*/, const OUString& /*foreignTable*/)
{
- Reference<XResultSet> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(
- "org.openoffice.comp.helper.DatabaseMetaDataResultSet"),
- UNO_QUERY);
+ Reference<XResultSet> xResultSet(
+ getOwnConnection().getDriver().getFactory()->createInstance(
+ u"org.openoffice.comp.helper.DatabaseMetaDataResultSet"_ustr),
+ UNO_QUERY);
std::vector<std::vector<Any>> rRows;
// TODO
SAL_WARN("connectivity.mysqlc", "method not implemented");
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.hxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.hxx
index 18109d359ca0..caed92f20e80 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_DATABASEMETADATA_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_DATABASEMETADATA_HXX
+#pragma once
#include "mysqlc_connection.hxx"
@@ -178,7 +177,7 @@ public:
css::uno::Reference<css::sdbc::XResultSet> SAL_CALL getSchemas() override;
css::uno::Reference<css::sdbc::XResultSet> SAL_CALL getCatalogs() override;
css::uno::Reference<css::sdbc::XResultSet> SAL_CALL getTableTypes() override;
- css::uno::Reference<css::sdbc::XResultSet>
+ virtual css::uno::Reference<css::sdbc::XResultSet>
SAL_CALL getColumns(const Any& catalog, const OUString& schemaPattern,
const OUString& tableNamePattern,
const OUString& columnNamePattern) override;
@@ -231,6 +230,4 @@ public:
};
}
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_DATABASEMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
index c7c88d03ebe6..e8b1d5c0cf70 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
@@ -18,15 +18,16 @@
*/
#include "mysqlc_driver.hxx"
#include "mysqlc_connection.hxx"
+#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/servicehelper.hxx>
using namespace css::uno;
using namespace css::lang;
using namespace css::beans;
using namespace css::sdbc;
+using namespace css::sdbcx;
using namespace connectivity::mysqlc;
-#include <cppuhelper/supportsservice.hxx>
-
MysqlCDriver::MysqlCDriver(const Reference<XMultiServiceFactory>& _rxFactory)
: ODriver_BASE(m_aMutex)
, m_xFactory(_rxFactory)
@@ -40,7 +41,7 @@ void MysqlCDriver::disposing()
// when driver will be destroyed so all our connections have to be destroyed as well
for (auto const& connection : m_xConnections)
{
- Reference<XComponent> xComp(connection.get(), UNO_QUERY);
+ rtl::Reference<OConnection> xComp(connection);
if (xComp.is())
{
xComp->dispose();
@@ -54,12 +55,12 @@ void MysqlCDriver::disposing()
// static ServiceInfo
OUString MysqlCDriver::getImplementationName_Static()
{
- return "com.sun.star.comp.sdbc.mysqlc.MysqlCDriver";
+ return u"com.sun.star.comp.sdbc.mysqlc.MysqlCDriver"_ustr;
}
Sequence<OUString> MysqlCDriver::getSupportedServiceNames_Static()
{
- return { "com.sun.star.sdbc.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr, u"com.sun.star.sdbcx.Driver"_ustr };
}
OUString SAL_CALL MysqlCDriver::getImplementationName() { return getImplementationName_Static(); }
@@ -84,14 +85,12 @@ Reference<XConnection> SAL_CALL MysqlCDriver::connect(const OUString& url,
return nullptr;
}
- Reference<XConnection> xConn;
// create a new connection with the given properties and append it to our vector
- OConnection* pCon = new OConnection(*this);
- xConn = pCon;
+ rtl::Reference<OConnection> pCon = new OConnection(*this);
pCon->construct(url, info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
- return xConn;
+ m_xConnections.push_back(pCon);
+ return pCon;
}
sal_Bool SAL_CALL MysqlCDriver::acceptsURL(const OUString& url)
@@ -104,13 +103,8 @@ MysqlCDriver::getPropertyInfo(const OUString& url, const Sequence<PropertyValue>
{
if (acceptsURL(url))
{
- ::std::vector<DriverPropertyInfo> aDriverInfo;
-
- aDriverInfo.push_back(DriverPropertyInfo("Hostname", "Name of host", true, "localhost",
- Sequence<OUString>()));
- aDriverInfo.push_back(
- DriverPropertyInfo("Port", "Port", true, "3306", Sequence<OUString>()));
- return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size());
+ return { { u"Hostname"_ustr, u"Name of host"_ustr, true, u"localhost"_ustr, {} },
+ { u"Port"_ustr, u"Port"_ustr, true, u"3306"_ustr, {} } };
}
return Sequence<DriverPropertyInfo>();
@@ -120,6 +114,21 @@ sal_Int32 SAL_CALL MysqlCDriver::getMajorVersion() { return MARIADBC_VERSION_MAJ
sal_Int32 SAL_CALL MysqlCDriver::getMinorVersion() { return MARIADBC_VERSION_MINOR; }
+Reference<XTablesSupplier>
+ SAL_CALL MysqlCDriver::getDataDefinitionByConnection(const Reference<XConnection>& rConnection)
+{
+ if (OConnection* pConnection = comphelper::getFromUnoTunnel<OConnection>(rConnection))
+ return pConnection->createCatalog();
+ return {};
+}
+
+Reference<XTablesSupplier> SAL_CALL
+MysqlCDriver::getDataDefinitionByURL(const OUString& rURL, const Sequence<PropertyValue>& rInfo)
+{
+ Reference<XConnection> xConnection = connect(rURL, rInfo);
+ return getDataDefinitionByConnection(xConnection);
+}
+
namespace connectivity::mysqlc
{
Reference<XInterface> MysqlCDriver_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx
index e5d199fcad6f..5479132a4cf6 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx
@@ -16,30 +16,26 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
+#pragma once
#include "mysqlc_connection.hxx"
#include <com/sun/star/sdbc/XDriver.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#include <cppuhelper/compbase2.hxx>
-#include <osl/module.h>
+#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
+#include <cppuhelper/compbase.hxx>
namespace connectivity::mysqlc
{
-using css::sdbc::SQLException;
-using css::uno::Exception;
using css::uno::Reference;
-using css::uno::RuntimeException;
using css::uno::Sequence;
Reference<css::uno::XInterface>
MysqlCDriver_CreateInstance(const Reference<css::lang::XMultiServiceFactory>& _rxFactory);
-typedef ::cppu::WeakComponentImplHelper2<css::sdbc::XDriver, css::lang::XServiceInfo> ODriver_BASE;
+typedef ::cppu::WeakComponentImplHelper<css::sdbc::XDriver, css::sdbcx::XDataDefinitionSupplier,
+ css::lang::XServiceInfo>
+ ODriver_BASE;
typedef void* (*OMysqlCConnection_CreateInstanceFunction)(void* _pDriver);
@@ -48,13 +44,9 @@ class MysqlCDriver : public ODriver_BASE
protected:
Reference<css::lang::XMultiServiceFactory> m_xFactory;
::osl::Mutex m_aMutex; // mutex is need to control member access
- OWeakRefArray m_xConnections; // vector containing a list
+ std::vector<unotools::WeakReference<OConnection>> m_xConnections; // vector containing a list
// of all the Connection objects
// for this Driver
-#ifdef BUNDLE_MARIADB
- oslModule m_hCConnModule;
- bool m_bAttemptedLoadCConn;
-#endif
public:
explicit MysqlCDriver(const Reference<css::lang::XMultiServiceFactory>& _rxFactory);
@@ -83,10 +75,14 @@ public:
const Reference<css::lang::XMultiServiceFactory>& getFactory() const { return m_xFactory; }
static rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; }
+
+ // 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;
};
} /* connectivity::mysqlc */
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
index 7ed11fe3ff13..58409e454e7a 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
@@ -20,6 +20,7 @@
#include <sal/log.hxx>
#include <rtl/ustring.hxx>
+#include <o3tl/string_view.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
@@ -43,6 +44,7 @@ void allocateSqlVar(void** mem, enum_field_types eType, unsigned nSize)
*mem = malloc(sizeof(sal_Int32));
break;
case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_YEAR:
*mem = malloc(sizeof(sal_Int16));
break;
case MYSQL_TYPE_BIT:
@@ -62,7 +64,6 @@ void allocateSqlVar(void** mem, enum_field_types eType, unsigned nSize)
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
- case MYSQL_TYPE_YEAR: // FIXME below
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
@@ -93,7 +94,7 @@ void throwFeatureNotImplementedException(const char* _pAsciiFeatureName,
{
const OUString sMessage
= OUString::createFromAscii(_pAsciiFeatureName) + ": feature not implemented.";
- throw SQLException(sMessage, _rxContext, "HYC00", 0, Any());
+ throw SQLException(sMessage, _rxContext, u"HYC00"_ustr, 0, Any());
}
void throwInvalidArgumentException(const char* _pAsciiFeatureName,
@@ -101,7 +102,7 @@ void throwInvalidArgumentException(const char* _pAsciiFeatureName,
{
const OUString sMessage
= OUString::createFromAscii(_pAsciiFeatureName) + ": invalid arguments.";
- throw SQLException(sMessage, _rxContext, "HYC00", 0, Any());
+ throw SQLException(sMessage, _rxContext, u"HYC00"_ustr, 0, Any());
}
void throwSQLExceptionWithMsg(const char* msg, const char* SQLSTATE, unsigned int errorNum,
@@ -125,12 +126,13 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept
switch (eType)
{
case MYSQL_TYPE_BIT:
- return css::sdbc::DataType::VARCHAR;
+ return css::sdbc::DataType::BIT;
case MYSQL_TYPE_TINY:
return css::sdbc::DataType::TINYINT;
case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_YEAR:
return css::sdbc::DataType::SMALLINT;
case MYSQL_TYPE_INT24:
@@ -163,6 +165,9 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept
return css::sdbc::DataType::VARCHAR;
case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
if (charsetnr == 63)
return css::sdbc::DataType::LONGVARBINARY;
return css::sdbc::DataType::LONGVARCHAR;
@@ -188,46 +193,58 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept
return css::sdbc::DataType::VARCHAR;
}
-sal_Int32 mysqlStrToOOOType(const OUString& sType)
+sal_Int32 mysqlStrToOOOType(std::u16string_view sType)
{
// TODO other types.
- if (sType.equalsIgnoreAsciiCase("tiny") || sType.equalsIgnoreAsciiCase("tinyint"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"tiny")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"tinyint"))
return css::sdbc::DataType::TINYINT;
- if (sType.equalsIgnoreAsciiCase("smallint") || sType.equalsIgnoreAsciiCase("mediumint"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"smallint")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"year"))
return css::sdbc::DataType::SMALLINT;
- if (sType.equalsIgnoreAsciiCase("longtext"))
- return css::sdbc::DataType::LONGVARCHAR;
- if (sType.equalsIgnoreAsciiCase("int"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"int")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"mediumint"))
return css::sdbc::DataType::INTEGER;
- if (sType.equalsIgnoreAsciiCase("varchar") || sType.equalsIgnoreAsciiCase("set")
- || sType.equalsIgnoreAsciiCase("enum"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"varchar") || o3tl::equalsIgnoreAsciiCase(sType, u"set")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"enum"))
return css::sdbc::DataType::VARCHAR;
- if (sType.equalsIgnoreAsciiCase("bigint"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"bigint"))
return css::sdbc::DataType::BIGINT;
- if (sType.equalsIgnoreAsciiCase("blob") || sType.equalsIgnoreAsciiCase("longblob"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"blob")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"longblob")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"tinyblob")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"mediumblob"))
return css::sdbc::DataType::BLOB;
- if (sType.equalsIgnoreAsciiCase("varbinary"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"varbinary"))
return css::sdbc::DataType::VARBINARY;
- if (sType.equalsIgnoreAsciiCase("char"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"char"))
return css::sdbc::DataType::CHAR;
- if (sType.equalsIgnoreAsciiCase("text"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"tinytext"))
+ return css::sdbc::DataType::VARCHAR;
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"text"))
+ return css::sdbc::DataType::LONGVARCHAR;
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"mediumtext")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"longtext"))
return css::sdbc::DataType::CLOB;
- if (sType.equalsIgnoreAsciiCase("binary"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"binary"))
return css::sdbc::DataType::BINARY;
- if (sType.equalsIgnoreAsciiCase("time"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"time"))
return css::sdbc::DataType::TIME;
- if (sType.equalsIgnoreAsciiCase("date"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"date"))
return css::sdbc::DataType::DATE;
- if (sType.equalsIgnoreAsciiCase("datetime") || sType.equalsIgnoreAsciiCase("timestamp"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"datetime")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"timestamp"))
return css::sdbc::DataType::TIMESTAMP;
- if (sType.equalsIgnoreAsciiCase("decimal"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"decimal"))
return css::sdbc::DataType::DECIMAL;
- if (sType.equalsIgnoreAsciiCase("real") || sType.equalsIgnoreAsciiCase("float"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"real") || o3tl::equalsIgnoreAsciiCase(sType, u"float"))
return css::sdbc::DataType::REAL;
- if (sType.equalsIgnoreAsciiCase("double"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"double"))
return css::sdbc::DataType::DOUBLE;
- if (sType.equalsIgnoreAsciiCase("bit") || sType.equalsIgnoreAsciiCase("bool")
- || sType.equalsIgnoreAsciiCase("boolean"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"bit"))
+ return css::sdbc::DataType::BIT;
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"bool")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"boolean"))
return css::sdbc::DataType::BOOLEAN;
OSL_FAIL("Unknown type name from string, failing back to varchar.");
return css::sdbc::DataType::VARCHAR;
@@ -240,93 +257,92 @@ OUString mysqlTypeToStr(unsigned type, unsigned flags)
switch (type)
{
case MYSQL_TYPE_BIT:
- return OUString{ "BIT" };
+ return u"BIT"_ustr;
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
- return isUnsigned ? (isZerofill ? OUString{ "DECIMAL UNSIGNED ZEROFILL" }
- : OUString{ "DECIMAL UNSIGNED" })
- : OUString{ "DECIMAL" };
+ return isUnsigned
+ ? (isZerofill ? u"DECIMAL UNSIGNED ZEROFILL"_ustr : u"DECIMAL UNSIGNED"_ustr)
+ : u"DECIMAL"_ustr;
case MYSQL_TYPE_TINY:
- return isUnsigned ? (isZerofill ? OUString{ "TINYINT UNSIGNED ZEROFILL" }
- : OUString{ "TINYINT UNSIGNED" })
- : OUString{ "TINYINT" };
+ return isUnsigned
+ ? (isZerofill ? u"TINYINT UNSIGNED ZEROFILL"_ustr : u"TINYINT UNSIGNED"_ustr)
+ : u"TINYINT"_ustr;
case MYSQL_TYPE_SHORT:
- return isUnsigned ? (isZerofill ? OUString{ "SMALLINT UNSIGNED ZEROFILL" }
- : OUString{ "SMALLINT UNSIGNED" })
- : OUString{ "SMALLINT" };
+ return isUnsigned ? (isZerofill ? u"SMALLINT UNSIGNED ZEROFILL"_ustr
+ : u"SMALLINT UNSIGNED"_ustr)
+ : u"SMALLINT"_ustr;
case MYSQL_TYPE_LONG:
- return isUnsigned ? (isZerofill ? OUString{ "INT UNSIGNED ZEROFILL" }
- : OUString{ "INT UNSIGNED" })
- : OUString{ "INT" };
+ return isUnsigned ? (isZerofill ? u"INT UNSIGNED ZEROFILL"_ustr : u"INT UNSIGNED"_ustr)
+ : u"INT"_ustr;
case MYSQL_TYPE_FLOAT:
- return isUnsigned ? (isZerofill ? OUString{ "FLOAT UNSIGNED ZEROFILL" }
- : OUString{ "FLOAT UNSIGNED" })
- : OUString{ "FLOAT" };
+ return isUnsigned
+ ? (isZerofill ? u"FLOAT UNSIGNED ZEROFILL"_ustr : u"FLOAT UNSIGNED"_ustr)
+ : u"FLOAT"_ustr;
case MYSQL_TYPE_DOUBLE:
- return isUnsigned ? (isZerofill ? OUString{ "DOUBLE UNSIGNED ZEROFILL" }
- : OUString{ "DOUBLE UNSIGNED" })
- : OUString{ "DOUBLE" };
+ return isUnsigned
+ ? (isZerofill ? u"DOUBLE UNSIGNED ZEROFILL"_ustr : u"DOUBLE UNSIGNED"_ustr)
+ : u"DOUBLE"_ustr;
case MYSQL_TYPE_NULL:
- return OUString{ "NULL" };
+ return u"NULL"_ustr;
case MYSQL_TYPE_TIMESTAMP:
- return OUString{ "TIMESTAMP" };
+ return u"TIMESTAMP"_ustr;
case MYSQL_TYPE_LONGLONG:
- return isUnsigned ? (isZerofill ? OUString{ "BIGINT UNSIGNED ZEROFILL" }
- : OUString{ "BIGINT UNSIGNED" })
- : OUString{ "BIGINT" };
+ return isUnsigned
+ ? (isZerofill ? u"BIGINT UNSIGNED ZEROFILL"_ustr : u"BIGINT UNSIGNED"_ustr)
+ : u"BIGINT"_ustr;
case MYSQL_TYPE_INT24:
- return isUnsigned ? (isZerofill ? OUString{ "MEDIUMINT UNSIGNED ZEROFILL" }
- : OUString{ "MEDIUMINT UNSIGNED" })
- : OUString{ "MEDIUMINT" };
+ return isUnsigned ? (isZerofill ? u"MEDIUMINT UNSIGNED ZEROFILL"_ustr
+ : u"MEDIUMINT UNSIGNED"_ustr)
+ : u"MEDIUMINT"_ustr;
case MYSQL_TYPE_DATE:
- return OUString{ "DATE" };
+ return u"DATE"_ustr;
case MYSQL_TYPE_TIME:
- return OUString{ "TIME" };
+ return u"TIME"_ustr;
case MYSQL_TYPE_DATETIME:
- return OUString{ "DATETIME" };
+ return u"DATETIME"_ustr;
case MYSQL_TYPE_TINY_BLOB:
{
- return OUString{ "TINYBLOB" };
+ return u"TINYBLOB"_ustr;
}
case MYSQL_TYPE_MEDIUM_BLOB:
{
- return OUString{ "MEDIUMBLOB" };
+ return u"MEDIUMBLOB"_ustr;
}
case MYSQL_TYPE_LONG_BLOB:
{
- return OUString{ "LONGBLOB" };
+ return u"LONGBLOB"_ustr;
}
case MYSQL_TYPE_BLOB:
{
- return OUString{ "BLOB" };
+ return u"BLOB"_ustr;
}
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
if (flags & ENUM_FLAG)
{
- return OUString{ "ENUM" };
+ return u"ENUM"_ustr;
}
if (flags & SET_FLAG)
{
- return OUString{ "SET" };
+ return u"SET"_ustr;
}
- return OUString{ "VARCHAR" };
+ return u"VARCHAR"_ustr;
case MYSQL_TYPE_STRING:
if (flags & ENUM_FLAG)
{
- return OUString{ "ENUM" };
+ return u"ENUM"_ustr;
}
if (flags & SET_FLAG)
{
- return OUString{ "SET" };
+ return u"SET"_ustr;
}
- return OUString{ "CHAR" };
+ return u"CHAR"_ustr;
case MYSQL_TYPE_YEAR:
- return OUString{ "YEAR" };
+ return u"YEAR"_ustr;
case MYSQL_TYPE_GEOMETRY:
- return OUString{ "GEOMETRY" };
+ return u"GEOMETRY"_ustr;
default:
- return OUString{ "UNKNOWN" };
+ return u"UNKNOWN"_ustr;
}
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx
index c00a11f412c5..16236e1530ed 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_GENERAL_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_GENERAL_HXX
+#pragma once
#include <config_lgpl.h>
@@ -109,11 +108,9 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept;
OUString mysqlTypeToStr(unsigned mysql_type, unsigned mysql_flags);
-sal_Int32 mysqlStrToOOOType(const OUString& sType);
+sal_Int32 mysqlStrToOOOType(std::u16string_view sType);
OUString convert(const ::std::string& _string, const rtl_TextEncoding encoding);
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx b/connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx
new file mode 100644
index 000000000000..c496f9c21cde
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mysqlc_indexes.hxx"
+
+connectivity::mysqlc::Indexes::Indexes(Table* pTable, osl::Mutex& rMutex,
+ const std::vector<OUString>& rVector)
+ : OIndexesHelper(pTable, rMutex, rVector)
+{
+}
+
+// XDrop
+void connectivity::mysqlc::Indexes::dropObject(sal_Int32 /*nPosition*/,
+ const OUString& /* sIndexName */)
+{
+ // TODO: implement
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_indexes.hxx b/connectivity/source/drivers/mysqlc/mysqlc_indexes.hxx
new file mode 100644
index 000000000000..4c918d1846fd
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_indexes.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "mysqlc_table.hxx"
+
+#include <connectivity/TIndexes.hxx>
+
+namespace connectivity::mysqlc
+{
+class Indexes : public ::connectivity::OIndexesHelper
+{
+private:
+ // TODO: useful?
+ // Table* m_pTable;
+
+protected:
+ // XDrop
+ void dropObject(sal_Int32 nPosition, const OUString& sIndexName);
+
+public:
+ Indexes(Table* pTable, ::osl::Mutex& rMutex, const std::vector<OUString>& rVector);
+};
+
+} // namespace connectivity::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_keys.cxx b/connectivity/source/drivers/mysqlc/mysqlc_keys.cxx
new file mode 100644
index 000000000000..7706844f238c
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_keys.cxx
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mysqlc_keys.hxx"
+#include "mysqlc_table.hxx"
+
+connectivity::mysqlc::Keys::Keys(Table* pTable, osl::Mutex& rMutex,
+ const ::std::vector<OUString>& rNames)
+ : OKeysHelper(pTable, rMutex, rNames)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_keys.hxx b/connectivity/source/drivers/mysqlc/mysqlc_keys.hxx
new file mode 100644
index 000000000000..9d0a9ef1cc43
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_keys.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <connectivity/TKeys.hxx>
+
+namespace connectivity::mysqlc
+{
+class Table;
+
+class Keys : public ::connectivity::OKeysHelper
+{
+public:
+ Keys(Table* pTable, ::osl::Mutex& rMutex, const ::std::vector<OUString>& rNames);
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 8031bfdf24b0..6fd5d67823d5 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -31,10 +31,10 @@
#include <cppuhelper/typeprovider.hxx>
#include <sal/log.hxx>
-using namespace rtl;
-
#include <cstdlib>
+#include <typeindex>
+using namespace rtl;
using namespace connectivity::mysqlc;
using namespace connectivity;
using namespace cppu;
@@ -46,20 +46,20 @@ using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
-using namespace ::comphelper;
using ::osl::MutexGuard;
-#include <typeindex>
-
namespace
{
std::type_index getTypeFromMysqlType(enum_field_types type)
{
switch (type)
{
+ case MYSQL_TYPE_BIT:
+ return std::type_index(typeid(bool));
case MYSQL_TYPE_TINY:
return std::type_index(typeid(sal_Int8));
case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_YEAR:
return std::type_index(typeid(sal_Int16));
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
@@ -83,8 +83,6 @@ std::type_index getTypeFromMysqlType(enum_field_types type)
case MYSQL_TYPE_NEWDECIMAL:
return std::type_index(typeid(OUString));
case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_YEAR:
- case MYSQL_TYPE_BIT:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_GEOMETRY:
@@ -106,12 +104,24 @@ bool OPreparedResultSet::fetchResult()
}
for (sal_Int32 i = 0; i < m_nColumnCount; ++i)
{
+ bool bIsBlobType = false;
+ switch (m_aFields[i].type)
+ {
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ bIsBlobType = true;
+ break;
+ default:
+ bIsBlobType = false;
+ }
m_aMetaData[i].is_null = false;
m_aMetaData[i].length = 0l;
m_aMetaData[i].error = false;
m_aData[i].is_null = &m_aMetaData[i].is_null;
- m_aData[i].buffer_length = m_aFields[i].type == MYSQL_TYPE_BLOB ? 0 : m_aFields[i].length;
+ m_aData[i].buffer_length = bIsBlobType ? 0 : m_aFields[i].length;
m_aData[i].length = &m_aMetaData[i].length;
m_aData[i].error = &m_aMetaData[i].error;
m_aData[i].buffer = nullptr;
@@ -153,12 +163,12 @@ bool OPreparedResultSet::fetchResult()
OUString SAL_CALL OPreparedResultSet::getImplementationName()
{
- return "com.sun.star.sdbcx.mysqlc.ResultSet";
+ return u"com.sun.star.sdbcx.mysqlc.ResultSet"_ustr;
}
uno::Sequence<OUString> SAL_CALL OPreparedResultSet::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
+ return { u"com.sun.star.sdbc.ResultSet"_ustr, u"com.sun.star.sdbcx.ResultSet"_ustr };
}
sal_Bool SAL_CALL OPreparedResultSet::supportsService(const OUString& _rServiceName)
@@ -170,7 +180,7 @@ OPreparedResultSet::OPreparedResultSet(OConnection& rConn, OPreparedStatement* p
: OPreparedResultSet_BASE(m_aMutex)
, OPropertySetHelper(OPreparedResultSet_BASE::rBHelper)
, m_rConnection(rConn)
- , m_aStatement(static_cast<OWeakObject*>(pStmt))
+ , m_xStatement(pStmt)
, m_pStmt(pMyStmt)
, m_encoding(rConn.getConnectionEncoding())
, m_nColumnCount(mysql_stmt_field_count(pMyStmt))
@@ -188,7 +198,7 @@ void OPreparedResultSet::disposing()
MutexGuard aGuard(m_aMutex);
- m_aStatement = nullptr;
+ m_xStatement.clear();
m_xMetaData = nullptr;
}
@@ -223,8 +233,8 @@ sal_Int32 SAL_CALL OPreparedResultSet::findColumn(const OUString& columnName)
return i + 1; // sdbc indexes from 1
}
- throw SQLException("The column name '" + columnName + "' is not valid.", *this, "42S22", 0,
- Any());
+ throw SQLException("The column name '" + columnName + "' is not valid.", *this, u"42S22"_ustr,
+ 0, Any());
}
template <typename T> T OPreparedResultSet::safelyRetrieveValue(sal_Int32 nColumnIndex)
@@ -247,7 +257,25 @@ template <typename T> T OPreparedResultSet::retrieveValue(sal_Int32 nColumnIndex
if (getTypeFromMysqlType(m_aFields[nColumnIndex - 1].type) == std::type_index(typeid(T)))
return *static_cast<T*>(m_aData[nColumnIndex - 1].buffer);
else
- return getRowSetValue(nColumnIndex);
+ {
+ auto const row = getRowSetValue(nColumnIndex);
+ if constexpr (std::is_same_v<sal_Int64, T>)
+ return row.getLong();
+ else if constexpr (std::is_same_v<sal_Int32, T>)
+ return row.getInt32();
+ else if constexpr (std::is_same_v<sal_Int16, T>)
+ return row.getInt16();
+ else if constexpr (std::is_same_v<sal_Int8, T>)
+ return row.getInt8();
+ else if constexpr (std::is_same_v<double, T>)
+ return row.getDouble();
+ else if constexpr (std::is_same_v<float, T>)
+ return row.getFloat();
+ else if constexpr (std::is_same_v<bool, T>)
+ return row.getBool();
+ else
+ return row;
+ }
}
template <> uno::Sequence<sal_Int8> OPreparedResultSet::retrieveValue(sal_Int32 column)
@@ -260,7 +288,7 @@ template <> uno::Sequence<sal_Int8> OPreparedResultSet::retrieveValue(sal_Int32
template <> Date OPreparedResultSet::retrieveValue(sal_Int32 column)
{
if (getTypeFromMysqlType(m_aFields[column - 1].type) != std::type_index(typeid(Date)))
- return getRowSetValue(column);
+ return getRowSetValue(column).getDate();
const MYSQL_TIME* pTime = static_cast<MYSQL_TIME*>(m_aData[column - 1].buffer);
Date d;
@@ -273,7 +301,7 @@ template <> Date OPreparedResultSet::retrieveValue(sal_Int32 column)
template <> Time OPreparedResultSet::retrieveValue(sal_Int32 column)
{
if (getTypeFromMysqlType(m_aFields[column - 1].type) != std::type_index(typeid(Time)))
- return getRowSetValue(column);
+ return getRowSetValue(column).getTime();
const MYSQL_TIME* pTime = static_cast<MYSQL_TIME*>(m_aData[column - 1].buffer);
Time t;
@@ -286,7 +314,7 @@ template <> Time OPreparedResultSet::retrieveValue(sal_Int32 column)
template <> DateTime OPreparedResultSet::retrieveValue(sal_Int32 column)
{
if (getTypeFromMysqlType(m_aFields[column - 1].type) != std::type_index(typeid(DateTime)))
- return getRowSetValue(column);
+ return getRowSetValue(column).getDateTime();
const MYSQL_TIME* pTime = static_cast<MYSQL_TIME*>(m_aData[column - 1].buffer);
DateTime t;
@@ -303,9 +331,22 @@ template <> OUString OPreparedResultSet::retrieveValue(sal_Int32 column)
{
// redirect call to the appropriate method if needed
// BLOB can be simply read out as string
+ bool bIsBlobType = false;
+ switch (m_aFields[column - 1].type)
+ {
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ bIsBlobType = true;
+ break;
+ default:
+ bIsBlobType = false;
+ }
+
if (getTypeFromMysqlType(m_aFields[column - 1].type) != std::type_index(typeid(OUString))
- && m_aFields[column - 1].type != MYSQL_TYPE_BLOB)
- return getRowSetValue(column);
+ && !bIsBlobType)
+ return getRowSetValue(column).getString();
const char* sStr = static_cast<const char*>(m_aData[column - 1].buffer);
return OUString(sStr, *m_aData[column - 1].length, m_encoding);
@@ -318,10 +359,13 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 nColumnIndex)
case MYSQL_TYPE_TINY:
return getByte(nColumnIndex);
case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_YEAR:
return getShort(nColumnIndex);
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
return getInt(nColumnIndex);
+ case MYSQL_TYPE_BIT:
+ return ORowSetValue(bool(getBoolean(nColumnIndex)));
case MYSQL_TYPE_LONGLONG:
return getLong(nColumnIndex);
case MYSQL_TYPE_FLOAT:
@@ -341,13 +385,16 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 nColumnIndex)
case MYSQL_TYPE_NEWDECIMAL:
return getString(nColumnIndex);
case MYSQL_TYPE_BLOB:
- throw SQLException("Column with type BLOB cannot be converted", *this, "22000", 1,
- Any());
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ throw SQLException(u"Column with type BLOB cannot be converted"_ustr, *this,
+ u"22000"_ustr, 1, Any());
default:
SAL_WARN("connectivity.mysqlc", "OPreparedResultSet::getRowSetValue: unknown type: "
<< m_aFields[nColumnIndex - 1].type);
- throw SQLException("Unknown column type when fetching result", *this, "22000", 1,
- Any());
+ throw SQLException(u"Unknown column type when fetching result"_ustr, *this,
+ u"22000"_ustr, 1, Any());
}
}
@@ -642,7 +689,7 @@ uno::Reference<uno::XInterface> SAL_CALL OPreparedResultSet::getStatement()
MutexGuard aGuard(m_aMutex);
checkDisposed(OPreparedResultSet_BASE::rBHelper.bDisposed);
- return m_aStatement.get();
+ return cppu::getXWeak(m_xStatement.get().get());
}
sal_Bool SAL_CALL OPreparedResultSet::rowDeleted()
@@ -980,21 +1027,17 @@ uno::Sequence<sal_Int32>
IPropertyArrayHelper* OPreparedResultSet::createArrayHelper() const
{
- uno::Sequence<Property> aProps(5);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = Property("FetchDirection", PROPERTY_ID_FETCHDIRECTION,
- cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property("IsBookmarkable", PROPERTY_ID_ISBOOKMARKABLE,
- cppu::UnoType<bool>::get(), PropertyAttribute::READONLY);
- pProperties[nPos++] = Property("ResultSetConcurrency", PROPERTY_ID_RESULTSETCONCURRENCY,
- cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
- pProperties[nPos++] = Property("ResultSetType", PROPERTY_ID_RESULTSETTYPE,
- cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
+ return new OPropertyArrayHelper{
+ { { u"FetchDirection"_ustr, PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(),
+ 0 },
+ { u"FetchSize"_ustr, PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"IsBookmarkable"_ustr, PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(),
+ PropertyAttribute::READONLY },
+ { u"ResultSetConcurrency"_ustr, PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY },
+ { u"ResultSetType"_ustr, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY } }
+ };
}
IPropertyArrayHelper& OPreparedResultSet::getInfoHelper() { return *getArrayHelper(); }
@@ -1061,9 +1104,9 @@ void OPreparedResultSet::getFastPropertyValue(Any& _rValue, sal_Int32 nHandle) c
}
}
-void SAL_CALL OPreparedResultSet::acquire() throw() { OPreparedResultSet_BASE::acquire(); }
+void SAL_CALL OPreparedResultSet::acquire() noexcept { OPreparedResultSet_BASE::acquire(); }
-void SAL_CALL OPreparedResultSet::release() throw() { OPreparedResultSet_BASE::release(); }
+void SAL_CALL OPreparedResultSet::release() noexcept { OPreparedResultSet_BASE::release(); }
css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL OPreparedResultSet::getPropertySetInfo()
{
@@ -1073,11 +1116,11 @@ css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL OPreparedResultSet::g
void OPreparedResultSet::checkColumnIndex(sal_Int32 index)
{
if (!m_aData)
- throw SQLException("Cursor out of range", *this, "HY109", 1, Any());
+ throw SQLException(u"Cursor out of range"_ustr, *this, u"HY109"_ustr, 1, Any());
if (index < 1 || index > static_cast<int>(m_nColumnCount))
{
/* static object for efficiency or thread safety is a problem ? */
- throw SQLException("index out of range", *this, "42S22", 1, Any());
+ throw SQLException(u"index out of range"_ustr, *this, u"42S22"_ustr, 1, Any());
}
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
index 511a053b8e1a..3f79ddcd1e73 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSET_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSET_HXX
+#pragma once
#include "mysqlc_preparedstatement.hxx"
#include "mysqlc_statement.hxx"
@@ -42,9 +41,7 @@
namespace connectivity::mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::RuntimeException;
typedef ::cppu::WeakComponentImplHelper12<
css::sdbc::XResultSet, css::sdbc::XRow, css::sdbc::XResultSetMetaDataSupplier,
@@ -53,14 +50,14 @@ typedef ::cppu::WeakComponentImplHelper12<
css::sdbc::XColumnLocate, css::lang::XServiceInfo>
OPreparedResultSet_BASE;
-class OPreparedResultSet final : public OBase_Mutex,
+class OPreparedResultSet final : public cppu::BaseMutex,
public OPreparedResultSet_BASE,
public ::cppu::OPropertySetHelper,
public OPropertyArrayUsageHelper<OPreparedResultSet>
{
OConnection& m_rConnection;
- css::uno::WeakReferenceHelper m_aStatement;
- css::uno::Reference<css::sdbc::XResultSetMetaData> m_xMetaData;
+ unotools::WeakReference<OPreparedStatement> m_xStatement;
+ rtl::Reference<OResultSetMetaData> m_xMetaData;
// non-owning pointers
MYSQL_RES* m_pResult;
@@ -115,8 +112,8 @@ public:
// XInterface
Any SAL_CALL queryInterface(const css::uno::Type& rType) override;
- void SAL_CALL acquire() throw() override;
- void SAL_CALL release() throw() override;
+ void SAL_CALL acquire() noexcept override;
+ void SAL_CALL release() noexcept override;
//XTypeProvider
css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
@@ -250,6 +247,5 @@ private:
};
} /* connectivity::mysqlc */
-#endif // CONNECTIVITY_SRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
index 2b344843deb2..0c54630f25f2 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
@@ -23,6 +23,7 @@
#include "mysqlc_propertyids.hxx"
#include "mysqlc_resultsetmetadata.hxx"
+#include <o3tl/safeint.hxx>
#include <sal/log.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
@@ -31,8 +32,6 @@
using namespace connectivity::mysqlc;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
@@ -41,12 +40,12 @@ using ::osl::MutexGuard;
OUString OPreparedStatement::getImplementationName()
{
- return "com.sun.star.sdbcx.mysqlc.PreparedStatement";
+ return u"com.sun.star.sdbcx.mysqlc.PreparedStatement"_ustr;
}
css::uno::Sequence<OUString> OPreparedStatement::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.PreparedStatement" };
+ return { u"com.sun.star.sdbc.PreparedStatement"_ustr };
}
sal_Bool OPreparedStatement::supportsService(OUString const& ServiceName)
@@ -73,9 +72,9 @@ OPreparedStatement::OPreparedStatement(OConnection* _pConnection, MYSQL_STMT* pS
OPreparedStatement::~OPreparedStatement() {}
-void SAL_CALL OPreparedStatement::acquire() throw() { OCommonStatement::acquire(); }
+void SAL_CALL OPreparedStatement::acquire() noexcept { OCommonStatement::acquire(); }
-void SAL_CALL OPreparedStatement::release() throw() { OCommonStatement::release(); }
+void SAL_CALL OPreparedStatement::release() noexcept { OCommonStatement::release(); }
Any SAL_CALL OPreparedStatement::queryInterface(const Type& rType)
{
@@ -95,7 +94,7 @@ Sequence<Type> SAL_CALL OPreparedStatement::getTypes()
Reference<XResultSetMetaData> SAL_CALL OPreparedStatement::getMetaData()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
if (!m_xMetaData.is())
{
@@ -109,7 +108,7 @@ Reference<XResultSetMetaData> SAL_CALL OPreparedStatement::getMetaData()
void SAL_CALL OPreparedStatement::close()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
if (mysql_stmt_close(m_pStmt))
{
@@ -124,7 +123,7 @@ void SAL_CALL OPreparedStatement::close()
sal_Bool SAL_CALL OPreparedStatement::execute()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
if (!m_binds.empty() && mysql_stmt_bind_param(m_pStmt, m_binds.data()))
{
@@ -149,7 +148,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
sal_Int32 SAL_CALL OPreparedStatement::executeUpdate()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
if (!m_binds.empty() && mysql_stmt_bind_param(m_pStmt, m_binds.data()))
{
@@ -176,7 +175,7 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate()
void SAL_CALL OPreparedStatement::setString(sal_Int32 parameter, const OUString& x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
OString stringie(OUStringToOString(x, m_xConnection->getConnectionEncoding()));
@@ -191,15 +190,15 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 parameter, const OUString&
Reference<XConnection> SAL_CALL OPreparedStatement::getConnection()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
- return m_xConnection.get();
+ return m_xConnection;
}
Reference<XResultSet> SAL_CALL OPreparedStatement::executeQuery()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
if (!m_binds.empty() && mysql_stmt_bind_param(m_pStmt, m_binds.data()))
{
@@ -226,7 +225,7 @@ Reference<XResultSet> SAL_CALL OPreparedStatement::executeQuery()
void SAL_CALL OPreparedStatement::setBoolean(sal_Int32 parameter, sal_Bool x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -238,7 +237,7 @@ void SAL_CALL OPreparedStatement::setBoolean(sal_Int32 parameter, sal_Bool x)
void SAL_CALL OPreparedStatement::setByte(sal_Int32 parameter, sal_Int8 x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -250,7 +249,7 @@ void SAL_CALL OPreparedStatement::setByte(sal_Int32 parameter, sal_Int8 x)
void SAL_CALL OPreparedStatement::setDate(sal_Int32 parameter, const Date& aData)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
MYSQL_TIME my_time = {};
@@ -268,7 +267,7 @@ void SAL_CALL OPreparedStatement::setDate(sal_Int32 parameter, const Date& aData
void SAL_CALL OPreparedStatement::setTime(sal_Int32 parameter, const Time& aVal)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
MYSQL_TIME my_time = {};
@@ -286,7 +285,7 @@ void SAL_CALL OPreparedStatement::setTime(sal_Int32 parameter, const Time& aVal)
void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 parameter, const DateTime& aVal)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
MYSQL_TIME my_time = {};
@@ -307,7 +306,7 @@ void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 parameter, const DateTi
void SAL_CALL OPreparedStatement::setDouble(sal_Int32 parameter, double x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -319,7 +318,7 @@ void SAL_CALL OPreparedStatement::setDouble(sal_Int32 parameter, double x)
void SAL_CALL OPreparedStatement::setFloat(sal_Int32 parameter, float x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -331,7 +330,7 @@ void SAL_CALL OPreparedStatement::setFloat(sal_Int32 parameter, float x)
void SAL_CALL OPreparedStatement::setInt(sal_Int32 parameter, sal_Int32 x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -343,7 +342,7 @@ void SAL_CALL OPreparedStatement::setInt(sal_Int32 parameter, sal_Int32 x)
void SAL_CALL OPreparedStatement::setLong(sal_Int32 parameter, sal_Int64 aVal)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -355,7 +354,7 @@ void SAL_CALL OPreparedStatement::setLong(sal_Int32 parameter, sal_Int64 aVal)
void SAL_CALL OPreparedStatement::setNull(sal_Int32 parameter, sal_Int32 /*sqlType*/)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -367,7 +366,7 @@ void SAL_CALL OPreparedStatement::setNull(sal_Int32 parameter, sal_Int32 /*sqlTy
void SAL_CALL OPreparedStatement::setClob(sal_Int32 parameter, const Reference<XClob>& /* x */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setClob", *this);
@@ -376,7 +375,7 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 parameter, const Reference<X
void SAL_CALL OPreparedStatement::setBlob(sal_Int32 parameter, const Reference<XBlob>& /* x */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setBlob", *this);
@@ -385,7 +384,7 @@ void SAL_CALL OPreparedStatement::setBlob(sal_Int32 parameter, const Reference<X
void SAL_CALL OPreparedStatement::setArray(sal_Int32 parameter, const Reference<XArray>& /* x */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setArray", *this);
@@ -394,7 +393,7 @@ void SAL_CALL OPreparedStatement::setArray(sal_Int32 parameter, const Reference<
void SAL_CALL OPreparedStatement::setRef(sal_Int32 parameter, const Reference<XRef>& /* x */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setRef", *this);
@@ -403,7 +402,7 @@ void SAL_CALL OPreparedStatement::setRef(sal_Int32 parameter, const Reference<XR
void SAL_CALL OPreparedStatement::setObjectWithInfo(sal_Int32 parameterIndex, const Any& value,
sal_Int32 targetSqlType, sal_Int32 /* scale */)
{
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
MutexGuard aGuard(m_aMutex);
checkParameterIndex(parameterIndex);
@@ -432,7 +431,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo(sal_Int32 parameterIndex, co
{
OString sAscii
= OUStringToOString(sValue, getOwnConnection()->getConnectionEncoding());
- std::stringstream sStream{ sAscii.getStr() };
+ std::stringstream sStream{ std::string(sAscii) };
sStream >> nValue;
m_binds[nIndex].buffer_type = MYSQL_TYPE_DOUBLE;
mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &nValue, MYSQL_TYPE_DOUBLE,
@@ -457,7 +456,7 @@ void SAL_CALL OPreparedStatement::setObjectNull(sal_Int32 parameter, sal_Int32 /
const OUString& /* typeName */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setObjectNull",
@@ -467,7 +466,7 @@ void SAL_CALL OPreparedStatement::setObjectNull(sal_Int32 parameter, sal_Int32 /
void SAL_CALL OPreparedStatement::setObject(sal_Int32 parameter, const Any& /* x */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setObject", *this);
@@ -476,7 +475,7 @@ void SAL_CALL OPreparedStatement::setObject(sal_Int32 parameter, const Any& /* x
void SAL_CALL OPreparedStatement::setShort(sal_Int32 parameter, sal_Int16 x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
@@ -488,13 +487,14 @@ void SAL_CALL OPreparedStatement::setShort(sal_Int32 parameter, sal_Int16 x)
void SAL_CALL OPreparedStatement::setBytes(sal_Int32 parameter, const Sequence<sal_Int8>& x)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
const sal_Int32 nIndex = parameter - 1;
- m_binds[nIndex].buffer_type = MYSQL_TYPE_BLOB; // FIXME
- mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, MYSQL_TYPE_BLOB);
+ m_binds[nIndex].buffer_type = MYSQL_TYPE_BLOB;
+ mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x[0], MYSQL_TYPE_BLOB, x.getLength());
m_bindMetas[nIndex].is_null = false;
+ m_bindMetas[nIndex].length = x.getLength();
}
void SAL_CALL OPreparedStatement::setCharacterStream(sal_Int32 parameter,
@@ -502,7 +502,7 @@ void SAL_CALL OPreparedStatement::setCharacterStream(sal_Int32 parameter,
sal_Int32 /* length */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException(
@@ -514,7 +514,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream(sal_Int32 parameter,
sal_Int32 /* length */)
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
checkParameterIndex(parameter);
mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setBinaryStream",
@@ -524,7 +524,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream(sal_Int32 parameter,
void SAL_CALL OPreparedStatement::clearParameters()
{
MutexGuard aGuard(m_aMutex);
- checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkDisposed(rBHelper.bDisposed);
for (size_t i = 0; i < m_binds.size(); ++i)
{
@@ -569,9 +569,9 @@ void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, con
void OPreparedStatement::checkParameterIndex(sal_Int32 column)
{
- if (column < 1 || column > static_cast<sal_Int32>(m_paramCount))
+ if (column < 1 || o3tl::make_unsigned(column) > m_paramCount)
{
- throw SQLException("Parameter index out of range", *this, OUString(), 1, Any());
+ throw SQLException(u"Parameter index out of range"_ustr, *this, OUString(), 1, Any());
}
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
index 78471b1e3208..d61f616372b0 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_PREPAREDSTATEMENT_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_PREPAREDSTATEMENT_HXX
+#pragma once
#include "mysqlc_statement.hxx"
#include "mysqlc_resultset.hxx"
@@ -31,11 +30,9 @@
namespace connectivity::mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::sdbc::XResultSetMetaData;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Type;
#if defined MYSQL_VERSION_ID && (MYSQL_VERSION_ID >= 80000) && !defined MARIADB_BASE_VERSION
@@ -44,6 +41,8 @@ using my_bool = bool;
using my_bool = char;
#endif
+class OResultSetMetaData;
+
struct BindMetaData
{
my_bool is_null = false;
@@ -58,7 +57,7 @@ typedef ::cppu::ImplHelper4<css::sdbc::XPreparedStatement, css::sdbc::XParameter
class OPreparedStatement final : public OCommonStatement, public OPreparedStatement_BASE
{
unsigned int m_paramCount = 0; // number of placeholders
- Reference<XResultSetMetaData> m_xMetaData;
+ rtl::Reference<OResultSetMetaData> m_xMetaData;
MYSQL_STMT* m_pStmt;
std::vector<MYSQL_BIND> m_binds;
std::vector<BindMetaData> m_bindMetas;
@@ -79,8 +78,8 @@ public:
//XInterface
Any SAL_CALL queryInterface(const Type& rType) override;
- void SAL_CALL acquire() throw() override;
- void SAL_CALL release() throw() override;
+ void SAL_CALL acquire() noexcept override;
+ void SAL_CALL release() noexcept override;
//XTypeProvider
css::uno::Sequence<Type> SAL_CALL getTypes() override;
@@ -154,6 +153,5 @@ public:
};
} /* connectivity::mysqlc */
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_PREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_propertyids.hxx b/connectivity/source/drivers/mysqlc/mysqlc_propertyids.hxx
index 8d8b541cfa24..113b28a2fee7 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_propertyids.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_propertyids.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_PROPERTYIDS_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_PROPERTYIDS_HXX
+#pragma once
// this define has to be set to split the names into different dll's or so's
// every dll has his own set of property names
@@ -42,6 +41,4 @@ enum
} /* connectivity::mysqlc */
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_PROPERTYIDS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
index 75c229823004..ac07b862dc9f 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
@@ -30,6 +30,8 @@
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/seqstream.hxx>
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
using namespace rtl;
@@ -51,14 +53,13 @@ namespace
{
// copied from string misc, it should be replaced when library is not an
// extension anymore
-std::vector<OString> lcl_split(const OString& rStr, char cSeparator)
+std::vector<OString> lcl_split(std::string_view rStr, char cSeparator)
{
std::vector<OString> vec;
sal_Int32 idx = 0;
do
{
- OString kw = rStr.getToken(0, cSeparator, idx);
- kw = kw.trim();
+ OString kw(o3tl::trim(o3tl::getToken(rStr, 0, cSeparator, idx)));
if (!kw.isEmpty())
{
vec.push_back(kw);
@@ -72,7 +73,7 @@ void OResultSet::checkRowIndex()
{
if (m_nRowPosition < 0 || m_nRowPosition >= m_nRowCount)
{
- throw SQLException("Cursor position out of range", *this, OUString(), 1, Any());
+ throw SQLException(u"Cursor position out of range"_ustr, *this, OUString(), 1, Any());
}
}
@@ -89,12 +90,12 @@ bool OResultSet::checkNull(sal_Int32 column)
OUString SAL_CALL OResultSet::getImplementationName()
{
- return "com.sun.star.sdbcx.mysqlc.ResultSet";
+ return u"com.sun.star.sdbcx.mysqlc.ResultSet"_ustr;
}
uno::Sequence<OUString> SAL_CALL OResultSet::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
+ return { u"com.sun.star.sdbc.ResultSet"_ustr, u"com.sun.star.sdbcx.ResultSet"_ustr };
}
sal_Bool SAL_CALL OResultSet::supportsService(const OUString& _rServiceName)
@@ -107,7 +108,7 @@ OResultSet::OResultSet(OConnection& rConn, OCommonStatement* pStmt, MYSQL_RES* p
: OResultSet_BASE(m_aMutex)
, OPropertySetHelper(OResultSet_BASE::rBHelper)
, m_pMysql(rConn.getMysqlConnection())
- , m_aStatement(static_cast<OWeakObject*>(pStmt))
+ , m_aStatement(pStmt)
, m_pResult(pResult)
, m_encoding(_encoding)
{
@@ -138,8 +139,8 @@ void OResultSet::ensureFieldInfoFetched()
MYSQL_FIELD* pFields = mysql_fetch_fields(m_pResult);
m_aFields.reserve(nFieldCount);
for (unsigned i = 0; i < nFieldCount; ++i)
- m_aFields.push_back(OUString{
- pFields[i].name, static_cast<sal_Int32>(strlen(pFields[i].name)), m_encoding });
+ m_aFields.emplace_back(pFields[i].name, static_cast<sal_Int32>(strlen(pFields[i].name)),
+ m_encoding);
}
void OResultSet::fetchResult()
@@ -155,11 +156,11 @@ void OResultSet::fetchResult()
{
MYSQL_ROW data = mysql_fetch_row(m_pResult);
unsigned long* lengths = mysql_fetch_lengths(m_pResult);
- m_aRows.push_back(DataFields{});
+ m_aRows.emplace_back();
// MYSQL_ROW is char**, array of strings
for (std::size_t col = 0; col < m_aFields.size(); ++col)
{
- m_aRows.back().push_back(OString{ data[col], static_cast<sal_Int32>(lengths[col]) });
+ m_aRows.back().emplace_back(data[col], static_cast<sal_Int32>(lengths[col]));
}
}
unsigned errorNum = mysql_errno(m_pMysql);
@@ -181,7 +182,7 @@ void OResultSet::disposing()
mysql_free_result(m_pResult);
m_pResult = nullptr;
}
- m_aStatement = nullptr;
+ m_aStatement.clear();
m_xMetaData = nullptr;
}
@@ -216,8 +217,8 @@ sal_Int32 SAL_CALL OResultSet::findColumn(const OUString& columnName)
return static_cast<sal_Int32>(i) + 1; // sdbc indexes from 1
}
- throw SQLException("The column name '" + columnName + "' is not valid.", *this, "42S22", 0,
- Any());
+ throw SQLException("The column name '" + columnName + "' is not valid.", *this, u"42S22"_ustr,
+ 0, Any());
}
uno::Reference<XInputStream> SAL_CALL OResultSet::getBinaryStream(sal_Int32 column)
@@ -292,24 +293,23 @@ Date SAL_CALL OResultSet::getDate(sal_Int32 column)
if (checkNull(column))
return d;
- OString dateStr = m_aRows[m_nRowPosition][column - 1];
+ const OString& dateStr = m_aRows[m_nRowPosition][column - 1];
- OString dateString(dateStr);
- OString token;
+ std::string_view dateString(dateStr);
sal_Int32 nIndex = 0, i = 0;
do
{
- token = dateString.getToken(0, '-', nIndex);
+ std::string_view token = o3tl::getToken(dateString, 0, '-', nIndex);
switch (i)
{
case 0:
- d.Year = static_cast<sal_uInt16>(token.toUInt32());
+ d.Year = static_cast<sal_uInt16>(o3tl::toUInt32(token));
break;
case 1:
- d.Month = static_cast<sal_uInt16>(token.toUInt32());
+ d.Month = static_cast<sal_uInt16>(o3tl::toUInt32(token));
break;
case 2:
- d.Day = static_cast<sal_uInt16>(token.toUInt32());
+ d.Day = static_cast<sal_uInt16>(o3tl::toUInt32(token));
break;
default:;
}
@@ -467,25 +467,28 @@ Time SAL_CALL OResultSet::getTime(sal_Int32 column)
if (checkNull(column))
return t;
- OString sVal = m_aRows[m_nRowPosition][column - 1];
- OString timeString{ sVal.getStr(), getDataLength(column) };
- OString token;
+ const OString& sVal = m_aRows[m_nRowPosition][column - 1];
+ std::string_view timeString{ sVal.getStr(), o3tl::make_unsigned(getDataLength(column)) };
sal_Int32 nIndex, i = 0;
- nIndex = timeString.indexOf(' ') + 1;
+ size_t idx = timeString.find(' ');
+ if (idx == std::string_view::npos)
+ nIndex = 0;
+ else
+ nIndex = idx + 1;
do
{
- token = timeString.getToken(0, ':', nIndex);
+ std::string_view token = o3tl::getToken(timeString, 0, ':', nIndex);
switch (i)
{
case 0:
- t.Hours = static_cast<sal_uInt16>(token.toUInt32());
+ t.Hours = static_cast<sal_uInt16>(o3tl::toUInt32(token));
break;
case 1:
- t.Minutes = static_cast<sal_uInt16>(token.toUInt32());
+ t.Minutes = static_cast<sal_uInt16>(o3tl::toUInt32(token));
break;
case 2:
- t.Seconds = static_cast<sal_uInt16>(token.toUInt32());
+ t.Seconds = static_cast<sal_uInt16>(o3tl::toUInt32(token));
break;
}
i++;
@@ -506,14 +509,13 @@ DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 column)
OString sVal = m_aRows[m_nRowPosition][column - 1];
// YY-MM-DD HH:MM:SS
- std::vector<OString> dateAndTime
- = lcl_split(OString{ sVal.getStr(), getDataLength(column) }, ' ');
+ std::vector<OString> dateAndTime = lcl_split(sVal.subView(0, getDataLength(column)), ' ');
auto dateParts = lcl_split(dateAndTime.at(0), '-');
auto timeParts = lcl_split(dateAndTime.at(1), ':');
if (dateParts.size() < 2 || timeParts.size() < 2)
- throw SQLException("Timestamp has a wrong format", *this, OUString(), 1, Any());
+ throw SQLException(u"Timestamp has a wrong format"_ustr, *this, OUString(), 1, Any());
DateTime dt;
@@ -670,7 +672,7 @@ uno::Reference<uno::XInterface> SAL_CALL OResultSet::getStatement()
MutexGuard aGuard(m_aMutex);
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_aStatement.get();
+ return cppu::getXWeak(m_aStatement.get().get());
}
sal_Bool SAL_CALL OResultSet::rowDeleted()
@@ -1007,21 +1009,17 @@ uno::Sequence<sal_Int32> SAL_CALL OResultSet::deleteRows(const uno::Sequence<Any
IPropertyArrayHelper* OResultSet::createArrayHelper() const
{
- uno::Sequence<Property> aProps(5);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = Property("FetchDirection", PROPERTY_ID_FETCHDIRECTION,
- cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property("IsBookmarkable", PROPERTY_ID_ISBOOKMARKABLE,
- cppu::UnoType<bool>::get(), PropertyAttribute::READONLY);
- pProperties[nPos++] = Property("ResultSetConcurrency", PROPERTY_ID_RESULTSETCONCURRENCY,
- cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
- pProperties[nPos++] = Property("ResultSetType", PROPERTY_ID_RESULTSETTYPE,
- cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
+ return new OPropertyArrayHelper{
+ { { u"FetchDirection"_ustr, PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(),
+ 0 },
+ { u"FetchSize"_ustr, PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"IsBookmarkable"_ustr, PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(),
+ PropertyAttribute::READONLY },
+ { u"ResultSetConcurrency"_ustr, PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY },
+ { u"ResultSetType"_ustr, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY } }
+ };
}
IPropertyArrayHelper& OResultSet::getInfoHelper() { return *getArrayHelper(); }
@@ -1086,9 +1084,9 @@ void OResultSet::getFastPropertyValue(Any& _rValue, sal_Int32 nHandle) const
}
}
-void SAL_CALL OResultSet::acquire() throw() { OResultSet_BASE::acquire(); }
+void SAL_CALL OResultSet::acquire() noexcept { OResultSet_BASE::acquire(); }
-void SAL_CALL OResultSet::release() throw() { OResultSet_BASE::release(); }
+void SAL_CALL OResultSet::release() noexcept { OResultSet_BASE::release(); }
css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL OResultSet::getPropertySetInfo()
{
@@ -1097,10 +1095,10 @@ css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL OResultSet::getProper
void OResultSet::checkColumnIndex(sal_Int32 index)
{
- if (index < 1 || index > static_cast<int>(m_aFields.size()))
+ if (index < 1 || o3tl::make_unsigned(index) > m_aFields.size())
{
/* static object for efficiency or thread safety is a problem ? */
- throw SQLException("index out of range", *this, OUString(), 1, Any());
+ throw SQLException(u"index out of range"_ustr, *this, OUString(), 1, Any());
}
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx
index 3854ad92944b..baa65be07cc0 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSET_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSET_HXX
+#pragma once
#include "mysqlc_preparedstatement.hxx"
#include "mysqlc_statement.hxx"
@@ -38,12 +37,12 @@
#include <com/sun/star/util/XCancellable.hpp>
#include <cppuhelper/compbase12.hxx>
+#include <unotools/weakref.hxx>
namespace connectivity::mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::RuntimeException;
+class OResultSetMetaData;
/*
** OResultSet
@@ -55,7 +54,7 @@ typedef ::cppu::WeakComponentImplHelper12<
css::sdbc::XColumnLocate, css::lang::XServiceInfo>
OResultSet_BASE;
-class OResultSet final : public OBase_Mutex,
+class OResultSet final : public cppu::BaseMutex,
public OResultSet_BASE,
public ::cppu::OPropertySetHelper,
public OPropertyArrayUsageHelper<OResultSet>
@@ -64,8 +63,8 @@ class OResultSet final : public OBase_Mutex,
std::vector<DataFields> m_aRows;
std::vector<OUString> m_aFields;
MYSQL* m_pMysql = nullptr;
- css::uno::WeakReferenceHelper m_aStatement;
- css::uno::Reference<css::sdbc::XResultSetMetaData> m_xMetaData;
+ unotools::WeakReference<OCommonStatement> m_aStatement;
+ rtl::Reference<OResultSetMetaData> m_xMetaData;
MYSQL_RES* m_pResult;
rtl_TextEncoding m_encoding;
bool m_bWasNull = false; // did the last getXXX result null?
@@ -138,8 +137,8 @@ public:
// XInterface
Any SAL_CALL queryInterface(const css::uno::Type& rType) override;
- void SAL_CALL acquire() throw() override;
- void SAL_CALL release() throw() override;
+ void SAL_CALL acquire() noexcept override;
+ void SAL_CALL release() noexcept override;
//XTypeProvider
css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
@@ -272,6 +271,5 @@ private:
};
} /* connectivity::mysqlc */
-#endif // CONNECTIVITY_SRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
index ab9c2fb39992..21dd0fafc686 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
@@ -21,11 +21,11 @@
#include "mysqlc_general.hxx"
#include <com/sun/star/sdbc/XRow.hpp>
-#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <o3tl/safeint.hxx>
using namespace connectivity::mysqlc;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
using namespace com::sun::star::sdbc;
OResultSetMetaData::OResultSetMetaData(OConnection& rConn, MYSQL_RES* pResult)
@@ -80,11 +80,11 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive(sal_Int32 column)
{
// MYSQL_FIELD::charsetnr is the collation identifier
// _ci postfix means it's insensitive
- OUStringBuffer sql{ "SHOW COLLATION WHERE Id =" };
- sql.append(OUString::number(m_fields.at(column - 1).charsetNumber));
+ OUString sql
+ = "SHOW COLLATION WHERE Id =" + OUString::number(m_fields.at(column - 1).charsetNumber);
Reference<XStatement> stmt = m_rConnection.createStatement();
- Reference<XResultSet> rs = stmt->executeQuery(sql.makeStringAndClear());
+ Reference<XResultSet> rs = stmt->executeQuery(sql);
Reference<XRow> xRow(rs, UNO_QUERY_THROW);
if (!rs->next()) // fetch first and only row
@@ -199,7 +199,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isWritable(sal_Int32 column)
void OResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
{
auto nColCount = m_fields.size();
- if (columnIndex < 1 || columnIndex > static_cast<sal_Int32>(nColCount))
+ if (columnIndex < 1 || o3tl::make_unsigned(columnIndex) > nColCount)
{
OUString str = "Column index out of range (expected 1 to "
+ OUString::number(sal_Int32(nColCount)) + ", got "
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx
index d08d21c47d92..aa84ac05586c 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSETMETADATA_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSETMETADATA_HXX
+#pragma once
#include "mysqlc_connection.hxx"
@@ -31,10 +30,6 @@
namespace connectivity::mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::RuntimeException;
-
struct MySqlFieldInfo
{
OUString columnName;
@@ -101,6 +96,4 @@ public:
};
}
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_RESULTSETMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx
index 5e07982773ce..2d8deaebdec1 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx
@@ -34,9 +34,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
-using namespace com::sun::star::io;
using namespace com::sun::star::util;
using ::osl::MutexGuard;
@@ -53,8 +51,7 @@ void OCommonStatement::closeResultSet()
{
if (m_xResultSet.is())
{
- css::uno::Reference<css::sdbc::XCloseable> xClose(m_xResultSet, UNO_QUERY_THROW);
- xClose->close();
+ m_xResultSet->close();
m_xResultSet.clear();
}
}
@@ -149,11 +146,11 @@ Reference<XResultSet> SAL_CALL OStatement::executeQuery(const OUString& sql)
assert(isRS == m_xResultSet.is());
if (!isRS)
mysqlc_sdbc_driver::throwSQLExceptionWithMsg(
- "executeQuery called on SQL command that does not return a ResultSet", "02000", 0,
+ u"executeQuery called on SQL command that does not return a ResultSet"_ustr, "02000", 0,
*this);
if (!m_xResultSet.is())
mysqlc_sdbc_driver::throwSQLExceptionWithMsg(
- "internal MySQL-SDBC error: executeQuery: no ResultSet after execute() returned true.",
+ u"internal MySQL-SDBC error: executeQuery: no ResultSet after execute() returned true."_ustr,
"02000", 0, *this);
return m_xResultSet;
@@ -165,7 +162,7 @@ Reference<XConnection> SAL_CALL OStatement::getConnection()
checkDisposed(rBHelper.bDisposed);
// just return our connection here
- return m_xConnection.get();
+ return m_xConnection;
}
sal_Int32 SAL_CALL OStatement::getUpdateCount() { return m_nAffectedRows; }
@@ -238,8 +235,8 @@ bool OStatement::getResult()
else
{
mysqlc_sdbc_driver::throwSQLExceptionWithMsg(
- "mysql_store_result indicated success and SQL command was supposed to return a "
- "ResultSet, but did not.",
+ u"mysql_store_result indicated success and SQL command was supposed to return a "
+ "ResultSet, but did not."_ustr,
"02000", 0, *this);
}
//unreachable
@@ -282,7 +279,7 @@ Any SAL_CALL OCommonStatement::getWarnings()
MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
- return makeAny(m_aLastWarning);
+ return Any(m_aLastWarning);
}
void SAL_CALL OCommonStatement::clearWarnings()
@@ -297,31 +294,20 @@ void SAL_CALL OCommonStatement::clearWarnings()
{
// this properties are define by the service statement
// they must in alphabetic order
- Sequence<Property> aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++]
- = Property("CursorName", PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++]
- = Property("EscapeProcessing", PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0);
- pProperties[nPos++] = Property("FetchDirection", PROPERTY_ID_FETCHDIRECTION,
- cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("MaxFieldSize", PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("MaxRows", PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("QueryTimeOut", PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property("ResultSetConcurrency", PROPERTY_ID_RESULTSETCONCURRENCY,
- cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("ResultSetType", PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++]
- = Property("UseBookmarks", PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper{
+ { { u"CursorName"_ustr, PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0 },
+ { u"EscapeProcessing"_ustr, PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0 },
+ { u"FetchDirection"_ustr, PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(),
+ 0 },
+ { u"FetchSize"_ustr, PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"MaxFieldSize"_ustr, PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"MaxRows"_ustr, PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"QueryTimeOut"_ustr, PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"ResultSetConcurrency"_ustr, PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"ResultSetType"_ustr, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { u"UseBookmarks"_ustr, PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0 } }
+ };
}
::cppu::IPropertyArrayHelper& OCommonStatement::getInfoHelper() { return *getArrayHelper(); }
@@ -374,11 +360,11 @@ void OCommonStatement::getFastPropertyValue(Any& _rValue, sal_Int32 nHandle) con
}
}
-OUString OStatement::getImplementationName() { return "com.sun.star.sdbcx.OStatement"; }
+OUString OStatement::getImplementationName() { return u"com.sun.star.sdbcx.OStatement"_ustr; }
css::uno::Sequence<OUString> OStatement::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.Statement" };
+ return { u"com.sun.star.sdbc.Statement"_ustr };
}
sal_Bool OStatement::supportsService(OUString const& ServiceName)
@@ -386,13 +372,13 @@ sal_Bool OStatement::supportsService(OUString const& ServiceName)
return cppu::supportsService(this, ServiceName);
}
-void SAL_CALL OCommonStatement::acquire() throw() { OCommonStatement_IBase::acquire(); }
+void SAL_CALL OCommonStatement::acquire() noexcept { OCommonStatement_IBase::acquire(); }
-void SAL_CALL OCommonStatement::release() throw() { OCommonStatement_IBase::release(); }
+void SAL_CALL OCommonStatement::release() noexcept { OCommonStatement_IBase::release(); }
-void SAL_CALL OStatement::acquire() throw() { OCommonStatement::acquire(); }
+void SAL_CALL OStatement::acquire() noexcept { OCommonStatement::acquire(); }
-void SAL_CALL OStatement::release() throw() { OCommonStatement::release(); }
+void SAL_CALL OStatement::release() noexcept { OCommonStatement::release(); }
Reference<css::beans::XPropertySetInfo> SAL_CALL OCommonStatement::getPropertySetInfo()
{
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx
index c85e054dd732..7e260fe8b144 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_STATEMENT_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_STATEMENT_HXX
+#pragma once
#include "mysqlc_connection.hxx"
#include "mysqlc_subcomponent.hxx"
@@ -37,11 +36,10 @@
namespace connectivity::mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::sdbc::SQLWarning;
using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Type;
+class OResultSet;
typedef ::cppu::WeakComponentImplHelper3<css::sdbc::XWarningsSupplier, css::util::XCancellable,
css::sdbc::XCloseable>
@@ -50,7 +48,7 @@ typedef ::cppu::WeakComponentImplHelper3<css::sdbc::XWarningsSupplier, css::util
//************ Class: OCommonStatement
// is a base class for the normal statement and for the prepared statement
-class OCommonStatement : public OBase_Mutex,
+class OCommonStatement : public cppu::BaseMutex,
public OCommonStatement_IBase,
public ::cppu::OPropertySetHelper,
public OPropertyArrayUsageHelper<OCommonStatement>
@@ -62,7 +60,7 @@ private:
protected:
rtl::Reference<OConnection> m_xConnection; // The owning Connection object
- css::uno::Reference<css::sdbc::XResultSet> m_xResultSet;
+ rtl::Reference<OResultSet> m_xResultSet;
// number of rows affected by an UPDATE, DELETE or INSERT statement.
sal_Int32 m_nAffectedRows = 0;
@@ -94,8 +92,8 @@ public:
void SAL_CALL disposing() override;
// XInterface
- void SAL_CALL release() throw() override;
- void SAL_CALL acquire() throw() override;
+ void SAL_CALL release() noexcept override;
+ void SAL_CALL acquire() noexcept override;
Any SAL_CALL queryInterface(const css::uno::Type& rType) override;
//XTypeProvider
@@ -147,8 +145,8 @@ public:
//XInterface
Any SAL_CALL queryInterface(const css::uno::Type& rType) override;
- void SAL_CALL acquire() throw() override;
- void SAL_CALL release() throw() override;
+ void SAL_CALL acquire() noexcept override;
+ void SAL_CALL release() noexcept override;
//XTypeProvider
css::uno::Sequence<Type> SAL_CALL getTypes() override;
@@ -172,6 +170,5 @@ public:
// css::uno::Sequence<sal_Int32> SAL_CALL executeBatch() override;
};
}
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_STATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_subcomponent.hxx b/connectivity/source/drivers/mysqlc/mysqlc_subcomponent.hxx
index 6d1c07801024..87978b03bd2f 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_subcomponent.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_subcomponent.hxx
@@ -17,22 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_SUBCOMPONENT_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_SUBCOMPONENT_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
-namespace cppu
-{
-class IPropertyArrayHelper;
-}
-namespace com::sun::star::lang
-{
-class XComponent;
-}
-
namespace connectivity::mysqlc
{
/// @throws css::lang::DisposedException
@@ -107,12 +97,6 @@ template <class TYPE>::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYP
return s_pProps;
}
-class OBase_Mutex
-{
-public:
- ::osl::Mutex m_aMutex;
-};
-
namespace internal
{
template <class T> void implCopySequence(const T* _pSource, T*& _pDest, sal_Int32 _nSourceLen)
@@ -142,6 +126,4 @@ css::uno::Sequence<T> concatSequences(const css::uno::Sequence<T>& _rLeft,
}
}
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_SUBCOMPONENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_table.cxx b/connectivity/source/drivers/mysqlc/mysqlc_table.cxx
new file mode 100644
index 000000000000..3c621f9d375d
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_table.cxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mysqlc_columns.hxx"
+#include "mysqlc_indexes.hxx"
+#include "mysqlc_keys.hxx"
+#include "mysqlc_table.hxx"
+
+#include <TConnection.hxx>
+
+#include <comphelper/types.hxx>
+#include <connectivity/dbtools.hxx>
+
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+connectivity::mysqlc::Table::Table(
+ Tables* pTables, osl::Mutex& rMutex,
+ const css::uno::Reference<OMetaConnection::XConnection>& rConnection)
+ : OTableHelper(pTables, rConnection, true)
+ , m_rMutex(rMutex)
+ , m_nPrivileges(0)
+{
+ construct();
+}
+
+connectivity::mysqlc::Table::Table(
+ Tables* pTables, osl::Mutex& rMutex,
+ const css::uno::Reference<OMetaConnection::XConnection>& rConnection, const OUString& rCatalog,
+ const OUString& rSchema, const OUString& rName, const OUString& rType,
+ const OUString& rDescription)
+ : OTableHelper(pTables, rConnection, true, rName, rType, rDescription, rSchema, rCatalog)
+ , m_rMutex(rMutex)
+ , m_nPrivileges(0)
+{
+ construct();
+}
+
+void connectivity::mysqlc::Table::construct()
+{
+ OTableHelper::construct();
+ if (isNew())
+ return;
+
+ // TODO: get privileges when in non-embedded mode.
+ m_nPrivileges = css::sdbcx::Privilege::DROP | css::sdbcx::Privilege::REFERENCE
+ | css::sdbcx::Privilege::ALTER | css::sdbcx::Privilege::CREATE
+ | css::sdbcx::Privilege::READ | css::sdbcx::Privilege::DELETE
+ | css::sdbcx::Privilege::UPDATE | css::sdbcx::Privilege::INSERT
+ | css::sdbcx::Privilege::SELECT;
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES),
+ PROPERTY_ID_PRIVILEGES, css::beans::PropertyAttribute::READONLY,
+ &m_nPrivileges, cppu::UnoType<decltype(m_nPrivileges)>::get());
+}
+//----- OTableHelper ---------------------------------------------------------
+connectivity::sdbcx::OCollection*
+connectivity::mysqlc::Table::createColumns(const ::std::vector<OUString>& rNames)
+{
+ return new Columns(*this, m_rMutex, rNames);
+}
+
+connectivity::sdbcx::OCollection*
+connectivity::mysqlc::Table::createKeys(const ::std::vector<OUString>& rNames)
+{
+ return new Keys(this, m_rMutex, rNames);
+}
+
+connectivity::sdbcx::OCollection*
+connectivity::mysqlc::Table::createIndexes(const ::std::vector<OUString>& rNames)
+{
+ return new Indexes(this, m_rMutex, rNames);
+}
+
+//----- XAlterTable -----------------------------------------------------------
+void SAL_CALL connectivity::mysqlc::Table::alterColumnByName(
+ const OUString& rColName, const css::uno::Reference<XPropertySet>& rDescriptor)
+{
+ osl::MutexGuard aGuard(m_rMutex);
+ checkDisposed(WeakComponentImplHelperBase::rBHelper.bDisposed);
+
+ css::uno::Reference<XPropertySet> xColumn(m_xColumns->getByName(rColName), css::uno::UNO_QUERY);
+
+ // sdbcx::Descriptor
+ const bool bNameChanged
+ = xColumn->getPropertyValue(u"Name"_ustr) != rDescriptor->getPropertyValue(u"Name"_ustr);
+ // sdbcx::ColumnDescriptor
+ const bool bTypeChanged
+ = xColumn->getPropertyValue(u"Type"_ustr) != rDescriptor->getPropertyValue(u"Type"_ustr);
+ const bool bTypeNameChanged
+ = !comphelper::getString(xColumn->getPropertyValue(u"TypeName"_ustr))
+ .equalsIgnoreAsciiCase(
+ comphelper::getString(rDescriptor->getPropertyValue(u"TypeName"_ustr)));
+ const bool bPrecisionChanged = xColumn->getPropertyValue(u"Precision"_ustr)
+ != rDescriptor->getPropertyValue(u"Precision"_ustr);
+ const bool bScaleChanged
+ = xColumn->getPropertyValue(u"Scale"_ustr) != rDescriptor->getPropertyValue(u"Scale"_ustr);
+
+ const bool bIsNullableChanged = xColumn->getPropertyValue(u"IsNullable"_ustr)
+ != rDescriptor->getPropertyValue(u"IsNullable"_ustr);
+
+ const bool bIsAutoIncrementChanged = xColumn->getPropertyValue(u"IsAutoIncrement"_ustr)
+ != rDescriptor->getPropertyValue(u"IsAutoIncrement"_ustr);
+
+ // there's also DefaultValue but not related to database directly, it seems completely internal to LO
+ // so no need to test it
+ // TODO: remainder -- these are all "optional" so have to detect presence and change.
+ if (bTypeChanged || bTypeNameChanged || bPrecisionChanged || bScaleChanged || bIsNullableChanged
+ || bIsAutoIncrementChanged)
+ {
+ // If bPrecisionChanged this will only succeed if we have increased the
+ // precision, otherwise an exception is thrown -- however the base
+ // gui then offers to delete and recreate the column.
+ OUStringBuffer sSql(300);
+ sSql.append(getAlterTableColumnPart() + " MODIFY COLUMN `" + rColName + "` "
+ + ::dbtools::createStandardTypePart(rDescriptor, getConnection()));
+
+ if (comphelper::getBOOL(rDescriptor->getPropertyValue(u"IsAutoIncrement"_ustr)))
+ sSql.append(" auto_increment");
+
+ // see ColumnValue: NO_NULLS = 0, NULLABLE = 1, NULLABLE_UNKNOWN
+ // so entry required = yes corresponds to NO_NULLS = 0 and only in this case
+ // NOT NULL
+ if (comphelper::getINT32(rDescriptor->getPropertyValue(u"IsNullable"_ustr)) == 0)
+ sSql.append(" NOT NULL");
+
+ getConnection()->createStatement()->execute(sSql.makeStringAndClear());
+ }
+
+ if (bNameChanged)
+ {
+ OUString sNewColName;
+ rDescriptor->getPropertyValue(u"Name"_ustr) >>= sNewColName;
+ OUString sSql(getAlterTableColumnPart() + " RENAME COLUMN `" + rColName + "` TO `"
+ + sNewColName + "`");
+
+ getConnection()->createStatement()->execute(sSql);
+ }
+
+ m_xColumns->refresh();
+}
+
+void SAL_CALL connectivity::mysqlc::Table::alterColumnByIndex(
+ sal_Int32 index, const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ osl::MutexGuard aGuard(m_rMutex);
+ css::uno::Reference<XPropertySet> xColumn(m_xColumns->getByIndex(index),
+ css::uno::UNO_QUERY_THROW);
+ alterColumnByName(comphelper::getString(xColumn->getPropertyValue(
+ OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),
+ descriptor);
+}
+
+OUString connectivity::mysqlc::Table::getAlterTableColumnPart() const
+{
+ return "ALTER TABLE "
+ + ::dbtools::composeTableName(getMetaData(), m_CatalogName, m_SchemaName, m_Name, true,
+ ::dbtools::EComposeRule::InTableDefinitions);
+}
+
+OUString connectivity::mysqlc::Table::getRenameStart() const { return u"RENAME TABLE "_ustr; }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_table.hxx b/connectivity/source/drivers/mysqlc/mysqlc_table.hxx
new file mode 100644
index 000000000000..7487f1bc7b34
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_table.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "mysqlc_tables.hxx"
+
+#include <connectivity/TTableHelper.hxx>
+
+namespace connectivity::mysqlc
+{
+class Table : public OTableHelper
+{
+private:
+ ::osl::Mutex& m_rMutex;
+ sal_Int32 m_nPrivileges;
+
+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& rCatalog,
+ const OUString& rSchema, 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;
+
+ /** 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;
+
+ // 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;
+
+ virtual void SAL_CALL alterColumnByIndex(
+ sal_Int32 index, const css::uno::Reference<css::beans::XPropertySet>& descriptor) override;
+
+ /** returns the ALTER TABLE XXX statement
+ */
+ OUString getAlterTableColumnPart() const;
+};
+
+} // namespace connectivity::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_tables.cxx b/connectivity/source/drivers/mysqlc/mysqlc_tables.cxx
new file mode 100644
index 000000000000..dd59963075ea
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_tables.cxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mysqlc_table.hxx"
+#include "mysqlc_tables.hxx"
+#include "mysqlc_catalog.hxx"
+
+#include <TConnection.hxx>
+
+#include <connectivity/dbtools.hxx>
+
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <comphelper/types.hxx>
+
+//----- OCollection -----------------------------------------------------------
+void connectivity::mysqlc::Tables::impl_refresh()
+{
+ static_cast<Catalog&>(m_rParent).refreshTables();
+}
+
+static void lcl_unescape(OUString& rName)
+{
+ // Remove ending ` if there's one
+ sal_Int32 nLastIndexBacktick = rName.lastIndexOf("`");
+ if ((nLastIndexBacktick > 0) && (nLastIndexBacktick == (rName.getLength() - 1)))
+ {
+ rName = rName.copy(0, nLastIndexBacktick);
+ }
+
+ // Remove beginning `
+ nLastIndexBacktick = rName.indexOf("`");
+ if (nLastIndexBacktick == 0)
+ {
+ rName = rName.copy(1, rName.getLength() - 1);
+ }
+
+ // Replace double ` by simple `
+ rName = rName.replaceAll("``", "`");
+}
+
+css::uno::Reference<css::beans::XPropertySet>
+connectivity::mysqlc::Tables::createObject(const OUString& rName)
+{
+ OUString sCatalog, sSchema, sTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData, rName, sCatalog, sSchema, sTable,
+ ::dbtools::EComposeRule::InDataManipulation);
+
+ css::uno::Any aCatalog;
+ if (!sCatalog.isEmpty())
+ {
+ lcl_unescape(sCatalog);
+ aCatalog <<= sCatalog;
+ }
+
+ lcl_unescape(sSchema);
+ lcl_unescape(sTable);
+
+ // Only retrieving a single table, so table type is irrelevant (param 4)
+ css::uno::Reference<css::sdbc::XResultSet> xTables
+ = m_xMetaData->getTables(aCatalog, sSchema, sTable, css::uno::Sequence<OUString>());
+
+ if (!xTables.is())
+ throw css::uno::RuntimeException(u"Could not acquire table."_ustr);
+
+ css::uno::Reference<css::sdbc::XRow> xRow(xTables, css::uno::UNO_QUERY_THROW);
+
+ if (!xTables->next())
+ throw css::uno::RuntimeException();
+
+ css::uno::Reference<css::beans::XPropertySet> xRet(
+ new Table(this, m_rMutex, m_xMetaData->getConnection(),
+ xRow->getString(1), // Catalog
+ xRow->getString(2), // Schema
+ xRow->getString(3), // Name
+ xRow->getString(4), // Type
+ xRow->getString(5))); // Description / Remarks / Comments
+
+ if (xTables->next())
+ throw css::uno::RuntimeException(u"Found more tables than expected."_ustr);
+
+ return xRet;
+}
+
+css::uno::Reference<css::beans::XPropertySet> connectivity::mysqlc::Tables::createDescriptor()
+{
+ // There is some internal magic so that the same class can be used as either
+ // a descriptor or as a normal table. See VTable.cxx for the details. In our
+ // case we just need to ensure we use the correct constructor.
+ return new Table(this, m_rMutex, m_xMetaData->getConnection());
+}
+
+//----- XAppend ---------------------------------------------------------------
+void connectivity::mysqlc::Tables::createTable(
+ const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ const css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
+ OUString aSql = ::dbtools::createSqlCreateTableStatement(descriptor, xConnection);
+
+ css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
+ if (xStmt.is())
+ {
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+}
+
+// XAppend
+css::uno::Reference<css::beans::XPropertySet> connectivity::mysqlc::Tables::appendObject(
+ const OUString& _rForName, const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ createTable(descriptor);
+ return createObject(_rForName);
+}
+
+void connectivity::mysqlc::Tables::appendNew(const OUString& _rsNewTable)
+{
+ insertElement(_rsNewTable, nullptr);
+
+ // notify our container listeners
+ css::container::ContainerEvent aEvent(static_cast<XContainer*>(this),
+ css::uno::Any(_rsNewTable), css::uno::Any(),
+ css::uno::Any());
+ comphelper::OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
+ while (aListenerLoop.hasMoreElements())
+ aListenerLoop.next()->elementInserted(aEvent);
+}
+
+OUString connectivity::mysqlc::Tables::getNameForObject(
+ const css::uno::Reference<css::beans::XPropertySet>& _xObject)
+{
+ OSL_ENSURE(_xObject.is(), "OTables::getNameForObject: Object is NULL!");
+ return ::dbtools::composeTableName(m_xMetaData, _xObject,
+ ::dbtools::EComposeRule::InDataManipulation, false)
+ .replaceAll(u"`", u"̀ `");
+}
+
+//----- XDrop -----------------------------------------------------------------
+void connectivity::mysqlc::Tables::dropObject(sal_Int32 nPosition, const OUString& sName)
+{
+ css::uno::Reference<css::beans::XPropertySet> xTable(getObject(nPosition));
+
+ if (connectivity::sdbcx::ODescriptor::isNew(xTable))
+ return;
+
+ OUString sType;
+ xTable->getPropertyValue(u"Type"_ustr) >>= sType;
+
+ OUString sCatalog, sSchema, sTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData, sName, sCatalog, sSchema, sTable,
+ ::dbtools::EComposeRule::InDataManipulation);
+
+ OUString sComposedName(::dbtools::composeTableName(
+ m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InDataManipulation));
+
+ m_xMetaData->getConnection()->createStatement()->execute("DROP " + sType + " " + sComposedName);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_tables.hxx b/connectivity/source/drivers/mysqlc/mysqlc_tables.hxx
new file mode 100644
index 000000000000..0dff83f247f5
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_tables.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <utility>
+
+namespace connectivity::mysqlc
+{
+/**
+* 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;
+
+ // 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;
+
+ void createTable(const css::uno::Reference<css::beans::XPropertySet>& descriptor);
+ virtual OUString
+ getNameForObject(const css::uno::Reference<css::beans::XPropertySet>& _xObject) override;
+ // XDrop
+ virtual void dropObject(sal_Int32 nPosition, const OUString& rName) 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))
+ {
+ }
+
+ void appendNew(const OUString& _rsNewTable);
+ // TODO: should we also implement XDataDescriptorFactory, XRefreshable,
+ // XAppend, etc. ?
+};
+
+} // namespace connectivity::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_types.cxx b/connectivity/source/drivers/mysqlc/mysqlc_types.cxx
index 219e0d553d41..b29360c59077 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_types.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_types.cxx
@@ -29,14 +29,14 @@ TypeInfoDef const mysqlc_types[] = {
// ------------- MySQL-Type: BIT. SDBC-Type: Bit -------------
{
"BIT", // Typename
- com::sun::star::sdbc::DataType::BIT, // sdbc-type
+ css::sdbc::DataType::BIT, // sdbc-type
1, // Precision
"", // Literal prefix
"", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -48,14 +48,14 @@ TypeInfoDef const mysqlc_types[] = {
// ------------ MySQL-Type: BOOL. SDBC-Type: Bit -------------
{
"BOOL", // Typename
- com::sun::star::sdbc::DataType::BIT, // sdbc-type
+ css::sdbc::DataType::BIT, // sdbc-type
1, // Precision
"", // Literal prefix
"", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -67,14 +67,14 @@ TypeInfoDef const mysqlc_types[] = {
// --------- MySQL-Type: TINYINT SDBC-Type: TINYINT ----------
{
"TINYINT", // Typename
- com::sun::star::sdbc::DataType::TINYINT, // sdbc-type
+ css::sdbc::DataType::TINYINT, // sdbc-type
3, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M)] [UNSIGNED] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
true, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -86,14 +86,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: BIGINT SDBC-Type: BIGINT ----------
{
"BIGINT", // Typename
- com::sun::star::sdbc::DataType::BIGINT, // sdbc-type
+ css::sdbc::DataType::BIGINT, // sdbc-type
19, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M)] [UNSIGNED] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
true, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -105,14 +105,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: LONG VARBINARY SDBC-Type: LONGVARBINARY ----------
{
"LONG VARBINARY", // Typename
- com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ css::sdbc::DataType::LONGVARBINARY, // sdbc-type
16777215, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -124,14 +124,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: MEDIUMBLOB SDBC-Type: LONGVARBINARY ----------
{
"MEDIUMBLOB", // Typename
- com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ css::sdbc::DataType::LONGVARBINARY, // sdbc-type
16777215, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -143,14 +143,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: LONGBLOB SDBC-Type: LONGVARBINARY ----------
{
"LONGBLOB", // Typename
- com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ css::sdbc::DataType::LONGVARBINARY, // sdbc-type
-1, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -162,14 +162,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: BLOB SDBC-Type: LONGVARBINARY ----------
{
"BLOB", // Typename
- com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ css::sdbc::DataType::LONGVARBINARY, // sdbc-type
0xFFFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -181,14 +181,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: TINYBLOB SDBC-Type: LONGVARBINARY ----------
{
"TINYBLOB", // Typename
- com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ css::sdbc::DataType::LONGVARBINARY, // sdbc-type
0xFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -200,14 +200,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: VARBINARY SDBC-Type: VARBINARY ----------
{
"VARBINARY", // Typename
- com::sun::star::sdbc::DataType::VARBINARY, // sdbc-type
+ css::sdbc::DataType::VARBINARY, // sdbc-type
0xFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"(M)", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -219,14 +219,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: BINARY SDBC-Type: BINARY ----------
{
"BINARY", // Typename
- com::sun::star::sdbc::DataType::BINARY, // sdbc-type
+ css::sdbc::DataType::BINARY, // sdbc-type
0xFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"(M)", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
true, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -238,14 +238,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: LONG VARCHAR SDBC-Type: LONG VARCHAR ----------
{
"LONG VARCHAR", // Typename
- com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ css::sdbc::DataType::LONGVARCHAR, // sdbc-type
0xFFFFFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -257,14 +257,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: MEDIUMTEXT SDBC-Type: LONG VARCHAR ----------
{
"MEDIUMTEXT", // Typename
- com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ css::sdbc::DataType::LONGVARCHAR, // sdbc-type
0xFFFFFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -276,14 +276,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: LONGTEXT SDBC-Type: LONG VARCHAR ----------
{
"LONGTEXT", // Typename
- com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ css::sdbc::DataType::LONGVARCHAR, // sdbc-type
0xFFFFFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -295,14 +295,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: TEXT SDBC-Type: LONG VARCHAR ----------
{
"TEXT", // Typename
- com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ css::sdbc::DataType::LONGVARCHAR, // sdbc-type
0xFFFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -314,14 +314,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: TINYTEXT SDBC-Type: LONG VARCHAR ----------
{
"TINYTEXT", // Typename
- com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ css::sdbc::DataType::LONGVARCHAR, // sdbc-type
0xFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -333,14 +333,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: CHAR SDBC-Type: CHAR ----------
{
"CHAR", // Typename
- com::sun::star::sdbc::DataType::CHAR, // sdbc-type
+ css::sdbc::DataType::CHAR, // sdbc-type
0xFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"(M)", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -352,14 +352,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: DECIMAL SDBC-Type: DECIMAL ----------
{
"DECIMAL", // Typename
- com::sun::star::sdbc::DataType::DECIMAL, // sdbc-type
+ css::sdbc::DataType::DECIMAL, // sdbc-type
17, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M[,D])] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -371,14 +371,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: NUMERIC SDBC-Type: NUMERIC ----------
{
"NUMERIC", // Typename
- com::sun::star::sdbc::DataType::NUMERIC, // sdbc-type
+ css::sdbc::DataType::NUMERIC, // sdbc-type
17, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M[,D])] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -390,14 +390,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: INTEGER SDBC-Type: INTEGER ----------
{
"INTEGER", // Typename
- com::sun::star::sdbc::DataType::INTEGER, // sdbc-type
+ css::sdbc::DataType::INTEGER, // sdbc-type
10, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M)] [UNSIGNED] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
true, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -409,14 +409,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: INT SDBC-Type: INTEGER ----------
{
"INT", // Typename
- com::sun::star::sdbc::DataType::INTEGER, // sdbc-type
+ css::sdbc::DataType::INTEGER, // sdbc-type
10, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M)] [UNSIGNED] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
true, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -428,14 +428,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: MEDIUMINT SDBC-Type: INTEGER ----------
{
"MEDIUMINT", // Typename
- com::sun::star::sdbc::DataType::INTEGER, // sdbc-type
+ css::sdbc::DataType::INTEGER, // sdbc-type
7, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M)] [UNSIGNED] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
true, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -447,14 +447,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: SMALLINT SDBC-Type: INTEGER ----------
{
"SMALLINT", // Typename
- com::sun::star::sdbc::DataType::SMALLINT, // sdbc-type
+ css::sdbc::DataType::SMALLINT, // sdbc-type
5, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M)] [UNSIGNED] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
true, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -466,14 +466,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: FLOAT SDBC-Type: REAL ----------
{
"FLOAT", // Typename
- com::sun::star::sdbc::DataType::REAL, // sdbc-type
+ css::sdbc::DataType::REAL, // sdbc-type
10, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M,D)] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -485,14 +485,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: DOUBLE SDBC-Type: DOUBLE ----------
{
"DOUBLE", // Typename
- com::sun::star::sdbc::DataType::DOUBLE, // sdbc-type
+ css::sdbc::DataType::DOUBLE, // sdbc-type
17, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M,D)] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -504,14 +504,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: DOUBLE PRECISION SDBC-Type: DOUBLE ----------
{
"DOUBLE PRECISION", // Typename
- com::sun::star::sdbc::DataType::DOUBLE, // sdbc-type
+ css::sdbc::DataType::DOUBLE, // sdbc-type
17, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M,D)] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -523,14 +523,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: REAL SDBC-Type: DOUBLE ----------
{
"REAL", // Typename
- com::sun::star::sdbc::DataType::DOUBLE, // sdbc-type
+ css::sdbc::DataType::DOUBLE, // sdbc-type
17, // Precision
"", // Literal prefix
"", // Literal suffix
"[(M,D)] [ZEROFILL]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
true, // auto_increment
@@ -542,14 +542,22 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: VARCHAR SDBC-Type: VARCHAR ----------
{
"VARCHAR", // Typename
- com::sun::star::sdbc::DataType::VARCHAR, // sdbc-type
- 255, // Precision
+ css::sdbc::DataType::VARCHAR, // sdbc-type
+ // tdf#165928: a VARCHAR should be more than 255 characters
+ // Mysql/MariaDB accepts 65535 bytes
+ // see https://mariadb.com/docs/skysql-dbaas/ref/xpand/data-types/VARCHAR/
+ // but precision corresponds to the number of characters and not the number of bytes:
+ // see https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html
+ // Knowing that Unicode can use until 4 bytes, it means a varchar field can contain:
+ // 65535 / 4, so 16383 characters
+ // TODO if there's a way to retrieve the encoding, we could be more precise
+ 16383, // Precision
"'", // Literal prefix
"'", // Literal suffix
"(M)", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -561,14 +569,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: ENUM SDBC-Type: VARCHAR ----------
{
"ENUM", // Typename
- com::sun::star::sdbc::DataType::VARCHAR, // sdbc-type
+ css::sdbc::DataType::VARCHAR, // sdbc-type
0xFFFF, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -580,14 +588,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: SET SDBC-Type: VARCHAR ----------
{
"SET", // Typename
- com::sun::star::sdbc::DataType::VARCHAR, // sdbc-type
+ css::sdbc::DataType::VARCHAR, // sdbc-type
64, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -599,14 +607,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: DATE SDBC-Type: DATE ----------
{
"DATE", // Typename
- com::sun::star::sdbc::DataType::DATE, // sdbc-type
+ css::sdbc::DataType::DATE, // sdbc-type
0, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -618,14 +626,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: TIME SDBC-Type: TIME ----------
{
"TIME", // Typename
- com::sun::star::sdbc::DataType::TIME, // sdbc-type
+ css::sdbc::DataType::TIME, // sdbc-type
0, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -637,14 +645,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: DATETIME SDBC-Type: TIMESTAMP ----------
{
"DATETIME", // Typename
- com::sun::star::sdbc::DataType::TIMESTAMP, // sdbc-type
+ css::sdbc::DataType::TIMESTAMP, // sdbc-type
0, // Precision
"'", // Literal prefix
"'", // Literal suffix
"", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -656,14 +664,14 @@ TypeInfoDef const mysqlc_types[] = {
// ----------- MySQL-Type: TIMESTAMP SDBC-Type: TIMESTAMP ----------
{
"TIMESTAMP", // Typename
- com::sun::star::sdbc::DataType::TIMESTAMP, // sdbc-type
+ css::sdbc::DataType::TIMESTAMP, // sdbc-type
0, // Precision
"'", // Literal prefix
"'", // Literal suffix
"[(M)]", // Create params
- com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ css::sdbc::ColumnValue::NULLABLE, // nullable
false, // case sensitive
- com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ css::sdbc::ColumnSearch::FULL, // searchable
false, // unsignable
false, // fixed_prec_scale
false, // auto_increment
@@ -673,6 +681,27 @@ TypeInfoDef const mysqlc_types[] = {
},
// ----------- MySQL-Type: TIMESTAMP SDBC-Type: TIMESTAMP ----------
+
+ // ----------- MySQL-Type: YEAR SDBC-Type: INTEGER ----------
+ {
+ "YEAR", // Typename
+ css::sdbc::DataType::SMALLINT, // sdbc-type
+ 10, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M)] [UNSIGNED] [ZEROFILL]", // Create params
+ css::sdbc::ColumnValue::NULLABLE, // nullable
+ false, // case sensitive
+ css::sdbc::ColumnSearch::FULL, // searchable
+ true, // unsignable
+ false, // fixed_prec_scale
+ true, // auto_increment
+ "YEAR", // local type name
+ 0, // minimum scale
+ 0 // maximum scale
+ },
+
+ // ----------- MySQL-Type: YEAR SDBC-Type: INTEGER ----------
{ nullptr, 0, 0, nullptr, nullptr, nullptr, 0, false, 0, false, false, false, nullptr, 0, 0 }
};
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_types.hxx b/connectivity/source/drivers/mysqlc/mysqlc_types.hxx
index 5f577ee0352b..9f2db7715fe6 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_types.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_types.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_TYPES_HXX
-#define INCLUDED_MYSQLC_SOURCE_MYSQLC_TYPES_HXX
+#pragma once
#include <sal/types.h>
@@ -43,6 +42,4 @@ struct TypeInfoDef
extern TypeInfoDef const mysqlc_types[];
-#endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_TYPES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_user.cxx b/connectivity/source/drivers/mysqlc/mysqlc_user.cxx
new file mode 100644
index 000000000000..d4f6bdad8b25
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_user.cxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <utility>
+
+#include "mysqlc_user.hxx"
+#include <comphelper/types.hxx>
+#include <connectivity/dbtools.hxx>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
+#include <TConnection.hxx>
+
+using namespace ::connectivity;
+using namespace ::connectivity::mysqlc;
+using namespace ::connectivity::sdbcx;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+
+User::User(css::uno::Reference<css::sdbc::XConnection> xConnection)
+ : OUser(true) // Case Sensitive
+ , m_xConnection(std::move(xConnection))
+{
+}
+
+User::User(css::uno::Reference<css::sdbc::XConnection> xConnection, const OUString& rName)
+ : OUser(rName,
+ true) // Case Sensitive
+ , m_xConnection(std::move(xConnection))
+{
+}
+
+OUserExtend::OUserExtend(const css::uno::Reference<css::sdbc::XConnection>& xConnection,
+ const OUString& rName)
+ : User(xConnection, rName)
+{
+ construct();
+}
+
+void OUserExtend::construct()
+{
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),
+ PROPERTY_ID_NAME, 0, &m_Name, ::cppu::UnoType<OUString>::get());
+
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD),
+ PROPERTY_ID_PASSWORD, 0, &m_Password, ::cppu::UnoType<OUString>::get());
+}
+
+void User::changePassword(const OUString& /* oldPassword */, const OUString& newPassword)
+{
+ css::uno::Reference<XStatement> statement = m_xConnection->createStatement();
+ statement->execute("SET PASSWORD FOR " + m_Name + " = PASSWORD('" + newPassword + "')");
+ ::comphelper::disposeComponent(statement);
+}
+
+cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const
+{
+ css::uno::Sequence<css::beans::Property> aProps;
+ describeProperties(aProps);
+ return new cppu::OPropertyArrayHelper(aProps);
+}
+
+cppu::IPropertyArrayHelper& OUserExtend::getInfoHelper()
+{
+ return *OUserExtend_PROP::getArrayHelper();
+}
+
+typedef connectivity::sdbcx::OUser_BASE OUser_BASE_RBHELPER;
+
+sal_Int32 SAL_CALL User::getPrivileges(const OUString& objName, sal_Int32 objType)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
+
+ sal_Int32 nRights, nRightsWithGrant;
+ findPrivilegesAndGrantPrivileges(objName, objType, nRights, nRightsWithGrant);
+ return nRights;
+}
+
+void User::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,
+ sal_Int32& nRights, sal_Int32& nRightsWithGrant)
+{
+ nRightsWithGrant = nRights = 0;
+ // first we need to create the sql stmt to select the privs
+ css::uno::Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ OUString sCatalog, sSchema, sTable;
+ ::dbtools::qualifiedNameComponents(xMeta, objName, sCatalog, sSchema, sTable,
+ ::dbtools::EComposeRule::InDataManipulation);
+ css::uno::Reference<XResultSet> xRes;
+ switch (objType)
+ {
+ case css::sdbcx::PrivilegeObject::TABLE:
+ case css::sdbcx::PrivilegeObject::VIEW:
+ {
+ css::uno::Any aCatalog;
+ if (!sCatalog.isEmpty())
+ aCatalog <<= sCatalog;
+ xRes = xMeta->getTablePrivileges(aCatalog, sSchema, sTable);
+ }
+ break;
+
+ case css::sdbcx::PrivilegeObject::COLUMN:
+ {
+ css::uno::Any aCatalog;
+ if (!sCatalog.isEmpty())
+ aCatalog <<= sCatalog;
+ xRes = xMeta->getColumnPrivileges(aCatalog, sSchema, sTable, u"%"_ustr);
+ }
+ break;
+ }
+
+ if (!xRes.is())
+ return;
+
+ static const char sYes[] = "YES";
+
+ nRightsWithGrant = nRights = 0;
+
+ css::uno::Reference<XRow> xCurrentRow(xRes, css::uno::UNO_QUERY);
+ while (xCurrentRow.is() && xRes->next())
+ {
+ OUString sGrantee = xCurrentRow->getString(5);
+ OUString sPrivilege = xCurrentRow->getString(6);
+ OUString sGrantable = xCurrentRow->getString(7);
+
+ if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
+ continue;
+
+ if (sPrivilege.equalsIgnoreAsciiCase("SELECT"))
+ {
+ nRights |= Privilege::SELECT;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::SELECT;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("INSERT"))
+ {
+ nRights |= Privilege::INSERT;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::INSERT;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE"))
+ {
+ nRights |= Privilege::UPDATE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::UPDATE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("DELETE"))
+ {
+ nRights |= Privilege::DELETE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::DELETE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("READ"))
+ {
+ nRights |= Privilege::READ;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::READ;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("CREATE"))
+ {
+ nRights |= Privilege::CREATE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::CREATE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("ALTER"))
+ {
+ nRights |= Privilege::ALTER;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::ALTER;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCES"))
+ {
+ nRights |= Privilege::REFERENCE;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::REFERENCE;
+ }
+ else if (sPrivilege.equalsIgnoreAsciiCase("DROP"))
+ {
+ nRights |= Privilege::DROP;
+ if (sGrantable.equalsIgnoreAsciiCase(sYes))
+ nRightsWithGrant |= Privilege::DROP;
+ }
+ }
+ ::comphelper::disposeComponent(xRes);
+}
+
+sal_Int32 SAL_CALL User::getGrantablePrivileges(const OUString& objName, sal_Int32 objType)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
+
+ sal_Int32 nRights, nRightsWithGrant;
+ findPrivilegesAndGrantPrivileges(objName, objType, nRights, nRightsWithGrant);
+ return nRightsWithGrant;
+}
+
+//----- IRefreshableGroups ----------------------------------------------------
+void User::refreshGroups()
+{
+ // TODO: implement.
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_user.hxx b/connectivity/source/drivers/mysqlc/mysqlc_user.hxx
new file mode 100644
index 000000000000..6bebbaa64a11
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_user.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sdbcx/VUser.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+namespace connectivity::mysqlc
+{
+/**
+* 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(css::uno::Reference<css::sdbc::XConnection> xConnection);
+ /**
+ * For a user that already exists in the db.
+ */
+ User(css::uno::Reference<css::sdbc::XConnection> xConnection, 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;
+ // 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);
+
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges(const OUString&, sal_Int32) override;
+
+ // IRefreshableGroups::
+ virtual void refreshGroups() override;
+};
+
+class OUserExtend;
+typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP;
+
+class OUserExtend : public User, 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,
+ const OUString& rName);
+
+ virtual void construct() override;
+};
+
+} // namespace connectivity::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_users.cxx b/connectivity/source/drivers/mysqlc/mysqlc_users.cxx
new file mode 100644
index 000000000000..e2149d532d04
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_users.cxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <utility>
+
+#include "mysqlc_user.hxx"
+#include "mysqlc_users.hxx"
+#include <comphelper/types.hxx>
+#include <connectivity/dbtools.hxx>
+#include <TConnection.hxx>
+
+using namespace ::connectivity;
+using namespace ::connectivity::mysqlc;
+using namespace ::connectivity::sdbcx;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::uno;
+
+Users::Users(const uno::Reference<XDatabaseMetaData>& rMetaData, OWeakObject& rParent,
+ Mutex& rMutex, ::std::vector<OUString> const& rNames)
+ : OCollection(rParent, true, rMutex, rNames)
+ , m_xMetaData(rMetaData)
+{
+}
+
+//----- OCollection -----------------------------------------------------------
+void Users::impl_refresh()
+{
+ // TODO: IMPLEMENT ME
+}
+
+css::uno::Reference<css::beans::XPropertySet> Users::createObject(const OUString& rName)
+{
+ return new OUserExtend(m_xMetaData->getConnection(), rName);
+}
+
+uno::Reference<XPropertySet> Users::createDescriptor()
+{
+ // There is some internal magic so that the same class can be used as either
+ // a descriptor or as a normal user. See VUser.cxx for the details. In our
+ // case we just need to ensure we use the correct constructor.
+ return new OUserExtend(m_xMetaData->getConnection(), u""_ustr);
+}
+
+//----- XAppend ---------------------------------------------------------------
+css::uno::Reference<css::beans::XPropertySet>
+Users::appendObject(const OUString& rName, const uno::Reference<XPropertySet>& descriptor)
+{
+ OUString aSql(u"GRANT USAGE ON * TO "_ustr);
+ OUString aQuote = m_xMetaData->getIdentifierQuoteString();
+ aSql += ::dbtools::quoteName(aQuote, rName) + " @\"%\" ";
+ OUString sPassword;
+ descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD))
+ >>= sPassword;
+ if (!sPassword.isEmpty())
+ {
+ aSql += " IDENTIFIED BY '" + sPassword + "'";
+ }
+
+ Reference<XStatement> statement = m_xMetaData->getConnection()->createStatement();
+ if (statement.is())
+ statement->execute(aSql);
+ ::comphelper::disposeComponent(statement);
+
+ return createObject(rName);
+}
+
+//----- XDrop -----------------------------------------------------------------
+void Users::dropObject(sal_Int32 nPosition, const OUString& rName)
+{
+ uno::Reference<XPropertySet> xUser(getObject(nPosition));
+
+ if (!ODescriptor::isNew(xUser))
+ {
+ Reference<XStatement> statement = m_xMetaData->getConnection()->createStatement();
+ if (statement.is())
+ {
+ statement->execute("DROP USER " + rName);
+ ::comphelper::disposeComponent(statement);
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_users.hxx b/connectivity/source/drivers/mysqlc/mysqlc_users.hxx
new file mode 100644
index 000000000000..42a1b8319ca8
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_users.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity::mysqlc
+{
+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::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_view.cxx b/connectivity/source/drivers/mysqlc/mysqlc_view.cxx
new file mode 100644
index 000000000000..86837381d2bc
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_view.cxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "mysqlc_view.hxx"
+
+#include <propertyids.hxx>
+
+#include <com/sun/star/sdbc/XRow.hpp>
+
+namespace connectivity::mysqlc
+{
+View::View(const css::uno::Reference<css::sdbc::XConnection>& _rxConnection, bool _bCaseSensitive,
+ const OUString& _rSchemaName, const OUString& _rName)
+ : View_Base(_bCaseSensitive, _rName, _rxConnection->getMetaData(), OUString(), _rSchemaName,
+ OUString())
+ , m_xConnection(_rxConnection)
+{
+}
+
+View::~View() {}
+
+void SAL_CALL View::acquire() noexcept { View_Base::acquire(); };
+void SAL_CALL View::release() noexcept { View_Base::release(); };
+css::uno::Any SAL_CALL View::queryInterface(const css::uno::Type& _rType)
+{
+ css::uno::Any aReturn = View_Base::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = View_IBASE::queryInterface(_rType);
+ return aReturn;
+}
+
+css::uno::Sequence<css::uno::Type> SAL_CALL View::getTypes()
+{
+ return ::comphelper::concatSequences(View_Base::getTypes(), View_IBASE::getTypes());
+}
+
+css::uno::Sequence<sal_Int8> SAL_CALL View::getImplementationId()
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+void SAL_CALL View::alterCommand(const OUString& _rNewCommand)
+{
+ OUString aCommand = "ALTER VIEW " + m_SchemaName + "." + m_Name + " AS " + _rNewCommand;
+ m_xMetaData->getConnection()->createStatement()->execute(aCommand);
+}
+
+void SAL_CALL View::getFastPropertyValue(css::uno::Any& _rValue, sal_Int32 _nHandle) const
+{
+ if (_nHandle == PROPERTY_ID_COMMAND)
+ {
+ // retrieve the very current command, don't rely on the base classes cached value
+ // (which we initialized empty, anyway)
+ _rValue <<= impl_getCommand();
+ return;
+ }
+
+ View_Base::getFastPropertyValue(_rValue, _nHandle);
+}
+
+OUString View::impl_getCommand() const
+{
+ OUString aCommand("SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = '"
+ + m_SchemaName + "' AND TABLE_NAME = '" + m_Name + "'");
+ //::utl::SharedUNOComponent< XStatement > xStatement; xStatement.set( m_xConnection->createStatement(), UNO_QUERY_THROW );
+ css::uno::Reference<css::sdbc::XResultSet> xResult(
+ m_xMetaData->getConnection()->createStatement()->executeQuery(aCommand),
+ css::uno::UNO_SET_THROW);
+ if (!xResult->next())
+ {
+ // hmm. There is no view the name as we know it. Can only mean some other instance
+ // dropped this view meanwhile...
+ std::abort();
+ }
+
+ css::uno::Reference<css::sdbc::XRow> xRow(xResult, css::uno::UNO_QUERY_THROW);
+ return xRow->getString(1);
+}
+
+} // namespace connectivity::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_view.hxx b/connectivity/source/drivers/mysqlc/mysqlc_view.hxx
new file mode 100644
index 000000000000..8450152499c0
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_view.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <connectivity/sdbcx/VView.hxx>
+
+#include <com/sun/star/sdbcx/XAlterView.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity::mysqlc
+{
+typedef ::connectivity::sdbcx::OView View_Base;
+typedef ::cppu::ImplHelper1<css::sdbcx::XAlterView> View_IBASE;
+
+class View : public View_Base, public View_IBASE
+{
+public:
+ View(const css::uno::Reference<css::sdbc::XConnection>& _rxConnection, bool _bCaseSensitive,
+ const OUString& _rSchemaName, const OUString& _rName);
+
+ // UNO
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& aType) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+ // XAlterView
+ virtual void SAL_CALL alterCommand(const OUString& NewCommand) override;
+
+protected:
+ virtual ~View() override;
+
+protected:
+ // OPropertyContainer
+ virtual void SAL_CALL getFastPropertyValue(css::uno::Any& _rValue,
+ sal_Int32 _nHandle) const override;
+
+private:
+ /** retrieves the current command of the View */
+ OUString impl_getCommand() const;
+
+private:
+ css::uno::Reference<css::sdbc::XConnection> m_xConnection;
+
+ using View_Base::getFastPropertyValue;
+};
+
+} // namespace connectivity::mysqlc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_views.cxx b/connectivity/source/drivers/mysqlc/mysqlc_views.cxx
new file mode 100644
index 000000000000..a603b84d04d1
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_views.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "mysqlc_tables.hxx"
+#include "mysqlc_views.hxx"
+#include "mysqlc_view.hxx"
+#include "mysqlc_catalog.hxx"
+#include <connectivity/dbtools.hxx>
+#include <comphelper/types.hxx>
+#include <TConnection.hxx>
+
+connectivity::mysqlc::Views::Views(const css::uno::Reference<css::sdbc::XConnection>& _rxConnection,
+ ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const ::std::vector<OUString>& _rVector)
+ : sdbcx::OCollection(_rParent, true, _rMutex, _rVector)
+ , m_xConnection(_rxConnection)
+ , m_xMetaData(_rxConnection->getMetaData())
+{
+}
+
+css::uno::Reference<css::beans::XPropertySet>
+connectivity::mysqlc::Views::createObject(const OUString& _rName)
+{
+ OUString sCatalog, sSchema, sTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable,
+ ::dbtools::EComposeRule::InDataManipulation);
+ return new View(m_xConnection, isCaseSensitive(), sSchema, sTable);
+}
+
+void connectivity::mysqlc::Views::impl_refresh()
+{
+ static_cast<Catalog&>(m_rParent).refreshViews();
+}
+
+css::uno::Reference<css::beans::XPropertySet> connectivity::mysqlc::Views::createDescriptor()
+{
+ return new connectivity::sdbcx::OView(true, m_xMetaData);
+}
+
+// XAppend
+css::uno::Reference<css::beans::XPropertySet> connectivity::mysqlc::Views::appendObject(
+ const OUString& _rForName, const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ createView(descriptor);
+ return createObject(_rForName);
+}
+
+// XDrop
+void connectivity::mysqlc::Views::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
+{
+ css::uno::Reference<XInterface> xObject(getObject(_nPos));
+ bool bIsNew = connectivity::sdbcx::ODescriptor::isNew(xObject);
+ if (!bIsNew)
+ {
+ OUString aSql(u"DROP VIEW"_ustr);
+
+ css::uno::Reference<css::beans::XPropertySet> xProp(xObject, css::uno::UNO_QUERY);
+ aSql += ::dbtools::composeTableName(m_xMetaData, xProp,
+ ::dbtools::EComposeRule::InTableDefinitions, true);
+
+ css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
+ css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+}
+
+void connectivity::mysqlc::Views::createView(
+ const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
+
+ OUString sCommand;
+ descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))
+ >>= sCommand;
+
+ OUString aSql = "CREATE VIEW "
+ + ::dbtools::composeTableName(m_xMetaData, descriptor,
+ ::dbtools::EComposeRule::InTableDefinitions, true)
+ + " AS " + sCommand;
+
+ css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
+ if (xStmt.is())
+ {
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+ connectivity::mysqlc::Tables* pTables = static_cast<connectivity::mysqlc::Tables*>(
+ static_cast<connectivity::mysqlc::Catalog&>(m_rParent).getPrivateTables());
+ if (pTables)
+ {
+ OUString sName = ::dbtools::composeTableName(
+ m_xMetaData, descriptor, ::dbtools::EComposeRule::InDataManipulation, false);
+ pTables->appendNew(sName);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_views.hxx b/connectivity/source/drivers/mysqlc/mysqlc_views.hxx
new file mode 100644
index 000000000000..f55d6a032184
--- /dev/null
+++ b/connectivity/source/drivers/mysqlc/mysqlc_views.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+namespace connectivity::mysqlc
+{
+class Views final : public connectivity::sdbcx::OCollection
+{
+ css::uno::Reference<css::sdbc::XConnection> m_xConnection;
+ css::uno::Reference<css::sdbc::XDatabaseMetaData> m_xMetaData;
+
+ // OCollection
+ 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;
+
+ void createView(const css::uno::Reference<css::beans::XPropertySet>& descriptor);
+
+public:
+ Views(const css::uno::Reference<css::sdbc::XConnection>& _rxConnection,
+ ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const ::std::vector<OUString>& _rVector);
+
+ // XDrop
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx
index 7ae8c46802e2..57b3891958fa 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -37,7 +37,6 @@ using namespace dbtools;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
@@ -67,20 +66,20 @@ OConnection::~OConnection()
if (!m_bClosed)
{
- rc = N3SQLDisconnect( m_aConnectionHandle );
+ rc = functions().Disconnect(m_aConnectionHandle);
OSL_ENSURE( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO, "Failure from SQLDisconnect" );
}
- rc = N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
+ rc = functions().FreeHandle(SQL_HANDLE_DBC, m_aConnectionHandle);
OSL_ENSURE( rc == SQL_SUCCESS , "Failure from SQLFreeHandle for connection");
m_aConnectionHandle = SQL_NULL_HANDLE;
}
-oslGenericFunction OConnection::getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
+const Functions& OConnection::functions() const
{
OSL_ENSURE(m_xDriver, "OConnection::getOdbcFunction: m_xDriver is null!");
- return m_xDriver->getOdbcFunction(_nIndex);
+ return m_xDriver->functions();
}
SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTimeOut, bool bSilent)
@@ -91,48 +90,55 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTi
return -1;
SQLRETURN nSQLRETURN = 0;
- SDB_ODBC_CHAR szConnStrOut[4096] = {};
- SDB_ODBC_CHAR szConnStrIn[2048] = {};
- SQLSMALLINT cbConnStrOut;
- OString aConStr(OUStringToOString(aConnectStr,getTextEncoding()));
- memcpy(szConnStrIn, aConStr.getStr(), std::min<sal_Int32>(sal_Int32(2048),aConStr.getLength()));
#ifndef MACOSX
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(nTimeOut),SQL_IS_UINTEGER);
+ functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(nTimeOut)),SQL_IS_UINTEGER);
#else
(void)nTimeOut; /* WaE */
#endif
#ifdef LINUX
- (void) bSilent;
- nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle,
- nullptr,
- szConnStrIn,
- static_cast<SQLSMALLINT>(std::min(sal_Int32(2048),aConStr.getLength())),
- szConnStrOut,
- SQLSMALLINT(sizeof(szConnStrOut)/sizeof(SDB_ODBC_CHAR)) -1,
- &cbConnStrOut,
- SQL_DRIVER_NOPROMPT);
+ bSilent = true;
+#endif //LINUX
+ SQLUSMALLINT nSilent = bSilent ? SQL_DRIVER_NOPROMPT : SQL_DRIVER_COMPLETE;
+
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::DriverConnectW))
+ {
+ SQLWChars sqlConnectStr(aConnectStr);
+ SQLWCHAR szConnStrOut[4096] = {};
+ SQLSMALLINT cchConnStrOut;
+ nSQLRETURN = functions().DriverConnectW(m_aConnectionHandle,
+ nullptr,
+ sqlConnectStr.get(),
+ sqlConnectStr.cch(),
+ szConnStrOut,
+ std::size(szConnStrOut) - 1,
+ &cchConnStrOut,
+ nSilent);
+ }
+ else
+ {
+ SQLChars sqlConnectStr(aConnectStr, getTextEncoding());
+ SQLCHAR szConnStrOut[4096] = {};
+ SQLSMALLINT cbConnStrOut;
+ nSQLRETURN = functions().DriverConnect(m_aConnectionHandle,
+ nullptr,
+ sqlConnectStr.get(),
+ sqlConnectStr.cch(),
+ szConnStrOut,
+ std::size(szConnStrOut) - 1,
+ &cbConnStrOut,
+ nSilent);
+ }
+#ifdef LINUX
if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA || SQL_SUCCESS_WITH_INFO == nSQLRETURN)
- return nSQLRETURN;
#else
-
- SQLUSMALLINT nSilent = bSilent ? SQL_DRIVER_NOPROMPT : SQL_DRIVER_COMPLETE;
- nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle,
- nullptr,
- szConnStrIn,
- static_cast<SQLSMALLINT>(std::min<sal_Int32>(sal_Int32(2048),aConStr.getLength())),
- szConnStrOut,
- SQLSMALLINT(sizeof szConnStrOut),
- &cbConnStrOut,
- nSilent);
if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA)
+#endif
return nSQLRETURN;
m_bClosed = false;
-#endif //LINUX
-
try
{
OUString aVal;
@@ -157,7 +163,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTi
// autocommit is always default
if (!m_bReadOnly)
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT, reinterpret_cast<SQLPOINTER>(SQL_AUTOCOMMIT_ON),SQL_IS_INTEGER);
+ functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT, reinterpret_cast<SQLPOINTER>(SQL_AUTOCOMMIT_ON),SQL_IS_INTEGER);
return nSQLRETURN;
}
@@ -168,13 +174,13 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal
m_sURL = url;
setConnectionInfo(info);
- N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle);
+ functions().AllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle);
if(m_aConnectionHandle == SQL_NULL_HANDLE)
throw SQLException();
sal_Int32 nLen = url.indexOf(':');
nLen = url.indexOf(':',nLen+2);
- OUString aDSN("DSN="), aUID, aPWD, aSysDrvSettings;
+ OUString aDSN(u"DSN="_ustr), aUID, aPWD, aSysDrvSettings;
aDSN += url.subView(nLen+1);
sal_Int32 nTimeout = 20;
@@ -267,7 +273,7 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.odbc.OConnection", "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(OConnection, u"com.sun.star.sdbc.drivers.odbc.OConnection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
Reference< XStatement > SAL_CALL OConnection::createStatement( )
@@ -292,19 +298,34 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const OU
Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const OUString& /*sql*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::prepareCall"_ustr, *this );
}
OUString SAL_CALL OConnection::nativeSQL( const OUString& sql )
{
::osl::MutexGuard aGuard( m_aMutex );
- OString aSql(OUStringToOString(sql,getTextEncoding()));
- char pOut[2048];
SQLINTEGER nOutLen;
- OTools::ThrowException(this,N3SQLNativeSql(m_aConnectionHandle,reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aSql.getStr())),aSql.getLength(),reinterpret_cast<SDB_ODBC_CHAR*>(pOut),sizeof pOut - 1,&nOutLen),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
- return OUString(pOut,nOutLen,getTextEncoding());
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::NativeSqlW))
+ {
+ SQLWChars nativeSQL(sql);
+ SQLWCHAR pOut[2048];
+ SQLRETURN ret = functions().NativeSqlW(m_aConnectionHandle,
+ nativeSQL.get(), nativeSQL.cch(),
+ pOut, std::size(pOut) - 1, &nOutLen);
+ OTools::ThrowException(this, ret, m_aConnectionHandle, SQL_HANDLE_DBC, *this);
+ return toUString(pOut, nOutLen);
+ }
+ else
+ {
+ SQLChars nativeSQL(sql, getTextEncoding());
+ SQLCHAR pOut[2048];
+ SQLRETURN ret = functions().NativeSql(m_aConnectionHandle,
+ nativeSQL.get(), nativeSQL.cch(),
+ pOut, std::size(pOut) - 1, &nOutLen);
+ OTools::ThrowException(this, ret, m_aConnectionHandle, SQL_HANDLE_DBC, *this);
+ return toUString(pOut, nOutLen, getTextEncoding());
+ }
}
void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit )
@@ -312,10 +333,10 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
+ const sal_IntPtr nAutocommit = autoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF;
+ OTools::ThrowException(this,functions().SetConnectAttr(m_aConnectionHandle,
SQL_ATTR_AUTOCOMMIT,
- reinterpret_cast<SQLPOINTER>((autoCommit) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF) ,SQL_IS_INTEGER),
+ reinterpret_cast<SQLPOINTER>(nAutocommit) ,SQL_IS_INTEGER),
m_aConnectionHandle,SQL_HANDLE_DBC,*this);
}
@@ -326,7 +347,7 @@ sal_Bool SAL_CALL OConnection::getAutoCommit( )
sal_uInt32 nOption = 0;
- OTools::ThrowException(this,N3SQLGetConnectAttr(m_aConnectionHandle,
+ OTools::ThrowException(this,functions().GetConnectAttr(m_aConnectionHandle,
SQL_ATTR_AUTOCOMMIT, &nOption,0,nullptr),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
return nOption == SQL_AUTOCOMMIT_ON ;
}
@@ -337,7 +358,7 @@ void SAL_CALL OConnection::commit( )
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OTools::ThrowException(this,N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+ OTools::ThrowException(this,functions().EndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
}
void SAL_CALL OConnection::rollback( )
@@ -346,7 +367,7 @@ void SAL_CALL OConnection::rollback( )
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OTools::ThrowException(this,N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+ OTools::ThrowException(this,functions().EndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
}
sal_Bool SAL_CALL OConnection::isClosed( )
@@ -378,7 +399,7 @@ void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly )
OTools::ThrowException(this,
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,reinterpret_cast< SQLPOINTER >( readOnly ),SQL_IS_INTEGER),
+ functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,reinterpret_cast< SQLPOINTER >( readOnly ),SQL_IS_INTEGER),
m_aConnectionHandle,SQL_HANDLE_DBC,*this);
}
@@ -393,11 +414,20 @@ void SAL_CALL OConnection::setCatalog( const OUString& catalog )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- OString aCat(OUStringToOString(catalog,getTextEncoding()));
- OTools::ThrowException(this,
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,const_cast<char *>(aCat.getStr()),SQL_NTS),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::SetConnectAttrW))
+ {
+ SQLWChars sqlCatalog(catalog);
+ OTools::ThrowException(this,
+ functions().SetConnectAttrW(m_aConnectionHandle, SQL_ATTR_CURRENT_CATALOG, sqlCatalog.get(), SQL_NTSL),
+ m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+ }
+ else
+ {
+ SQLChars sqlCatalog(catalog, getTextEncoding());
+ OTools::ThrowException(this,
+ functions().SetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,sqlCatalog.get(),SQL_NTS),
+ m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+ }
}
OUString SAL_CALL OConnection::getCatalog( )
@@ -405,14 +435,25 @@ OUString SAL_CALL OConnection::getCatalog( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
SQLINTEGER nValueLen;
- char pCat[1024];
- OTools::ThrowException(this,
- N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,pCat,(sizeof pCat)-1,&nValueLen),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::GetConnectAttrW))
+ {
+ SQLWCHAR pCat[1024];
+ // SQLGetConnectAttrW gets/returns count of bytes, not characters
+ OTools::ThrowException(this,
+ functions().GetConnectAttrW(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,pCat,sizeof(pCat)-sizeof(SQLWCHAR),&nValueLen),
+ m_aConnectionHandle,SQL_HANDLE_DBC,*this);
+ return toUString(pCat, nValueLen / sizeof(SQLWCHAR));
+ }
+ else
+ {
+ SQLCHAR pCat[1024];
+ OTools::ThrowException(this,
+ functions().GetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,pCat,sizeof(pCat)-1,&nValueLen),
+ m_aConnectionHandle,SQL_HANDLE_DBC,*this);
- return OUString(pCat,nValueLen,getTextEncoding());
+ return toUString(pCat, nValueLen, getTextEncoding());
+ }
}
void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level )
@@ -421,9 +462,9 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level )
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
+ OTools::ThrowException(this,functions().SetConnectAttr(m_aConnectionHandle,
SQL_ATTR_TXN_ISOLATION,
- reinterpret_cast<SQLPOINTER>(level),SQL_IS_INTEGER),
+ reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(level)),SQL_IS_INTEGER),
m_aConnectionHandle,SQL_HANDLE_DBC,*this);
}
@@ -436,7 +477,7 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation( )
sal_Int32 nTxn = 0;
SQLINTEGER nValueLen;
OTools::ThrowException(this,
- N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_TXN_ISOLATION,&nTxn,sizeof nTxn,&nValueLen),
+ functions().GetConnectAttr(m_aConnectionHandle,SQL_ATTR_TXN_ISOLATION,&nTxn,sizeof nTxn,&nValueLen),
m_aConnectionHandle,SQL_HANDLE_DBC,*this);
return nTxn;
}
@@ -452,7 +493,7 @@ Reference< css::container::XNameAccess > SAL_CALL OConnection::getTypeMap( )
void SAL_CALL OConnection::setTypeMap( const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
- ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setTypeMap", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::setTypeMap"_ustr, *this );
}
// XCloseable
@@ -488,7 +529,7 @@ void OConnection::disposing()
m_aConnections.clear();
if(!m_bClosed)
- N3SQLDisconnect(m_aConnectionHandle);
+ functions().Disconnect(m_aConnectionHandle);
m_bClosed = true;
}
@@ -503,7 +544,7 @@ SQLHANDLE OConnection::createStatementHandle()
{
rtl::Reference xConnection(new OConnection(m_pDriverHandleCopy,m_xDriver.get()));
xConnection->Construct(m_sURL,getConnectionInfo());
- xConnectionTemp = xConnection;
+ xConnectionTemp = std::move(xConnection);
bNew = true;
}
}
@@ -512,7 +553,7 @@ SQLHANDLE OConnection::createStatementHandle()
}
SQLHANDLE aStatementHandle = SQL_NULL_HANDLE;
- N3SQLAllocHandle(SQL_HANDLE_STMT,xConnectionTemp->getConnection(),&aStatementHandle);
+ functions().AllocHandle(SQL_HANDLE_STMT,xConnectionTemp->getConnection(),&aStatementHandle);
++m_nStatementCount;
if(bNew)
m_aConnections.emplace(aStatementHandle,xConnectionTemp);
@@ -528,10 +569,10 @@ void OConnection::freeStatementHandle(SQLHANDLE& _pHandle)
auto aFind = m_aConnections.find(_pHandle);
- N3SQLFreeStmt(_pHandle,SQL_RESET_PARAMS);
- N3SQLFreeStmt(_pHandle,SQL_UNBIND);
- N3SQLFreeStmt(_pHandle,SQL_CLOSE);
- N3SQLFreeHandle(SQL_HANDLE_STMT,_pHandle);
+ functions().FreeStmt(_pHandle,SQL_RESET_PARAMS);
+ functions().FreeStmt(_pHandle,SQL_UNBIND);
+ functions().FreeStmt(_pHandle,SQL_CLOSE);
+ functions().FreeHandle(SQL_HANDLE_STMT,_pHandle);
_pHandle = SQL_NULL_HANDLE;
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
index c9ed165a8c26..97cd0b1b33d9 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
@@ -28,11 +28,10 @@
#include <TPrivilegesResultSet.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
using namespace connectivity::odbc;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon)
@@ -41,7 +40,7 @@ ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon
,m_pConnection(_pCon)
,m_bUseCatalog(true)
{
- OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
+ assert(m_pConnection && "ODatabaseMetaData::ODatabaseMetaData: No connection set!");
if(!m_pConnection->isCatalogUsed())
{
osl_atomic_increment( &m_refCount );
@@ -65,7 +64,7 @@ Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openTypeInfo();
}
@@ -88,7 +87,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( )
{
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openCatalogs();
}
@@ -115,7 +114,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( )
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openSchemas();
}
@@ -133,7 +132,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern);
}
@@ -151,7 +150,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern);
}
@@ -169,7 +168,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types);
}
@@ -187,7 +186,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern);
}
@@ -205,7 +204,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern);
}
@@ -225,7 +224,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
{
if ( !m_pConnection->preventGetVersionColumns() )
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table);
bSuccess = true;
@@ -333,7 +332,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
}
@@ -350,7 +349,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
}
@@ -367,7 +366,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table);
}
@@ -385,7 +384,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate);
}
@@ -403,7 +402,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable);
}
@@ -421,10 +420,9 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
{
return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
}
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- Reference< XResultSet > xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern);
- return xRef;
+ return pResult;
}
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
@@ -435,7 +433,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : nullptr,&primaryTable,
m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : nullptr,&foreignTable);
@@ -718,7 +716,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
Reference< XResultSet > xRef;
try
{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
xRef = pResult;
pResult->openTablesTypes();
}
@@ -1242,7 +1240,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) try
{
OUString aValue;
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.copy(0,aValue.indexOf('.')).toInt32();
+ return o3tl::toInt32(aValue.subView(0,aValue.indexOf('.')));
}
catch (const SQLException &)
{
@@ -1278,7 +1276,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) try
{
OUString aValue;
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
+ return o3tl::toInt32(aValue.subView(0,aValue.lastIndexOf('.')));
}
catch (const SQLException &)
{
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
index 777f4712ce96..bc5b08f5550d 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
@@ -24,6 +24,7 @@
#include <comphelper/property.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/stl_types.hxx>
#include <odbc/OResultSetMetaData.hxx>
#include <odbc/OTools.hxx>
#include <comphelper/types.hxx>
@@ -47,7 +48,6 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(OConnection* _pConnection
,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper)
,m_aStatementHandle(_pConnection->createStatementHandle())
- ,m_aStatement(nullptr)
,m_pConnection(_pConnection)
,m_nTextEncoding(_pConnection->getTextEncoding())
,m_nRowPos(-1)
@@ -84,7 +84,6 @@ void ODatabaseMetaDataResultSet::disposing()
m_pConnection->freeStatementHandle(m_aStatementHandle);
- m_aStatement = nullptr;
m_xMetaData.clear();
m_pConnection.clear();
}
@@ -100,12 +99,12 @@ Reference< XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySe
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
-void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw()
+void SAL_CALL ODatabaseMetaDataResultSet::acquire() noexcept
{
ODatabaseMetaDataResultSet_BASE::acquire();
}
-void SAL_CALL ODatabaseMetaDataResultSet::release() throw()
+void SAL_CALL ODatabaseMetaDataResultSet::release() noexcept
{
ODatabaseMetaDataResultSet_BASE::release();
}
@@ -151,8 +150,6 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& colum
}
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
- return 0; // Never reached
}
template < typename T, SQLSMALLINT sqlTypeId > T ODatabaseMetaDataResultSet::getInteger ( sal_Int32 columnIndex )
@@ -182,17 +179,14 @@ template < typename T, SQLSMALLINT sqlTypeId > T ODatabaseMetaDataResultSet::get
Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBinaryStream", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBinaryStream"_ustr, *this );
}
Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getCharacterStream", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getCharacterStream"_ustr, *this );
}
-
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex )
{
@@ -245,7 +239,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
{
- OUString const & aRet = OTools::getStringValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding);
+ OUString const aRet = OTools::getStringValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding);
return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength());
}
}
@@ -342,34 +336,29 @@ Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData
Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getArray", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getArray"_ustr, *this );
}
Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getClob", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getClob"_ustr, *this );
}
Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBlob", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBlob"_ustr, *this );
}
Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getRef", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getRef"_ustr, *this );
}
Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getObject", *this );
- return Any();
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getObject"_ustr, *this );
}
@@ -506,7 +495,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( )
m_bEOF = false;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO );
if( bRet )
@@ -521,7 +510,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( )
::osl::MutexGuard aGuard( m_aMutex );
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
// here I know definitely that I stand on the last record
bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO );
@@ -538,7 +527,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row )
m_bEOF = false;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
if(bRet)
@@ -554,7 +543,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row )
m_bEOF = false;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
if(bRet)
@@ -570,7 +559,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( )
m_bEOF = false;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
if(bRet)
@@ -636,8 +625,8 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( )
m_bEOF = false;
SQLRETURN nOldFetchStatus = m_nCurrentFetchState;
- // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
+ // m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
+ m_nCurrentFetchState = functions().Fetch(m_aStatementHandle);
OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
if(bRet || ( m_nCurrentFetchState == SQL_NO_DATA && nOldFetchStatus != SQL_NO_DATA ) )
@@ -672,7 +661,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::cancel( )
::osl::MutexGuard aGuard( m_aMutex );
- N3SQLCancel(m_aStatementHandle);
+ functions().Cancel(m_aStatementHandle);
}
void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings( )
@@ -689,30 +678,50 @@ sal_Int32 ODatabaseMetaDataResultSet::getFetchSize()
return 1;
}
-OUString ODatabaseMetaDataResultSet::getCursorName()
+const OUString & ODatabaseMetaDataResultSet::getCursorName()
{
- return OUString();
+ return EMPTY_OUSTRING;
}
::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const
{
- Sequence< css::beans::Property > aProps(5);
- css::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ }
+ }
+ };
}
::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper()
@@ -815,55 +824,59 @@ void ODatabaseMetaDataResultSet::openTypeInfo()
aMap[SQL_GUID] = DataType::VARBINARY;
- m_aValueRange[2] = aMap;
+ m_aValueRange[2] = std::move(aMap);
- OTools::ThrowException(m_pConnection.get(),N3SQLGetTypeInfo(m_aStatementHandle, SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ OTools::ThrowException(m_pConnection.get(),functions().GetTypeInfo(m_aStatementHandle, SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const OUString& schemaPattern,
- std::u16string_view tableNamePattern,
+ const OUString& tableNamePattern,
const Sequence< OUString >& types )
{
- OString aPKQ,aPKO,aPKN,aCOL;
- const OUString *pSchemaPat = nullptr;
-
- if(schemaPattern != "%")
- pSchemaPat = &schemaPattern;
- else
- pSchemaPat = nullptr;
-
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr();
-
-
- const char *pCOL = nullptr;
- const char* const pComma = ",";
- const OUString* pBegin = types.getConstArray();
- const OUString* pEnd = pBegin + types.getLength();
- for(;pBegin != pEnd;++pBegin)
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ OUStringBuffer uCOL;
+ comphelper::intersperse(types.begin(), types.end(), comphelper::OUStringBufferAppender(uCOL), u",");
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::TablesW))
{
- aCOL += OUStringToOString(*pBegin,m_nTextEncoding) + pComma;
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLWChars(schemaPattern);
+ SQLWChars aPKN(tableNamePattern);
+ SQLWChars aCOL = !uCOL.isEmpty() ? SQLWChars(uCOL.makeStringAndClear()) : SQLWChars(u"" SQL_ALL_TABLE_TYPES ""_ustr);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().TablesW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL,
+ aCOL.get(), SQL_NTSL);
}
- if ( !aCOL.isEmpty() )
+ else
{
- aCOL = aCOL.replaceAt(aCOL.getLength()-1,1,pComma);
- pCOL = aCOL.getStr();
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLChars(schemaPattern, m_nTextEncoding);
+ SQLChars aPKN(tableNamePattern, m_nTextEncoding);
+ SQLChars aCOL = !uCOL.isEmpty() ? SQLChars(uCOL, m_nTextEncoding) : SQLChars(SQL_ALL_TABLE_TYPES ""_ostr);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().Tables(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS,
+ aCOL.get(), SQL_NTS);
}
- else
- pCOL = SQL_ALL_TABLE_TYPES;
-
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), pCOL ? SQL_NTS : 0);
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
@@ -871,117 +884,182 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const OUString&
void ODatabaseMetaDataResultSet::openTablesTypes( )
{
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- nullptr,0,
- nullptr,0,
- nullptr,0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_TABLE_TYPES)),SQL_NTS);
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::TablesW))
+ {
+ nRetcode = functions().TablesW(m_aStatementHandle,
+ nullptr, 0,
+ nullptr, 0,
+ nullptr, 0,
+ SQLWChars(u"" SQL_ALL_TABLE_TYPES ""_ustr).get(), SQL_NTSL);
+ }
+ else
+ {
+ nRetcode = functions().Tables(m_aStatementHandle,
+ nullptr,0,
+ nullptr,0,
+ nullptr,0,
+ SQLChars(SQL_ALL_TABLE_TYPES ""_ostr).get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
m_aColMapping.clear();
m_aColMapping.push_back(-1);
m_aColMapping.push_back(4);
- m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,m_aColMapping);
+ m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,std::vector(m_aColMapping));
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openCatalogs()
{
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_CATALOGS)),SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS);
-
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::TablesW))
+ {
+ nRetcode = functions().TablesW(m_aStatementHandle,
+ SQLWChars(u"" SQL_ALL_CATALOGS ""_ustr).get(), SQL_NTSL,
+ SQLWChars(u""_ustr).get(), SQL_NTSL,
+ SQLWChars(u""_ustr).get(), SQL_NTSL,
+ SQLWChars(u""_ustr).get(), SQL_NTSL);
+ }
+ else
+ {
+ nRetcode = functions().Tables(m_aStatementHandle,
+ SQLChars(SQL_ALL_CATALOGS ""_ostr).get(), SQL_NTS,
+ SQLChars(""_ostr).get(), SQL_NTS,
+ SQLChars(""_ostr).get(), SQL_NTS,
+ SQLChars(""_ostr).get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
m_aColMapping.clear();
m_aColMapping.push_back(-1);
m_aColMapping.push_back(1);
- m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,m_aColMapping);
+ m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,std::vector(m_aColMapping));
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openSchemas()
{
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_SCHEMAS)),SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS);
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::TablesW))
+ {
+ nRetcode = functions().TablesW(m_aStatementHandle,
+ SQLWChars(u""_ustr).get(), SQL_NTSL,
+ SQLWChars(u"" SQL_ALL_SCHEMAS ""_ustr).get(), SQL_NTSL,
+ SQLWChars(u""_ustr).get(),SQL_NTSL,
+ SQLWChars(u""_ustr).get(),SQL_NTSL);
+ }
+ else
+ {
+ nRetcode = functions().Tables(m_aStatementHandle,
+ SQLChars(""_ostr).get(), SQL_NTS,
+ SQLChars(SQL_ALL_SCHEMAS ""_ostr).get(), SQL_NTS,
+ SQLChars(""_ostr).get(), SQL_NTS,
+ SQLChars(""_ostr).get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
m_aColMapping.clear();
m_aColMapping.push_back(-1);
m_aColMapping.push_back(2);
- m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,m_aColMapping);
+ m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,std::vector(m_aColMapping));
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, const OUString& schema,
- std::u16string_view table,
- std::u16string_view columnNamePattern )
+ const OUString& table,
+ const OUString& columnNamePattern )
{
- const OUString *pSchemaPat = nullptr;
-
- if(schema != "%")
- pSchemaPat = &schema;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ColumnPrivilegesW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLWChars(schema);
+ SQLWChars aPKN(table);
+ SQLWChars aCOL(columnNamePattern);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().ColumnPrivilegesW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL,
+ aCOL.get(), SQL_NTSL);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN,aCOL;
-
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schema,m_nTextEncoding);
- aPKN = OUStringToOString(table,m_nTextEncoding);
- aCOL = OUStringToOString(columnNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr(),
- *pCOL = aCOL.getStr();
-
-
- SQLRETURN nRetcode = N3SQLColumnPrivileges(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS);
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLChars(schema, m_nTextEncoding);
+ SQLChars aPKN(table, m_nTextEncoding);
+ SQLChars aCOL(columnNamePattern, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().ColumnPrivileges(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS,
+ aCOL.get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, const OUString& schemaPattern,
- std::u16string_view tableNamePattern, std::u16string_view columnNamePattern )
+ const OUString& tableNamePattern, const OUString& columnNamePattern )
{
- const OUString *pSchemaPat = nullptr;
-
- if(schemaPattern != "%")
- pSchemaPat = &schemaPattern;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ColumnsW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLWChars(schemaPattern);
+ SQLWChars aPKN(tableNamePattern);
+ SQLWChars aCOL(columnNamePattern);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().ColumnsW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL,
+ aCOL.get(), SQL_NTSL);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN,aCOL;
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding);
- aCOL = OUStringToOString(columnNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr(),
- *pCOL = aCOL.getStr();
-
-
- SQLRETURN nRetcode = N3SQLColumns(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS);
-
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLChars(schemaPattern, m_nTextEncoding);
+ SQLChars aPKN(tableNamePattern, m_nTextEncoding);
+ SQLChars aCOL(columnNamePattern, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().Columns(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS,
+ aCOL.get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
::std::map<sal_Int32,sal_Int32> aMap;
aMap[SQL_BIT] = DataType::BIT;
@@ -1016,79 +1094,108 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog,
aMap[SQL_GUID] = DataType::VARBINARY;
- m_aValueRange[5] = aMap;
+ m_aValueRange[5] = std::move(aMap);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, const OUString& schemaPattern,
- std::u16string_view procedureNamePattern,std::u16string_view columnNamePattern )
+ const OUString& procedureNamePattern,const OUString& columnNamePattern )
{
- const OUString *pSchemaPat = nullptr;
-
- if(schemaPattern != "%")
- pSchemaPat = &schemaPattern;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ProcedureColumnsW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLWChars(schemaPattern);
+ SQLWChars aPKN(procedureNamePattern);
+ SQLWChars aCOL(columnNamePattern);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().ProcedureColumnsW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL,
+ aCOL.get(), SQL_NTSL);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN,aCOL;
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = OUStringToOString(procedureNamePattern,m_nTextEncoding);
- aCOL = OUStringToOString(columnNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr(),
- *pCOL = aCOL.getStr();
-
-
- SQLRETURN nRetcode = N3SQLProcedureColumns(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS);
-
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLChars(schemaPattern, m_nTextEncoding);
+ SQLChars aPKN(procedureNamePattern, m_nTextEncoding);
+ SQLChars aCOL(columnNamePattern, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().ProcedureColumns(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS,
+ aCOL.get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const OUString& schemaPattern,
- std::u16string_view procedureNamePattern)
+ const OUString& procedureNamePattern)
{
- const OUString *pSchemaPat = nullptr;
-
- if(schemaPattern != "%")
- pSchemaPat = &schemaPattern;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ProceduresW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLWChars(schemaPattern);
+ SQLWChars aPKN(procedureNamePattern);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().ProceduresW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN;
-
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = OUStringToOString(procedureNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr();
-
-
- SQLRETURN nRetcode = N3SQLProcedures(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS);
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLChars(schemaPattern, m_nTextEncoding);
+ SQLChars aPKN(procedureNamePattern, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().Procedures(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& catalog, const OUString& schema,
- std::u16string_view table,sal_Int32 scope, bool nullable )
+ const OUString& table,sal_Int32 scope, bool nullable )
{
// Some ODBC drivers really don't like getting an empty string as tableName
// E.g. psqlodbc up to at least version 09.01.0100 segfaults
- if (table.empty())
+ if (table.isEmpty())
{
static constexpr OUStringLiteral errMsg
= u"ODBC: Trying to get special columns of empty table name";
@@ -1096,42 +1203,59 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& cat
throw SQLException( errMsg, *this, SQLState, -1, Any() );
}
- const OUString *pSchemaPat = nullptr;
-
- if(schema != "%")
- pSchemaPat = &schema;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::SpecialColumnsW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLWChars(schema);
+ SQLWChars aPKN(table);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().SpecialColumnsW(m_aStatementHandle, _bRowVer ? SQL_ROWVER : SQL_BEST_ROWID,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL,
+ scope,
+ nullable ? SQL_NULLABLE : SQL_NO_NULLS);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN;
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schema,m_nTextEncoding);
- aPKN = OUStringToOString(table,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr();
-
-
- SQLRETURN nRetcode = N3SQLSpecialColumns(m_aStatementHandle,_bRowVer ? SQL_ROWVER : SQL_BEST_ROWID,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
- static_cast<SQLSMALLINT>(scope),
- nullable ? SQL_NULLABLE : SQL_NO_NULLS);
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLChars(schema, m_nTextEncoding);
+ SQLChars aPKN(table, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().SpecialColumns(m_aStatementHandle, _bRowVer ? SQL_ROWVER : SQL_BEST_ROWID,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS,
+ static_cast<SQLSMALLINT>(scope),
+ nullable ? SQL_NULLABLE : SQL_NO_NULLS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openVersionColumns(const Any& catalog, const OUString& schema,
- std::u16string_view table)
+ const OUString& table)
{
openSpecialColumns(true,catalog,schema,table,SQL_SCOPE_TRANSACTION,false);
}
void ODatabaseMetaDataResultSet::openBestRowIdentifier( const Any& catalog, const OUString& schema,
- std::u16string_view table,sal_Int32 scope,bool nullable )
+ const OUString& table,sal_Int32 scope,bool nullable )
{
openSpecialColumns(false,catalog,schema,table,scope,nullable);
}
@@ -1141,47 +1265,72 @@ void ODatabaseMetaDataResultSet::openForeignKeys( const Any& catalog, const OUSt
const Any& catalog2, const OUString* schema2,
const OUString* table2)
{
- OString aPKQ, aPKO, aPKN, aFKQ, aFKO, aFKN;
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- if ( catalog2.hasValue() )
- aFKQ = OUStringToOString(comphelper::getString(catalog2),m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr;
- const char *pPKO = nullptr;
- if (schema && !schema->isEmpty())
- {
- aPKO = OUStringToOString(*schema,m_nTextEncoding);
- pPKO = aPKO.getStr();
- }
- const char *pPKN = nullptr;
- if (table)
- {
- aPKN = OUStringToOString(*table,m_nTextEncoding);
- pPKN = aPKN.getStr();
- }
- const char *pFKQ = catalog2.hasValue() && !aFKQ.isEmpty() ? aFKQ.getStr() : nullptr;
- const char *pFKO = nullptr;
- if (schema2 && !schema2->isEmpty())
+ OUString uPKQ, uFKQ;
+ catalog >>= uPKQ;
+ catalog2 >>= uFKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ForeignKeysW))
{
- aFKO = OUStringToOString(*schema2,m_nTextEncoding);
- pFKO = aFKO.getStr();
+ SQLWChars aPKQ, aPKO, aPKN, aFKQ, aFKO, aFKN;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!uFKQ.isEmpty())
+ aFKQ = SQLWChars(uFKQ);
+ if (schema && !schema->isEmpty())
+ aPKO = SQLWChars(*schema);
+ if (table)
+ aPKN = SQLWChars(*table);
+ if (schema2 && !schema2->isEmpty())
+ aFKO = SQLWChars(*schema2);
+ if (table2)
+ aFKN = SQLWChars(*table2);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr;
+ auto pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+ auto pPKN = !aPKN.empty() ? aPKN.get() : nullptr;
+ auto pFKQ = !aFKQ.empty() ? aFKQ.get() : nullptr;
+ auto pFKO = !aFKO.empty() ? aFKO.get() : nullptr;
+ auto pFKN = !aFKN.empty() ? aFKN.get() : nullptr;
+
+ nRetcode = functions().ForeignKeysW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ pPKN, pPKN ? SQL_NTSL : 0,
+ pFKQ, pFKQ ? SQL_NTSL : 0,
+ pFKO, pFKO ? SQL_NTSL : 0,
+ pFKN, pFKN ? SQL_NTSL : 0);
}
- const char *pFKN = nullptr;
- if (table2)
+ else
{
- aFKN = OUStringToOString(*table2,m_nTextEncoding);
- pFKN = aFKN.getStr();
+ SQLChars aPKQ, aPKO, aPKN, aFKQ, aFKO, aFKN;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!uFKQ.isEmpty())
+ aFKQ = SQLChars(uFKQ, m_nTextEncoding);
+ if (schema && !schema->isEmpty())
+ aPKO = SQLChars(*schema, m_nTextEncoding);
+ if (table)
+ aPKN = SQLChars(*table, m_nTextEncoding);
+ if (schema2 && !schema2->isEmpty())
+ aFKO = SQLChars(*schema2, m_nTextEncoding);
+ if (table2)
+ aFKN = SQLChars(*table2, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr;
+ auto pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+ auto pPKN = !aPKN.empty() ? aPKN.get() : nullptr;
+ auto pFKQ = !aFKQ.empty() ? aFKQ.get() : nullptr;
+ auto pFKO = !aFKO.empty() ? aFKO.get() : nullptr;
+ auto pFKN = !aFKN.empty() ? aFKN.get() : nullptr;
+
+ nRetcode = functions().ForeignKeys(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ pPKN, pPKN ? SQL_NTS : 0,
+ pFKQ, pFKQ ? SQL_NTS : 0,
+ pFKO, pFKO ? SQL_NTS : 0,
+ pFKN, pFKN ? SQL_NTS : 0);
}
-
- SQLRETURN nRetcode = N3SQLForeignKeys(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), pPKN ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKQ)), (catalog2.hasValue() && !aFKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKO)), pFKO ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKN)), SQL_NTS
- );
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
@@ -1200,91 +1349,137 @@ void ODatabaseMetaDataResultSet::openExportedKeys(const Any& catalog, const OUSt
}
void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUString& schema,
- std::u16string_view table)
+ const OUString& table)
{
- const OUString *pSchemaPat = nullptr;
-
- if(schema != "%")
- pSchemaPat = &schema;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::PrimaryKeysW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLWChars(schema);
+ SQLWChars aPKN(table);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().PrimaryKeysW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN;
-
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schema,m_nTextEncoding);
- aPKN = OUStringToOString(table,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr();
-
-
- SQLRETURN nRetcode = N3SQLPrimaryKeys(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS);
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLChars(schema, m_nTextEncoding);
+ SQLChars aPKN(table, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().PrimaryKeys(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const OUString& schemaPattern,
- std::u16string_view tableNamePattern)
+ const OUString& tableNamePattern)
{
- const OUString *pSchemaPat = nullptr;
-
- if(schemaPattern != "%")
- pSchemaPat = &schemaPattern;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::TablePrivilegesW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLWChars(schemaPattern);
+ SQLWChars aPKN(tableNamePattern);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().TablePrivilegesW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN;
-
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr();
-
- SQLRETURN nRetcode = N3SQLTablePrivileges(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS);
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schemaPattern.isEmpty() && schemaPattern != "%")
+ aPKO = SQLChars(schemaPattern, m_nTextEncoding);
+ SQLChars aPKN(tableNamePattern, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().TablePrivileges(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const OUString& schema,
- std::u16string_view table, bool unique, bool approximate )
+ const OUString& table, bool unique, bool approximate )
{
- const OUString *pSchemaPat = nullptr;
-
- if(schema != "%")
- pSchemaPat = &schema;
+ OUString uPKQ;
+ catalog >>= uPKQ;
+ SQLRETURN nRetcode;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::StatisticsW))
+ {
+ SQLWChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLWChars(uPKQ);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLWChars(schema);
+ SQLWChars aPKN(table);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().StatisticsW(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTSL : 0,
+ pPKO, pPKO ? SQL_NTSL : 0,
+ aPKN.get(), SQL_NTSL,
+ unique ? SQL_INDEX_UNIQUE : SQL_INDEX_ALL,
+ approximate ? 1 : 0);
+ }
else
- pSchemaPat = nullptr;
-
- OString aPKQ,aPKO,aPKN;
-
- if ( catalog.hasValue() )
- aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = OUStringToOString(schema,m_nTextEncoding);
- aPKN = OUStringToOString(table,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : nullptr,
- *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
- *pPKN = aPKN.getStr();
-
- SQLRETURN nRetcode = N3SQLStatistics(m_aStatementHandle,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
- reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
- unique ? SQL_INDEX_UNIQUE : SQL_INDEX_ALL,
- approximate ? 1 : 0);
+ {
+ SQLChars aPKQ, aPKO;
+ if (!uPKQ.isEmpty())
+ aPKQ = SQLChars(uPKQ, m_nTextEncoding);
+ if (!schema.isEmpty() && schema != "%")
+ aPKO = SQLChars(schema, m_nTextEncoding);
+ SQLChars aPKN(table, m_nTextEncoding);
+
+ auto pPKQ = !aPKQ.empty() ? aPKQ.get() : nullptr,
+ pPKO = !aPKO.empty() ? aPKO.get() : nullptr;
+
+ nRetcode = functions().Statistics(m_aStatementHandle,
+ pPKQ, pPKQ ? SQL_NTS : 0,
+ pPKO, pPKO ? SQL_NTS : 0,
+ aPKN.get(), SQL_NTS,
+ unique ? SQL_INDEX_UNIQUE : SQL_INDEX_ALL,
+ approximate ? 1 : 0);
+ }
OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
checkColumnCount();
}
@@ -1292,7 +1487,7 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const OUStri
void ODatabaseMetaDataResultSet::checkColumnCount()
{
sal_Int16 nNumResultCols=0;
- OTools::ThrowException(m_pConnection.get(),N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ OTools::ThrowException(m_pConnection.get(),functions().NumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
m_nDriverColumnCount = nNumResultCols;
}
diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx
index b4318d43b18b..6e9b28082c11 100644
--- a/connectivity/source/drivers/odbc/ODriver.cxx
+++ b/connectivity/source/drivers/odbc/ODriver.cxx
@@ -17,13 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <odbc/ODriver.hxx>
+#include <sal/config.h>
+
#include <odbc/OConnection.hxx>
-#include <odbc/OTools.hxx>
+#include <odbc/ODriver.hxx>
+#include <resource/sharedresources.hxx>
+#include <strings.hrc>
+
#include <connectivity/dbexception.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <strings.hrc>
-#include <resource/sharedresources.hxx>
+#include <osl/module.h>
+
+#include <utility>
using namespace connectivity::odbc;
using namespace com::sun::star::uno;
@@ -31,10 +36,9 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
-ODBCDriver::ODBCDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
+ODBCDriver::ODBCDriver(css::uno::Reference< css::uno::XComponentContext > _xContext)
:ODriver_BASE(m_aMutex)
- ,m_xContext(_rxContext)
- ,m_pDriverHandle(SQL_NULL_HANDLE)
+ ,m_xContext(std::move(_xContext))
{
}
@@ -45,7 +49,7 @@ void ODBCDriver::disposing()
for (auto const& connection : m_xConnections)
{
- Reference< XComponent > xComp(connection.get(), UNO_QUERY);
+ rtl::Reference< OConnection > xComp(connection);
if (xComp.is())
xComp->dispose();
}
@@ -58,7 +62,7 @@ void ODBCDriver::disposing()
OUString ODBCDriver::getImplementationName( )
{
- return "com.sun.star.comp.sdbc.ODBCDriver";
+ return u"com.sun.star.comp.sdbc.ODBCDriver"_ustr;
// this name is referenced in the configuration and in the odbc.xml
// Please take care when changing it.
}
@@ -66,7 +70,7 @@ OUString ODBCDriver::getImplementationName( )
Sequence< OUString > ODBCDriver::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr };
}
@@ -81,18 +85,11 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const OUString& url, cons
if ( ! acceptsURL(url) )
return nullptr;
- if(!m_pDriverHandle)
- {
- OUString aPath;
- if(!EnvironmentHandle(aPath))
- throw SQLException(aPath,*this,OUString(),1000,Any());
- }
- OConnection* pCon = new OConnection(m_pDriverHandle,this);
- Reference< XConnection > xCon = pCon;
+ rtl::Reference<OConnection> pCon = new OConnection(EnvironmentHandle(), this);
pCon->Construct(url,info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon);
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL ODBCDriver::acceptsURL( const OUString& url )
@@ -104,82 +101,78 @@ Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const OUStr
{
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< OUString > aBooleanValues(2);
- aBooleanValues[0] = "false";
- aBooleanValues[1] = "true";
-
- aDriverInfo.push_back(DriverPropertyInfo(
- "CharSet"
- ,"CharSet of the database."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "UseCatalog"
- ,"Use catalog for file-based databases."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "SystemDriverSettings"
- ,"Driver settings."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "ParameterNameSubstitution"
- ,"Change named parameters with '?'."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "IgnoreDriverPrivileges"
- ,"Ignore the privileges from the database driver."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "IsAutoRetrievingEnabled"
- ,"Retrieve generated values."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "AutoRetrievingStatement"
- ,"Auto-increment statement."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "GenerateASBeforeCorrelationName"
- ,"Generate AS before table correlation names."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "EscapeDateTime"
- ,"Escape date time format."
- ,false
- ,"true"
- ,aBooleanValues)
- );
-
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ Sequence< OUString > aBooleanValues{ u"false"_ustr, u"true"_ustr };
+
+ return
+ {
+ {
+ u"CharSet"_ustr,
+ u"CharSet of the database."_ustr,
+ false,
+ {},
+ {}
+ },
+ {
+ u"UseCatalog"_ustr,
+ u"Use catalog for file-based databases."_ustr,
+ false,
+ u"false"_ustr,
+ aBooleanValues
+ },
+ {
+ u"SystemDriverSettings"_ustr,
+ u"Driver settings."_ustr,
+ false,
+ {},
+ {}
+ },
+ {
+ u"ParameterNameSubstitution"_ustr,
+ u"Change named parameters with '?'."_ustr,
+ false,
+ u"false"_ustr,
+ aBooleanValues
+ },
+ {
+ u"IgnoreDriverPrivileges"_ustr,
+ u"Ignore the privileges from the database driver."_ustr,
+ false,
+ u"false"_ustr,
+ aBooleanValues
+ },
+ {
+ u"IsAutoRetrievingEnabled"_ustr,
+ u"Retrieve generated values."_ustr,
+ false,
+ u"false"_ustr,
+ aBooleanValues
+ },
+ {
+ u"AutoRetrievingStatement"_ustr,
+ u"Auto-increment statement."_ustr,
+ false,
+ {},
+ {}
+ },
+ {
+ u"GenerateASBeforeCorrelationName"_ustr,
+ u"Generate AS before table correlation names."_ustr,
+ false,
+ u"false"_ustr,
+ aBooleanValues
+ },
+ {
+ u"EscapeDateTime"_ustr,
+ u"Escape date time format."_ustr,
+ false,
+ u"true"_ustr,
+ aBooleanValues
+ }
+ };
}
::connectivity::SharedResources aResources;
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
}
sal_Int32 SAL_CALL ODBCDriver::getMajorVersion( )
@@ -192,5 +185,728 @@ sal_Int32 SAL_CALL ODBCDriver::getMinorVersion( )
return 0;
}
+// Implib definitions for ODBC-DLL/shared library:
+
+namespace
+{
+constinit oslGenericFunction pODBC3SQLFunctions[static_cast<size_t>(ODBC3SQLFunctionId::LAST)]{};
+
+bool LoadFunctions(oslModule pODBCso)
+{
+ auto load = [pODBCso](ODBC3SQLFunctionId id, const OUString& name)
+ {
+ assert(id > ODBC3SQLFunctionId::FIRST && id < ODBC3SQLFunctionId::LAST);
+ auto& rpFunc = pODBC3SQLFunctions[static_cast<size_t>(id)];
+ assert(rpFunc == nullptr);
+ rpFunc = osl_getFunctionSymbol(pODBCso, name.pData);
+ return rpFunc != nullptr;
+ };
+
+ // Optional functions for Unicode support
+ if (bUseWChar)
+ {
+ load(ODBC3SQLFunctionId::DriverConnectW, u"SQLDriverConnectW"_ustr);
+ load(ODBC3SQLFunctionId::GetInfoW, u"SQLGetInfoW"_ustr);
+ load(ODBC3SQLFunctionId::SetConnectAttrW, u"SQLSetConnectAttrW"_ustr);
+ load(ODBC3SQLFunctionId::GetConnectAttrW, u"SQLGetConnectAttrW"_ustr);
+ load(ODBC3SQLFunctionId::PrepareW, u"SQLPrepareW"_ustr);
+ load(ODBC3SQLFunctionId::SetCursorNameW, u"SQLSetCursorNameW"_ustr);
+ load(ODBC3SQLFunctionId::ExecDirectW, u"SQLExecDirectW"_ustr);
+ load(ODBC3SQLFunctionId::ColAttributeW, u"SQLColAttributeW"_ustr);
+ load(ODBC3SQLFunctionId::GetDiagRecW, u"SQLGetDiagRecW"_ustr);
+ load(ODBC3SQLFunctionId::ColumnPrivilegesW, u"SQLColumnPrivilegesW"_ustr);
+ load(ODBC3SQLFunctionId::ColumnsW, u"SQLColumnsW"_ustr);
+ load(ODBC3SQLFunctionId::ForeignKeysW, u"SQLForeignKeysW"_ustr);
+ load(ODBC3SQLFunctionId::PrimaryKeysW, u"SQLPrimaryKeysW"_ustr);
+ load(ODBC3SQLFunctionId::ProcedureColumnsW, u"SQLProcedureColumnsW"_ustr);
+ load(ODBC3SQLFunctionId::ProceduresW, u"SQLProceduresW"_ustr);
+ load(ODBC3SQLFunctionId::SpecialColumnsW, u"SQLSpecialColumnsW"_ustr);
+ load(ODBC3SQLFunctionId::StatisticsW, u"SQLStatisticsW"_ustr);
+ load(ODBC3SQLFunctionId::TablePrivilegesW, u"SQLTablePrivilegesW"_ustr);
+ load(ODBC3SQLFunctionId::TablesW, u"SQLTablesW"_ustr);
+ load(ODBC3SQLFunctionId::GetCursorNameW, u"SQLGetCursorNameW"_ustr);
+ load(ODBC3SQLFunctionId::NativeSqlW, u"SQLNativeSqlW"_ustr);
+ }
+
+ return load(ODBC3SQLFunctionId::AllocHandle, u"SQLAllocHandle"_ustr)
+ && load(ODBC3SQLFunctionId::DriverConnect, u"SQLDriverConnect"_ustr)
+ && load(ODBC3SQLFunctionId::GetInfo, u"SQLGetInfo"_ustr)
+ && load(ODBC3SQLFunctionId::GetFunctions, u"SQLGetFunctions"_ustr)
+ && load(ODBC3SQLFunctionId::GetTypeInfo, u"SQLGetTypeInfo"_ustr)
+ && load(ODBC3SQLFunctionId::SetConnectAttr, u"SQLSetConnectAttr"_ustr)
+ && load(ODBC3SQLFunctionId::GetConnectAttr, u"SQLGetConnectAttr"_ustr)
+ && load(ODBC3SQLFunctionId::SetEnvAttr, u"SQLSetEnvAttr"_ustr)
+ && load(ODBC3SQLFunctionId::GetEnvAttr, u"SQLGetEnvAttr"_ustr)
+ && load(ODBC3SQLFunctionId::SetStmtAttr, u"SQLSetStmtAttr"_ustr)
+ && load(ODBC3SQLFunctionId::GetStmtAttr, u"SQLGetStmtAttr"_ustr)
+ && load(ODBC3SQLFunctionId::Prepare, u"SQLPrepare"_ustr)
+ && load(ODBC3SQLFunctionId::BindParameter, u"SQLBindParameter"_ustr)
+ && load(ODBC3SQLFunctionId::SetCursorName, u"SQLSetCursorName"_ustr)
+ && load(ODBC3SQLFunctionId::Execute, u"SQLExecute"_ustr)
+ && load(ODBC3SQLFunctionId::ExecDirect, u"SQLExecDirect"_ustr)
+ && load(ODBC3SQLFunctionId::DescribeParam, u"SQLDescribeParam"_ustr)
+ && load(ODBC3SQLFunctionId::NumParams, u"SQLNumParams"_ustr)
+ && load(ODBC3SQLFunctionId::ParamData, u"SQLParamData"_ustr)
+ && load(ODBC3SQLFunctionId::PutData, u"SQLPutData"_ustr)
+ && load(ODBC3SQLFunctionId::RowCount, u"SQLRowCount"_ustr)
+ && load(ODBC3SQLFunctionId::NumResultCols, u"SQLNumResultCols"_ustr)
+ && load(ODBC3SQLFunctionId::ColAttribute, u"SQLColAttribute"_ustr)
+ && load(ODBC3SQLFunctionId::BindCol, u"SQLBindCol"_ustr)
+ && load(ODBC3SQLFunctionId::Fetch, u"SQLFetch"_ustr)
+ && load(ODBC3SQLFunctionId::FetchScroll, u"SQLFetchScroll"_ustr)
+ && load(ODBC3SQLFunctionId::GetData, u"SQLGetData"_ustr)
+ && load(ODBC3SQLFunctionId::SetPos, u"SQLSetPos"_ustr)
+ && load(ODBC3SQLFunctionId::BulkOperations, u"SQLBulkOperations"_ustr)
+ && load(ODBC3SQLFunctionId::MoreResults, u"SQLMoreResults"_ustr)
+ && load(ODBC3SQLFunctionId::GetDiagRec, u"SQLGetDiagRec"_ustr)
+ && load(ODBC3SQLFunctionId::ColumnPrivileges, u"SQLColumnPrivileges"_ustr)
+ && load(ODBC3SQLFunctionId::Columns, u"SQLColumns"_ustr)
+ && load(ODBC3SQLFunctionId::ForeignKeys, u"SQLForeignKeys"_ustr)
+ && load(ODBC3SQLFunctionId::PrimaryKeys, u"SQLPrimaryKeys"_ustr)
+ && load(ODBC3SQLFunctionId::ProcedureColumns, u"SQLProcedureColumns"_ustr)
+ && load(ODBC3SQLFunctionId::Procedures, u"SQLProcedures"_ustr)
+ && load(ODBC3SQLFunctionId::SpecialColumns, u"SQLSpecialColumns"_ustr)
+ && load(ODBC3SQLFunctionId::Statistics, u"SQLStatistics"_ustr)
+ && load(ODBC3SQLFunctionId::TablePrivileges, u"SQLTablePrivileges"_ustr)
+ && load(ODBC3SQLFunctionId::Tables, u"SQLTables"_ustr)
+ && load(ODBC3SQLFunctionId::FreeStmt, u"SQLFreeStmt"_ustr)
+ && load(ODBC3SQLFunctionId::CloseCursor, u"SQLCloseCursor"_ustr)
+ && load(ODBC3SQLFunctionId::Cancel, u"SQLCancel"_ustr)
+ && load(ODBC3SQLFunctionId::EndTran, u"SQLEndTran"_ustr)
+ && load(ODBC3SQLFunctionId::Disconnect, u"SQLDisconnect"_ustr)
+ && load(ODBC3SQLFunctionId::FreeHandle, u"SQLFreeHandle"_ustr)
+ && load(ODBC3SQLFunctionId::GetCursorName, u"SQLGetCursorName"_ustr)
+ && load(ODBC3SQLFunctionId::NativeSql, u"SQLNativeSql"_ustr);
+}
+
+// Take care of Dynamically loading of the DLL/shared lib and Addresses:
+// Returns sal_True at success
+bool LoadLibrary_ODBC3(OUString &_rPath)
+{
+ static bool bLoaded = false;
+ static oslModule pODBCso = nullptr;
+
+ if (bLoaded)
+ return true;
+#ifdef DISABLE_DYNLOADING
+ (void)_rPath;
+#else
+#ifdef _WIN32
+ _rPath = "ODBC32.DLL";
+#endif
+#ifdef UNX
+ #ifdef MACOSX
+ _rPath = "libiodbc.dylib";
+ #else
+ _rPath = "libodbc.so.2";
+ pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
+ if ( !pODBCso )
+ {
+ _rPath = "libodbc.so.1";
+ pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
+ }
+ if ( !pODBCso )
+ _rPath = "libodbc.so";
+
+ #endif /* MACOSX */
+#endif
+
+ if ( !pODBCso )
+ pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
+#endif // DISABLE_DYNLOADING
+ if( !pODBCso)
+ return false;
+
+ bLoaded = LoadFunctions(pODBCso);
+ return bLoaded;
+}
+
+class ORealOdbcDriver : public connectivity::odbc::ODBCDriver, public connectivity::odbc::Functions
+{
+public:
+ explicit ORealOdbcDriver(const css::uno::Reference<css::uno::XComponentContext>& _rxContext)
+ : ODBCDriver(_rxContext)
+ {
+ }
+ const Functions& functions() const override { return *this; }
+
+ // Functions
+
+ bool has(ODBC3SQLFunctionId id) const override
+ {
+ assert(id > ODBC3SQLFunctionId::FIRST && id < ODBC3SQLFunctionId::LAST);
+ return pODBC3SQLFunctions[static_cast<size_t>(id)] != nullptr;
+ }
+
+ SQLRETURN AllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle,
+ SQLHANDLE* OutputHandlePtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::AllocHandle, HandleType, InputHandle, OutputHandlePtr);
+ }
+
+ SQLRETURN DriverConnect(SQLHDBC ConnectionHandle, HWND WindowHandle,
+ SQLCHAR* InConnectionString, SQLSMALLINT StringLength1,
+ SQLCHAR* OutConnectionString, SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLength2Ptr,
+ SQLUSMALLINT DriverCompletion) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::DriverConnect, ConnectionHandle, WindowHandle,
+ InConnectionString, StringLength1, OutConnectionString, BufferLength,
+ StringLength2Ptr, DriverCompletion);
+ }
+
+ SQLRETURN DriverConnectW(SQLHDBC ConnectionHandle, HWND WindowHandle,
+ SQLWCHAR* InConnectionString, SQLSMALLINT StringLength1,
+ SQLWCHAR* OutConnectionString, SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLength2Ptr,
+ SQLUSMALLINT DriverCompletion) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::DriverConnectW, ConnectionHandle, WindowHandle,
+ InConnectionString, StringLength1, OutConnectionString, BufferLength,
+ StringLength2Ptr, DriverCompletion);
+ }
+
+ SQLRETURN GetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValuePtr,
+ SQLSMALLINT BufferLength, SQLSMALLINT* StringLengthPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetInfo, ConnectionHandle, InfoType, InfoValuePtr,
+ BufferLength, StringLengthPtr);
+ }
+
+ SQLRETURN GetInfoW(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValuePtr,
+ SQLSMALLINT BufferLength, SQLSMALLINT* StringLengthPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetInfoW, ConnectionHandle, InfoType, InfoValuePtr,
+ BufferLength, StringLengthPtr);
+ }
+
+ SQLRETURN GetFunctions(SQLHDBC ConnectionHandle, SQLUSMALLINT FunctionId,
+ SQLUSMALLINT* SupportedPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetFunctions, ConnectionHandle, FunctionId,
+ SupportedPtr);
+ }
+
+ SQLRETURN GetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetTypeInfo, StatementHandle, DataType);
+ }
+
+ SQLRETURN SetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SetConnectAttr, ConnectionHandle, Attribute, ValuePtr,
+ StringLength);
+ }
+
+ SQLRETURN SetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SetConnectAttrW, ConnectionHandle, Attribute, ValuePtr,
+ StringLength);
+ }
+
+ SQLRETURN GetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength, SQLINTEGER* StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetConnectAttr, ConnectionHandle, Attribute, ValuePtr,
+ BufferLength, StringLength);
+ }
+
+ SQLRETURN GetConnectAttrW(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength, SQLINTEGER* StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetConnectAttrW, ConnectionHandle, Attribute, ValuePtr,
+ BufferLength, StringLength);
+ }
+
+ SQLRETURN SetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SetEnvAttr, EnvironmentHandle, Attribute, ValuePtr,
+ StringLength);
+ }
+
+ SQLRETURN GetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength, SQLINTEGER* StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetEnvAttr, EnvironmentHandle, Attribute, ValuePtr,
+ BufferLength, StringLength);
+ }
+
+ SQLRETURN SetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SetStmtAttr, StatementHandle, Attribute, ValuePtr,
+ StringLength);
+ }
+
+ SQLRETURN GetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength, SQLINTEGER* StringLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetStmtAttr, StatementHandle, Attribute, ValuePtr,
+ BufferLength, StringLength);
+ }
+
+ SQLRETURN Prepare(SQLHSTMT StatementHandle, SQLCHAR* StatementText,
+ SQLINTEGER TextLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Prepare, StatementHandle, StatementText, TextLength);
+ }
+
+ SQLRETURN PrepareW(SQLHSTMT StatementHandle, SQLWCHAR* StatementText,
+ SQLINTEGER TextLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::PrepareW, StatementHandle, StatementText, TextLength);
+ }
+
+ SQLRETURN BindParameter(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber,
+ SQLSMALLINT InputOutputType, SQLSMALLINT ValueType,
+ SQLSMALLINT ParameterType, SQLULEN ColumnSize,
+ SQLSMALLINT DecimalDigits, SQLPOINTER ParameterValuePtr,
+ SQLLEN BufferLength, SQLLEN* StrLen_or_IndPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::BindParameter, StatementHandle, ParameterNumber,
+ InputOutputType, ValueType, ParameterType, ColumnSize, DecimalDigits,
+ ParameterValuePtr, BufferLength, StrLen_or_IndPtr);
+ }
+
+ SQLRETURN SetCursorName(SQLHSTMT StatementHandle, SQLCHAR* CursorName,
+ SQLSMALLINT NameLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SetCursorName, StatementHandle, CursorName, NameLength);
+ }
+
+ SQLRETURN SetCursorNameW(SQLHSTMT StatementHandle, SQLWCHAR* CursorName,
+ SQLSMALLINT NameLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SetCursorNameW, StatementHandle, CursorName, NameLength);
+ }
+
+ SQLRETURN Execute(SQLHSTMT StatementHandle) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Execute, StatementHandle);
+ }
+
+ SQLRETURN ExecDirect(SQLHSTMT StatementHandle, SQLCHAR* StatementText,
+ SQLINTEGER TextLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ExecDirect, StatementHandle, StatementText, TextLength);
+ }
+
+ SQLRETURN ExecDirectW(SQLHSTMT StatementHandle, SQLWCHAR* StatementText,
+ SQLINTEGER TextLength) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ExecDirectW, StatementHandle, StatementText, TextLength);
+ }
+
+ SQLRETURN DescribeParam(SQLHSTMT StatementHandle, SQLUSMALLINT ParameterNumber,
+ SQLSMALLINT* DataTypePtr, SQLULEN* ParameterSizePtr,
+ SQLSMALLINT* DecimalDigitsPtr, SQLSMALLINT* NullablePtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::DescribeParam, StatementHandle, ParameterNumber,
+ DataTypePtr, ParameterSizePtr, DecimalDigitsPtr, NullablePtr);
+ }
+
+ SQLRETURN NumParams(SQLHSTMT StatementHandle, SQLSMALLINT* ParameterCountPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::NumParams, StatementHandle, ParameterCountPtr);
+ }
+
+ SQLRETURN ParamData(SQLHSTMT StatementHandle, SQLPOINTER* ValuePtrPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ParamData, StatementHandle, ValuePtrPtr);
+ }
+
+ SQLRETURN PutData(SQLHSTMT StatementHandle, SQLPOINTER DataPtr,
+ SQLLEN StrLen_or_Ind) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::PutData, StatementHandle, DataPtr, StrLen_or_Ind);
+ }
+
+ SQLRETURN RowCount(SQLHSTMT StatementHandle, SQLLEN* RowCountPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::RowCount, StatementHandle, RowCountPtr);
+ }
+
+ SQLRETURN NumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT* ColumnCountPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::NumResultCols, StatementHandle, ColumnCountPtr);
+ }
+
+ SQLRETURN ColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
+ SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttributePtr,
+ SQLSMALLINT BufferLength, SQLSMALLINT* StringLengthPtr,
+ SQLLEN* NumericAttributePtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ColAttribute, StatementHandle, ColumnNumber,
+ FieldIdentifier, CharacterAttributePtr, BufferLength, StringLengthPtr,
+ NumericAttributePtr);
+ }
+
+ SQLRETURN ColAttributeW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber,
+ SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttributePtr,
+ SQLSMALLINT BufferLength, SQLSMALLINT* StringLengthPtr,
+ SQLLEN* NumericAttributePtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ColAttributeW, StatementHandle, ColumnNumber,
+ FieldIdentifier, CharacterAttributePtr, BufferLength, StringLengthPtr,
+ NumericAttributePtr);
+ }
+
+ SQLRETURN BindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
+ SQLPOINTER TargetValuePtr, SQLLEN BufferLength,
+ SQLLEN* StrLen_or_IndPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::BindCol, StatementHandle, ColumnNumber, TargetType,
+ TargetValuePtr, BufferLength, StrLen_or_IndPtr);
+ }
+
+ SQLRETURN Fetch(SQLHSTMT StatementHandle) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Fetch, StatementHandle);
+ }
+
+ SQLRETURN FetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation,
+ SQLLEN FetchOffset) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::FetchScroll, StatementHandle, FetchOrientation,
+ FetchOffset);
+ }
+
+ SQLRETURN GetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
+ SQLPOINTER TargetValuePtr, SQLLEN BufferLength,
+ SQLLEN* StrLen_or_IndPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetData, StatementHandle, ColumnNumber, TargetType,
+ TargetValuePtr, BufferLength, StrLen_or_IndPtr);
+ }
+
+ SQLRETURN SetPos(SQLHSTMT StatementHandle, SQLSETPOSIROW RowNumber, SQLUSMALLINT Operation,
+ SQLUSMALLINT LockType) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SetPos, StatementHandle, RowNumber, Operation,
+ LockType);
+ }
+
+ SQLRETURN BulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::BulkOperations, StatementHandle, Operation);
+ }
+
+ SQLRETURN MoreResults(SQLHSTMT StatementHandle) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::MoreResults, StatementHandle);
+ }
+
+ SQLRETURN GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
+ SQLCHAR* Sqlstate, SQLINTEGER* NativeErrorPtr, SQLCHAR* MessageText,
+ SQLSMALLINT BufferLength, SQLSMALLINT* TextLengthPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetDiagRec, HandleType, Handle, RecNumber, Sqlstate,
+ NativeErrorPtr, MessageText, BufferLength, TextLengthPtr);
+ }
+
+ SQLRETURN GetDiagRecW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber,
+ SQLWCHAR* Sqlstate, SQLINTEGER* NativeErrorPtr, SQLWCHAR* MessageText,
+ SQLSMALLINT BufferLength, SQLSMALLINT* TextLengthPtr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetDiagRecW, HandleType, Handle, RecNumber, Sqlstate,
+ NativeErrorPtr, MessageText, BufferLength, TextLengthPtr);
+ }
+
+ SQLRETURN ColumnPrivileges(SQLHSTMT StatementHandle, SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1, SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2, SQLCHAR* TableName, SQLSMALLINT NameLength3,
+ SQLCHAR* ColumnName, SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ColumnPrivileges, StatementHandle, CatalogName,
+ NameLength1, SchemaName, NameLength2, TableName, NameLength3, ColumnName,
+ NameLength4);
+ }
+
+ SQLRETURN ColumnPrivilegesW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1, SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2, SQLWCHAR* TableName, SQLSMALLINT NameLength3,
+ SQLWCHAR* ColumnName, SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ColumnPrivilegesW, StatementHandle, CatalogName,
+ NameLength1, SchemaName, NameLength2, TableName, NameLength3, ColumnName,
+ NameLength4);
+ }
+
+ SQLRETURN Columns(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName, SQLSMALLINT NameLength2, SQLCHAR* TableName,
+ SQLSMALLINT NameLength3, SQLCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Columns, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
+ }
+
+ SQLRETURN ColumnsW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName, SQLSMALLINT NameLength2, SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3, SQLWCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ColumnsW, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
+ }
+
+ SQLRETURN ForeignKeys(SQLHSTMT StatementHandle, SQLCHAR* PKCatalogName, SQLSMALLINT NameLength1,
+ SQLCHAR* PKSchemaName, SQLSMALLINT NameLength2, SQLCHAR* PKTableName,
+ SQLSMALLINT NameLength3, SQLCHAR* FKCatalogName, SQLSMALLINT NameLength4,
+ SQLCHAR* FKSchemaName, SQLSMALLINT NameLength5, SQLCHAR* FKTableName,
+ SQLSMALLINT NameLength6) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ForeignKeys, StatementHandle, PKCatalogName,
+ NameLength1, PKSchemaName, NameLength2, PKTableName, NameLength3,
+ FKCatalogName, NameLength4, FKSchemaName, NameLength5, FKTableName,
+ NameLength6);
+ }
+
+ SQLRETURN ForeignKeysW(SQLHSTMT StatementHandle, SQLWCHAR* PKCatalogName, SQLSMALLINT NameLength1,
+ SQLWCHAR* PKSchemaName, SQLSMALLINT NameLength2, SQLWCHAR* PKTableName,
+ SQLSMALLINT NameLength3, SQLWCHAR* FKCatalogName, SQLSMALLINT NameLength4,
+ SQLWCHAR* FKSchemaName, SQLSMALLINT NameLength5, SQLWCHAR* FKTableName,
+ SQLSMALLINT NameLength6) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ForeignKeysW, StatementHandle, PKCatalogName,
+ NameLength1, PKSchemaName, NameLength2, PKTableName, NameLength3,
+ FKCatalogName, NameLength4, FKSchemaName, NameLength5, FKTableName,
+ NameLength6);
+ }
+
+ SQLRETURN PrimaryKeys(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName, SQLSMALLINT NameLength2, SQLCHAR* TableName,
+ SQLSMALLINT NameLength3) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::PrimaryKeys, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3);
+ }
+
+ SQLRETURN PrimaryKeysW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName, SQLSMALLINT NameLength2, SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::PrimaryKeysW, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3);
+ }
+
+ SQLRETURN ProcedureColumns(SQLHSTMT StatementHandle, SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1, SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2, SQLCHAR* ProcName, SQLSMALLINT NameLength3,
+ SQLCHAR* ColumnName, SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ProcedureColumns, StatementHandle, CatalogName,
+ NameLength1, SchemaName, NameLength2, ProcName, NameLength3, ColumnName,
+ NameLength4);
+ }
+
+ SQLRETURN ProcedureColumnsW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1, SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2, SQLWCHAR* ProcName, SQLSMALLINT NameLength3,
+ SQLWCHAR* ColumnName, SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ProcedureColumnsW, StatementHandle, CatalogName,
+ NameLength1, SchemaName, NameLength2, ProcName, NameLength3, ColumnName,
+ NameLength4);
+ }
+
+ SQLRETURN Procedures(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName, SQLSMALLINT NameLength2, SQLCHAR* ProcName,
+ SQLSMALLINT NameLength3) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Procedures, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, ProcName, NameLength3);
+ }
+
+ SQLRETURN ProceduresW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName, SQLSMALLINT NameLength2, SQLWCHAR* ProcName,
+ SQLSMALLINT NameLength3) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::ProceduresW, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, ProcName, NameLength3);
+ }
+
+ SQLRETURN SpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType,
+ SQLCHAR* CatalogName, SQLSMALLINT NameLength1, SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2, SQLCHAR* TableName, SQLSMALLINT NameLength3,
+ SQLUSMALLINT Scope, SQLUSMALLINT Nullable) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SpecialColumns, StatementHandle, IdentifierType,
+ CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
+ Scope, Nullable);
+ }
+
+ SQLRETURN SpecialColumnsW(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType,
+ SQLWCHAR* CatalogName, SQLSMALLINT NameLength1, SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2, SQLWCHAR* TableName, SQLSMALLINT NameLength3,
+ SQLUSMALLINT Scope, SQLUSMALLINT Nullable) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::SpecialColumnsW, StatementHandle, IdentifierType,
+ CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3,
+ Scope, Nullable);
+ }
+
+ SQLRETURN Statistics(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName, SQLSMALLINT NameLength2, SQLCHAR* TableName,
+ SQLSMALLINT NameLength3, SQLUSMALLINT Unique,
+ SQLUSMALLINT Reserved) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Statistics, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3, Unique, Reserved);
+ }
+
+ SQLRETURN StatisticsW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName, SQLSMALLINT NameLength2, SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3, SQLUSMALLINT Unique,
+ SQLUSMALLINT Reserved) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::StatisticsW, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3, Unique, Reserved);
+ }
+
+ SQLRETURN TablePrivileges(SQLHSTMT StatementHandle, SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1, SQLCHAR* SchemaName, SQLSMALLINT NameLength2,
+ SQLCHAR* TableName, SQLSMALLINT NameLength3) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::TablePrivileges, StatementHandle, CatalogName,
+ NameLength1, SchemaName, NameLength2, TableName, NameLength3);
+ }
+
+ SQLRETURN TablePrivilegesW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1, SQLWCHAR* SchemaName, SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName, SQLSMALLINT NameLength3) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::TablePrivilegesW, StatementHandle, CatalogName,
+ NameLength1, SchemaName, NameLength2, TableName, NameLength3);
+ }
+
+ SQLRETURN Tables(SQLHSTMT StatementHandle, SQLCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName, SQLSMALLINT NameLength2, SQLCHAR* TableName,
+ SQLSMALLINT NameLength3, SQLCHAR* TableType,
+ SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Tables, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
+ }
+
+ SQLRETURN TablesW(SQLHSTMT StatementHandle, SQLWCHAR* CatalogName, SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName, SQLSMALLINT NameLength2, SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3, SQLWCHAR* TableType,
+ SQLSMALLINT NameLength4) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::TablesW, StatementHandle, CatalogName, NameLength1,
+ SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
+ }
+
+ SQLRETURN FreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::FreeStmt, StatementHandle, Option);
+ }
+
+ SQLRETURN CloseCursor(SQLHSTMT StatementHandle) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::CloseCursor, StatementHandle);
+ }
+
+ SQLRETURN Cancel(SQLHSTMT StatementHandle) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Cancel, StatementHandle);
+ }
+
+ SQLRETURN EndTran(SQLSMALLINT HandleType, SQLHANDLE Handle,
+ SQLSMALLINT CompletionType) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::EndTran, HandleType, Handle, CompletionType);
+ }
+
+ SQLRETURN Disconnect(SQLHDBC ConnectionHandle) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::Disconnect, ConnectionHandle);
+ }
+
+ SQLRETURN FreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::FreeHandle, HandleType, Handle);
+ }
+
+ SQLRETURN GetCursorName(SQLHSTMT StatementHandle, SQLCHAR* CursorName, SQLSMALLINT BufferLength,
+ SQLSMALLINT* NameLength2) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetCursorName, StatementHandle, CursorName,
+ BufferLength, NameLength2);
+ }
+
+ SQLRETURN GetCursorNameW(SQLHSTMT StatementHandle, SQLWCHAR* CursorName, SQLSMALLINT BufferLength,
+ SQLSMALLINT* NameLength2) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::GetCursorNameW, StatementHandle, CursorName,
+ BufferLength, NameLength2);
+ }
+
+ SQLRETURN NativeSql(SQLHDBC ConnectionHandle, SQLCHAR* InStatementText, SQLINTEGER TextLength1,
+ SQLCHAR* OutStatementText, SQLINTEGER BufferLength,
+ SQLINTEGER* TextLength2Ptr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::NativeSql, ConnectionHandle, InStatementText,
+ TextLength1, OutStatementText, BufferLength, TextLength2Ptr);
+ }
+
+ SQLRETURN NativeSqlW(SQLHDBC ConnectionHandle, SQLWCHAR* InStatementText, SQLINTEGER TextLength1,
+ SQLWCHAR* OutStatementText, SQLINTEGER BufferLength,
+ SQLINTEGER* TextLength2Ptr) const override
+ {
+ return ODBCFunc(ODBC3SQLFunctionId::NativeSqlW, ConnectionHandle, InStatementText,
+ TextLength1, OutStatementText, BufferLength, TextLength2Ptr);
+ }
+
+protected:
+ virtual SQLHANDLE EnvironmentHandle() override;
+
+private:
+ template <typename... Args> static SQLRETURN ODBCFunc(ODBC3SQLFunctionId id, Args... args)
+ {
+ assert(id > ODBC3SQLFunctionId::FIRST && id < ODBC3SQLFunctionId::LAST);
+ assert(pODBC3SQLFunctions[static_cast<size_t>(id)]);
+ using Func_t = SQLRETURN(SQL_API*)(Args...);
+ return (*reinterpret_cast<Func_t>(pODBC3SQLFunctions[static_cast<size_t>(id)]))(args...);
+ }
+
+ SQLHANDLE m_pDriverHandle = SQL_NULL_HANDLE;
+};
+
+// ODBC Environment (common for all Connections):
+SQLHANDLE ORealOdbcDriver::EnvironmentHandle()
+{
+ // Is (for this instance) already an Environment made?
+ if (m_pDriverHandle == SQL_NULL_HANDLE)
+ {
+ OUString aPath;
+ SQLHANDLE h = SQL_NULL_HANDLE;
+ // allocate Environment
+ // load ODBC-DLL now:
+ if (!LoadLibrary_ODBC3(aPath)
+ || AllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &h) != SQL_SUCCESS)
+ dbtools::throwSQLException(aPath, OUString(), *this, 1000);
+
+ // Save in global Structure
+ m_pDriverHandle = h;
+ SetEnvAttr(h, SQL_ATTR_ODBC_VERSION, reinterpret_cast<SQLPOINTER>(SQL_OV_ODBC3),
+ SQL_IS_UINTEGER);
+ //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER);
+ }
+
+ return m_pDriverHandle;
+}
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_odbc_ORealOdbcDriver_get_implementation(css::uno::XComponentContext* context,
+ css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new ORealOdbcDriver(context));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx
deleted file mode 100644
index ae89531763a1..000000000000
--- a/connectivity/source/drivers/odbc/OFunctions.cxx
+++ /dev/null
@@ -1,243 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <odbc/OFunctions.hxx>
-
-// Implib definitions for ODBC-DLL/shared library:
-
-namespace connectivity
-{
- T3SQLAllocHandle pODBC3SQLAllocHandle;
-T3SQLConnect pODBC3SQLConnect;
-T3SQLDriverConnect pODBC3SQLDriverConnect;
-T3SQLBrowseConnect pODBC3SQLBrowseConnect;
-T3SQLDataSources pODBC3SQLDataSources;
-T3SQLDrivers pODBC3SQLDrivers;
-T3SQLGetInfo pODBC3SQLGetInfo;
-T3SQLGetFunctions pODBC3SQLGetFunctions;
-T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
-T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
-T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
-T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
-T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
-T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
-T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
-T3SQLPrepare pODBC3SQLPrepare;
-T3SQLBindParameter pODBC3SQLBindParameter;
-T3SQLSetCursorName pODBC3SQLSetCursorName;
-T3SQLExecute pODBC3SQLExecute;
-T3SQLExecDirect pODBC3SQLExecDirect;
-T3SQLDescribeParam pODBC3SQLDescribeParam;
-T3SQLNumParams pODBC3SQLNumParams;
-T3SQLParamData pODBC3SQLParamData;
-T3SQLPutData pODBC3SQLPutData;
-T3SQLRowCount pODBC3SQLRowCount;
-T3SQLNumResultCols pODBC3SQLNumResultCols;
-T3SQLDescribeCol pODBC3SQLDescribeCol;
-T3SQLColAttribute pODBC3SQLColAttribute;
-T3SQLBindCol pODBC3SQLBindCol;
-T3SQLFetch pODBC3SQLFetch;
-T3SQLFetchScroll pODBC3SQLFetchScroll;
-T3SQLGetData pODBC3SQLGetData;
-T3SQLSetPos pODBC3SQLSetPos;
-T3SQLBulkOperations pODBC3SQLBulkOperations;
-T3SQLMoreResults pODBC3SQLMoreResults;
-T3SQLGetDiagRec pODBC3SQLGetDiagRec;
-T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
-T3SQLColumns pODBC3SQLColumns;
-T3SQLForeignKeys pODBC3SQLForeignKeys;
-T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
-T3SQLProcedureColumns pODBC3SQLProcedureColumns;
-T3SQLProcedures pODBC3SQLProcedures;
-T3SQLSpecialColumns pODBC3SQLSpecialColumns;
-T3SQLStatistics pODBC3SQLStatistics;
-T3SQLTablePrivileges pODBC3SQLTablePrivileges;
-T3SQLTables pODBC3SQLTables;
-T3SQLFreeStmt pODBC3SQLFreeStmt;
-T3SQLCloseCursor pODBC3SQLCloseCursor;
-T3SQLCancel pODBC3SQLCancel;
-T3SQLEndTran pODBC3SQLEndTran;
-T3SQLDisconnect pODBC3SQLDisconnect;
-T3SQLFreeHandle pODBC3SQLFreeHandle;
-T3SQLGetCursorName pODBC3SQLGetCursorName;
-T3SQLNativeSql pODBC3SQLNativeSql;
-
-static bool LoadFunctions(oslModule pODBCso);
-
-// Take care of Dynamically loading of the DLL/shared lib and Addresses:
-// Returns sal_True at success
-bool LoadLibrary_ODBC3(OUString &_rPath)
-{
- static bool bLoaded = false;
- static oslModule pODBCso = nullptr;
-
- if (bLoaded)
- return true;
-#ifndef DISABLE_DYNLOADING
-#ifdef _WIN32
- _rPath = "ODBC32.DLL";
-#endif
-#ifdef UNX
- #ifdef MACOSX
- _rPath = "libiodbc.dylib";
- #else
- _rPath = "libodbc.so.2";
- pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
- if ( !pODBCso )
- {
- _rPath = "libodbc.so.1";
- pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
- }
- if ( !pODBCso )
- _rPath = "libodbc.so";
-
- #endif /* MACOSX */
-#endif
-
- if ( !pODBCso )
- pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
-#endif
- if( !pODBCso)
- return false;
-
- bLoaded = LoadFunctions(pODBCso);
- return bLoaded;
-}
-
-
-bool LoadFunctions(oslModule pODBCso)
-{
-
- if( ( pODBC3SQLAllocHandle = reinterpret_cast<T3SQLAllocHandle>(osl_getFunctionSymbol(pODBCso, OUString("SQLAllocHandle").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLConnect = reinterpret_cast<T3SQLConnect>(osl_getFunctionSymbol(pODBCso, OUString("SQLConnect").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLDriverConnect = reinterpret_cast<T3SQLDriverConnect>(osl_getFunctionSymbol(pODBCso, OUString("SQLDriverConnect").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLBrowseConnect = reinterpret_cast<T3SQLBrowseConnect>(osl_getFunctionSymbol(pODBCso, OUString("SQLBrowseConnect").pData ))) == nullptr )
- return false;
- if(( pODBC3SQLDataSources = reinterpret_cast<T3SQLDataSources>(osl_getFunctionSymbol(pODBCso, OUString("SQLDataSources").pData ))) == nullptr )
- return false;
- if(( pODBC3SQLDrivers = reinterpret_cast<T3SQLDrivers>(osl_getFunctionSymbol(pODBCso, OUString("SQLDrivers").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetInfo = reinterpret_cast<T3SQLGetInfo>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetInfo").pData ))) == nullptr )
- return false;
- if(( pODBC3SQLGetFunctions = reinterpret_cast<T3SQLGetFunctions>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetFunctions").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetTypeInfo = reinterpret_cast<T3SQLGetTypeInfo>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetTypeInfo").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLSetConnectAttr = reinterpret_cast<T3SQLSetConnectAttr>(osl_getFunctionSymbol(pODBCso, OUString("SQLSetConnectAttr").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetConnectAttr = reinterpret_cast<T3SQLGetConnectAttr>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetConnectAttr").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLSetEnvAttr = reinterpret_cast<T3SQLSetEnvAttr>(osl_getFunctionSymbol(pODBCso, OUString("SQLSetEnvAttr").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetEnvAttr = reinterpret_cast<T3SQLGetEnvAttr>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetEnvAttr").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLSetStmtAttr = reinterpret_cast<T3SQLSetStmtAttr>(osl_getFunctionSymbol(pODBCso, OUString("SQLSetStmtAttr").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetStmtAttr = reinterpret_cast<T3SQLGetStmtAttr>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetStmtAttr").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLPrepare = reinterpret_cast<T3SQLPrepare>(osl_getFunctionSymbol(pODBCso, OUString("SQLPrepare").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLBindParameter = reinterpret_cast<T3SQLBindParameter>(osl_getFunctionSymbol(pODBCso, OUString("SQLBindParameter").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLSetCursorName = reinterpret_cast<T3SQLSetCursorName>(osl_getFunctionSymbol(pODBCso, OUString("SQLSetCursorName").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLExecute = reinterpret_cast<T3SQLExecute>(osl_getFunctionSymbol(pODBCso, OUString("SQLExecute").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLExecDirect = reinterpret_cast<T3SQLExecDirect>(osl_getFunctionSymbol(pODBCso, OUString("SQLExecDirect").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLDescribeParam = reinterpret_cast<T3SQLDescribeParam>(osl_getFunctionSymbol(pODBCso, OUString("SQLDescribeParam").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLNumParams = reinterpret_cast<T3SQLNumParams>(osl_getFunctionSymbol(pODBCso, OUString("SQLNumParams").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLParamData = reinterpret_cast<T3SQLParamData>(osl_getFunctionSymbol(pODBCso, OUString("SQLParamData").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLPutData = reinterpret_cast<T3SQLPutData>(osl_getFunctionSymbol(pODBCso, OUString("SQLPutData").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLRowCount = reinterpret_cast<T3SQLRowCount>(osl_getFunctionSymbol(pODBCso, OUString("SQLRowCount").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLNumResultCols = reinterpret_cast<T3SQLNumResultCols>(osl_getFunctionSymbol(pODBCso, OUString("SQLNumResultCols").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLDescribeCol = reinterpret_cast<T3SQLDescribeCol>(osl_getFunctionSymbol(pODBCso, OUString("SQLDescribeCol").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLColAttribute = reinterpret_cast<T3SQLColAttribute>(osl_getFunctionSymbol(pODBCso, OUString("SQLColAttribute").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLBindCol = reinterpret_cast<T3SQLBindCol>(osl_getFunctionSymbol(pODBCso, OUString("SQLBindCol").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLFetch = reinterpret_cast<T3SQLFetch>(osl_getFunctionSymbol(pODBCso, OUString("SQLFetch").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLFetchScroll = reinterpret_cast<T3SQLFetchScroll>(osl_getFunctionSymbol(pODBCso, OUString("SQLFetchScroll").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetData = reinterpret_cast<T3SQLGetData>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetData").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLSetPos = reinterpret_cast<T3SQLSetPos>(osl_getFunctionSymbol(pODBCso, OUString("SQLSetPos").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLBulkOperations = reinterpret_cast<T3SQLBulkOperations>(osl_getFunctionSymbol(pODBCso, OUString("SQLBulkOperations").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLMoreResults = reinterpret_cast<T3SQLMoreResults>(osl_getFunctionSymbol(pODBCso, OUString("SQLMoreResults").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetDiagRec = reinterpret_cast<T3SQLGetDiagRec>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetDiagRec").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLColumnPrivileges = reinterpret_cast<T3SQLColumnPrivileges>(osl_getFunctionSymbol(pODBCso, OUString("SQLColumnPrivileges").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLColumns = reinterpret_cast<T3SQLColumns>(osl_getFunctionSymbol(pODBCso, OUString("SQLColumns").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLForeignKeys = reinterpret_cast<T3SQLForeignKeys>(osl_getFunctionSymbol(pODBCso, OUString("SQLForeignKeys").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLPrimaryKeys = reinterpret_cast<T3SQLPrimaryKeys>(osl_getFunctionSymbol(pODBCso, OUString("SQLPrimaryKeys").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLProcedureColumns = reinterpret_cast<T3SQLProcedureColumns>(osl_getFunctionSymbol(pODBCso, OUString("SQLProcedureColumns").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLProcedures = reinterpret_cast<T3SQLProcedures>(osl_getFunctionSymbol(pODBCso, OUString("SQLProcedures").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLSpecialColumns = reinterpret_cast<T3SQLSpecialColumns>(osl_getFunctionSymbol(pODBCso, OUString("SQLSpecialColumns").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLStatistics = reinterpret_cast<T3SQLStatistics>(osl_getFunctionSymbol(pODBCso, OUString("SQLStatistics").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLTablePrivileges = reinterpret_cast<T3SQLTablePrivileges>(osl_getFunctionSymbol(pODBCso, OUString("SQLTablePrivileges").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLTables = reinterpret_cast<T3SQLTables>(osl_getFunctionSymbol(pODBCso, OUString("SQLTables").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLFreeStmt = reinterpret_cast<T3SQLFreeStmt>(osl_getFunctionSymbol(pODBCso, OUString("SQLFreeStmt").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLCloseCursor = reinterpret_cast<T3SQLCloseCursor>(osl_getFunctionSymbol(pODBCso, OUString("SQLCloseCursor").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLCancel = reinterpret_cast<T3SQLCancel>(osl_getFunctionSymbol(pODBCso, OUString("SQLCancel").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLEndTran = reinterpret_cast<T3SQLEndTran>(osl_getFunctionSymbol(pODBCso, OUString("SQLEndTran").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLDisconnect = reinterpret_cast<T3SQLDisconnect>(osl_getFunctionSymbol(pODBCso, OUString("SQLDisconnect").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLFreeHandle = reinterpret_cast<T3SQLFreeHandle>(osl_getFunctionSymbol(pODBCso, OUString("SQLFreeHandle").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLGetCursorName = reinterpret_cast<T3SQLGetCursorName>(osl_getFunctionSymbol(pODBCso, OUString("SQLGetCursorName").pData ))) == nullptr )
- return false;
- if( ( pODBC3SQLNativeSql = reinterpret_cast<T3SQLNativeSql>(osl_getFunctionSymbol(pODBCso, OUString("SQLNativeSql").pData ))) == nullptr )
- return false;
-
- return true;
-}
-
-
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index 65cfbf5e7b5f..e0225e0f6407 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -40,22 +40,12 @@ using namespace connectivity;
using namespace connectivity::odbc;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.OPreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-namespace
-{
- // for now, never use wchar,
- // but most of code is prepared to handle it
- // in case we make this configurable
- const bool bUseWChar = false;
-}
+IMPLEMENT_SERVICE_INFO(OPreparedStatement,u"com.sun.star.sdbcx.OPreparedStatement"_ustr,u"com.sun.star.sdbc.PreparedStatement"_ustr);
OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const OUString& sql)
:OStatement_BASE2(_pConnection)
@@ -69,12 +59,12 @@ OPreparedStatement::~OPreparedStatement()
{
}
-void SAL_CALL OPreparedStatement::acquire() throw()
+void SAL_CALL OPreparedStatement::acquire() noexcept
{
OStatement_BASE2::acquire();
}
-void SAL_CALL OPreparedStatement::release() throw()
+void SAL_CALL OPreparedStatement::release() noexcept
{
OStatement_BASE2::release();
}
@@ -93,6 +83,11 @@ css::uno::Sequence< css::uno::Type > SAL_CALL OPreparedStatement::getTypes( )
Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( )
{
+ return getMetaDataImpl();
+}
+
+const rtl::Reference< OResultSetMetaData > & OPreparedStatement::getMetaDataImpl()
+{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -149,7 +144,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( )
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
try
{
- SQLRETURN nReturn = N3SQLExecute(m_aStatementHandle);
+ SQLRETURN nReturn = functions().Execute(m_aStatementHandle);
OTools::ThrowException(m_pConnection.get(),nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
bool needData = nReturn == SQL_NEED_DATA;
@@ -163,7 +158,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( )
// Get the parameter number that requires data
sal_Int32* paramIndex = nullptr;
- N3SQLParamData(m_aStatementHandle, reinterpret_cast<SQLPOINTER*>(&paramIndex));
+ functions().ParamData(m_aStatementHandle, reinterpret_cast<SQLPOINTER*>(&paramIndex));
// If the parameter index is -1, there is no
// more data required
@@ -227,7 +222,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
@@ -236,7 +231,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- Reference< XResultSet > rs;
+ rtl::Reference< OResultSet > rs;
prepareStatement();
@@ -316,36 +311,21 @@ void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_
*
* Our internal OUString storage is always UTF-16, so no conversion to do here.
*/
- static_assert(sizeof (SQLWCHAR) == 2 || sizeof (SQLWCHAR) == 4, "must be 2 or 4");
- if (sizeof (SQLWCHAR) == 2)
- {
- nCharLen = _sData.getLength();
- nByteLen = 2 * nCharLen;
- pData = allocBindBuf(parameterIndex, nByteLen);
- memcpy(pData, _sData.getStr(), nByteLen);
- }
- else
- {
- pData = allocBindBuf(parameterIndex, _sData.getLength() * 4);
- sal_uInt32* pCursor = static_cast<sal_uInt32*>(pData);
- nCharLen = 0;
- for (sal_Int32 i = 0; i != _sData.getLength();)
- {
- *pCursor++ = _sData.iterateCodePoints(&i);
- nCharLen += 1;
- }
- nByteLen = 4 * nCharLen;
- }
+ SQLWChars data(_sData);
+ nCharLen = data.cch();
+ nByteLen = data.cb();
+ pData = allocBindBuf(parameterIndex, nByteLen);
+ memcpy(pData, data.get(), nByteLen);
}
else
{
assert(getOwnConnection()->getTextEncoding() != RTL_TEXTENCODING_UCS2 &&
getOwnConnection()->getTextEncoding() != RTL_TEXTENCODING_UCS4);
- OString sOData(
- OUStringToOString(_sData, getOwnConnection()->getTextEncoding()));
- nCharLen = nByteLen = sOData.getLength();
+ SQLChars data(_sData, getOwnConnection()->getTextEncoding());
+ nCharLen = data.cch();
+ nByteLen = data.cb();
pData = allocBindBuf(parameterIndex, nByteLen);
- memcpy(pData, sOData.getStr(), nByteLen);
+ memcpy(pData, data.get(), nByteLen);
}
setParameter( parameterIndex, _nType, nCharLen, _nScale, pData, nByteLen, nByteLen );
@@ -369,13 +349,13 @@ void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_
void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_Int32 _nType, const SQLULEN _nColumnSize, const sal_Int32 _nScale, const void* const _pData, const SQLULEN _nDataLen, const SQLLEN _nDataAllocLen)
{
SQLSMALLINT fCType, fSqlType;
- OTools::getBindTypes(bUseWChar, m_pConnection->useOldDateFormat(), OTools::jdbcTypeToOdbc(_nType), fCType, fSqlType);
+ OTools::getBindTypes(m_pConnection->useOldDateFormat(), OTools::jdbcTypeToOdbc(_nType), fCType, fSqlType);
SQLLEN& rDataLen = boundParams[parameterIndex-1].getBindLengthBuffer();
rDataLen = _nDataLen;
SQLRETURN nRetcode;
- nRetcode = (*reinterpret_cast<T3SQLBindParameter>(m_pConnection->getOdbcFunction(ODBC3SQLFunctionId::BindParameter)))(
+ nRetcode = functions().BindParameter(
m_aStatementHandle,
// checkParameterIndex guarantees this is safe
static_cast<SQLUSMALLINT>(parameterIndex),
@@ -491,7 +471,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x
}
catch(SQLException&)
{
- setString(parameterIndex, ORowSetValue(x));
+ setString(parameterIndex, ORowSetValue(x).getString());
}
}
@@ -509,13 +489,12 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, const sal_I
SQLSMALLINT fCType;
SQLSMALLINT fSqlType;
- OTools::getBindTypes( bUseWChar,
- m_pConnection->useOldDateFormat(),
+ OTools::getBindTypes( m_pConnection->useOldDateFormat(),
OTools::jdbcTypeToOdbc(_nType),
fCType,
fSqlType);
- SQLRETURN nReturn = N3SQLBindParameter( m_aStatementHandle,
+ SQLRETURN nReturn = functions().BindParameter( m_aStatementHandle,
static_cast<SQLUSMALLINT>(parameterIndex),
SQL_PARAM_INPUT,
fCType,
@@ -546,13 +525,13 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setArray", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setArray"_ustr, *this );
}
void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XParameters::setRef", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setRef"_ustr, *this );
}
void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale )
@@ -582,10 +561,21 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
case DataType::NUMERIC:
if(x.hasValue())
{
+ // NB: sqlType and scale are not to be sent to the database, but to be used here.
+ // XParameters::setObjectWithInfo is required to convert the given object to the
+ // required type before being sent to the database; and scale may be needed for
+ // that conversion. But here we convert any object to a decimal string; and ODBC
+ // (or at least some drivers - see tdf#162219) needs DecimalDigits value passed
+ // to SQLBindParameter equal to the number of decimals in the string, otherwise
+ // the conversion from string to decimal fails. It may be not equal to the scale
+ // of the target parameter; ODBC driver handles that. Therefore, here we ignore
+ // the originally passed value of scale.
ORowSetValue aValue;
aValue.fill(x);
- // TODO: make sure that this calls the string overload
- setParameter(parameterIndex, sqlType, scale, aValue);
+ OUString number(aValue.getString());
+ sal_Int32 nIndex = number.indexOf('.');
+ sal_Int32 decimals = nIndex < 0 ? 0 : (number.getLength() - nIndex - 1);
+ setParameter(parameterIndex, sqlType, decimals, number);
}
else
setNull(parameterIndex,sqlType);
@@ -642,13 +632,13 @@ void SAL_CALL OPreparedStatement::clearParameters( )
::osl::MutexGuard aGuard( m_aMutex );
prepareStatement();
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLFreeStmt (m_aStatementHandle, SQL_RESET_PARAMS);
- N3SQLFreeStmt (m_aStatementHandle, SQL_UNBIND);
+ functions().FreeStmt (m_aStatementHandle, SQL_RESET_PARAMS);
+ functions().FreeStmt (m_aStatementHandle, SQL_UNBIND);
}
void SAL_CALL OPreparedStatement::clearBatch( )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XPreparedBatchExecution::clearBatch", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XPreparedBatchExecution::clearBatch"_ustr, *this );
// clearParameters( );
// m_aBatchVector.erase();
}
@@ -656,18 +646,14 @@ void SAL_CALL OPreparedStatement::clearBatch( )
void SAL_CALL OPreparedStatement::addBatch( )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XPreparedBatchExecution::addBatch", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XPreparedBatchExecution::addBatch"_ustr, *this );
}
-
Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XPreparedBatchExecution::executeBatch", *this );
- // not reached, but keep -Werror happy
- return Sequence< sal_Int32 > ();
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XPreparedBatchExecution::executeBatch"_ustr, *this );
}
-
// methods
@@ -680,7 +666,7 @@ void OPreparedStatement::initBoundParam ()
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
// Get the number of parameters
numParams = 0;
- N3SQLNumParams (m_aStatementHandle,&numParams);
+ functions().NumParams (m_aStatementHandle,&numParams);
// There are parameter markers, allocate the bound
// parameter objects
@@ -779,7 +765,7 @@ void OPreparedStatement::putParamData (sal_Int32 index)
// Put the data
OSL_ENSURE( m_aStatementHandle, "OPreparedStatement::putParamData: StatementHandle is null!" );
- N3SQLPutData ( m_aStatementHandle, buf.getArray(), buf.getLength() );
+ functions().PutData ( m_aStatementHandle, buf.getArray(), buf.getLength() );
// decrement the number of bytes still needed
maxBytesLeft -= haveRead;
@@ -826,11 +812,11 @@ void OPreparedStatement::setStream(
*lenBuf = SQL_LEN_DATA_AT_EXEC (length);
SQLSMALLINT fCType, fSqlType;
- OTools::getBindTypes(bUseWChar, m_pConnection->useOldDateFormat(), OTools::jdbcTypeToOdbc(_nType), fCType, fSqlType);
+ OTools::getBindTypes(m_pConnection->useOldDateFormat(), OTools::jdbcTypeToOdbc(_nType), fCType, fSqlType);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLBindParameter(m_aStatementHandle,
+ functions().BindParameter(m_aStatementHandle,
static_cast<SQLUSMALLINT>(ParameterIndex),
SQL_PARAM_INPUT,
fCType,
@@ -889,8 +875,17 @@ void OPreparedStatement::prepareStatement()
if(!isPrepared())
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- OString aSql(OUStringToOString(m_sSqlStatement,getOwnConnection()->getTextEncoding()));
- SQLRETURN nReturn = N3SQLPrepare(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aSql.getStr())), aSql.getLength());
+ SQLRETURN nReturn;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::PrepareW))
+ {
+ SQLWChars aSql(m_sSqlStatement);
+ nReturn = functions().PrepareW(m_aStatementHandle, aSql.get(), aSql.cch());
+ }
+ else
+ {
+ SQLChars aSql(m_sSqlStatement, getOwnConnection()->getTextEncoding());
+ nReturn = functions().Prepare(m_aStatementHandle, aSql.get(), aSql.cch());
+ }
OTools::ThrowException(m_pConnection.get(),nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
m_bPrepared = true;
initBoundParam();
@@ -910,14 +905,14 @@ void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
));
SQLException aNext(sError,*this, OUString(),0,Any());
- ::dbtools::throwInvalidIndexException(*this,makeAny(aNext));
+ ::dbtools::throwInvalidIndexException(*this,Any(aNext));
}
}
-OResultSet* OPreparedStatement::createResulSet()
+rtl::Reference<OResultSet> OPreparedStatement::createResultSet()
{
- OResultSet* pReturn = new OResultSet(m_aStatementHandle,this);
- pReturn->setMetaData(getMetaData());
+ rtl::Reference<OResultSet> pReturn = new OResultSet(m_aStatementHandle,this);
+ pReturn->setMetaData(getMetaDataImpl());
return pReturn;
}
diff --git a/connectivity/source/drivers/odbc/ORealDriver.cxx b/connectivity/source/drivers/odbc/ORealDriver.cxx
deleted file mode 100644
index 28c054b45f7c..000000000000
--- a/connectivity/source/drivers/odbc/ORealDriver.cxx
+++ /dev/null
@@ -1,291 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <odbc/ODriver.hxx>
-#include <odbc/OTools.hxx>
-#include <odbc/OFunctions.hxx>
-
-namespace connectivity::odbc
-{
- namespace {
-
- class ORealOdbcDriver : public ODBCDriver
- {
- protected:
- virtual oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const override;
- virtual SQLHANDLE EnvironmentHandle(OUString &_rPath) override;
- public:
- explicit ORealOdbcDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) : ODBCDriver(_rxContext) {}
- };
-
- }
-
-oslGenericFunction ORealOdbcDriver::getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
-{
- oslGenericFunction pFunction = nullptr;
- switch(_nIndex)
- {
- case ODBC3SQLFunctionId::AllocHandle:
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLAllocHandle);
- break;
- case ODBC3SQLFunctionId::Connect:
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLConnect);
- break;
- case ODBC3SQLFunctionId::DriverConnect:
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLDriverConnect);
- break;
- case ODBC3SQLFunctionId::BrowseConnect:
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLBrowseConnect);
- break;
- case ODBC3SQLFunctionId::DataSources:
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLDataSources);
- break;
- case ODBC3SQLFunctionId::Drivers:
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLDrivers);
- break;
- case ODBC3SQLFunctionId::GetInfo:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetInfo);
- break;
- case ODBC3SQLFunctionId::GetFunctions:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetFunctions);
- break;
- case ODBC3SQLFunctionId::GetTypeInfo:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetTypeInfo);
- break;
- case ODBC3SQLFunctionId::SetConnectAttr:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLSetConnectAttr);
- break;
- case ODBC3SQLFunctionId::GetConnectAttr:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetConnectAttr);
- break;
- case ODBC3SQLFunctionId::SetEnvAttr:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLSetEnvAttr);
- break;
- case ODBC3SQLFunctionId::GetEnvAttr:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetEnvAttr);
- break;
- case ODBC3SQLFunctionId::SetStmtAttr:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLSetStmtAttr);
- break;
- case ODBC3SQLFunctionId::GetStmtAttr:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetStmtAttr);
- break;
- case ODBC3SQLFunctionId::Prepare:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLPrepare);
- break;
- case ODBC3SQLFunctionId::BindParameter:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLBindParameter);
- break;
- case ODBC3SQLFunctionId::SetCursorName:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLSetCursorName);
- break;
- case ODBC3SQLFunctionId::Execute:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLExecute);
- break;
- case ODBC3SQLFunctionId::ExecDirect:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLExecDirect);
- break;
- case ODBC3SQLFunctionId::DescribeParam:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLDescribeParam);
- break;
- case ODBC3SQLFunctionId::NumParams:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLNumParams);
- break;
- case ODBC3SQLFunctionId::ParamData:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLParamData);
- break;
- case ODBC3SQLFunctionId::PutData:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLPutData);
- break;
- case ODBC3SQLFunctionId::RowCount:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLRowCount);
- break;
- case ODBC3SQLFunctionId::NumResultCols:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLNumResultCols);
- break;
- case ODBC3SQLFunctionId::DescribeCol:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLDescribeCol);
- break;
- case ODBC3SQLFunctionId::ColAttribute:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLColAttribute);
- break;
- case ODBC3SQLFunctionId::BindCol:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLBindCol);
- break;
- case ODBC3SQLFunctionId::Fetch:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLFetch);
- break;
- case ODBC3SQLFunctionId::FetchScroll:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLFetchScroll);
- break;
- case ODBC3SQLFunctionId::GetData:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetData);
- break;
- case ODBC3SQLFunctionId::SetPos:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLSetPos);
- break;
- case ODBC3SQLFunctionId::BulkOperations:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLBulkOperations);
- break;
- case ODBC3SQLFunctionId::MoreResults:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLMoreResults);
- break;
- case ODBC3SQLFunctionId::GetDiagRec:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetDiagRec);
- break;
- case ODBC3SQLFunctionId::ColumnPrivileges:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLColumnPrivileges);
- break;
- case ODBC3SQLFunctionId::Columns:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLColumns);
- break;
- case ODBC3SQLFunctionId::ForeignKeys:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLForeignKeys);
- break;
- case ODBC3SQLFunctionId::PrimaryKeys:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLPrimaryKeys);
- break;
- case ODBC3SQLFunctionId::ProcedureColumns:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLProcedureColumns);
- break;
- case ODBC3SQLFunctionId::Procedures:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLProcedures);
- break;
- case ODBC3SQLFunctionId::SpecialColumns:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLSpecialColumns);
- break;
- case ODBC3SQLFunctionId::Statistics:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLStatistics);
- break;
- case ODBC3SQLFunctionId::TablePrivileges:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLTablePrivileges);
- break;
- case ODBC3SQLFunctionId::Tables:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLTables);
- break;
- case ODBC3SQLFunctionId::FreeStmt:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLFreeStmt);
- break;
- case ODBC3SQLFunctionId::CloseCursor:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLCloseCursor);
- break;
- case ODBC3SQLFunctionId::Cancel:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLCancel);
- break;
- case ODBC3SQLFunctionId::EndTran:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLEndTran);
- break;
- case ODBC3SQLFunctionId::Disconnect:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLDisconnect);
- break;
- case ODBC3SQLFunctionId::FreeHandle:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLFreeHandle);
- break;
- case ODBC3SQLFunctionId::GetCursorName:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLGetCursorName);
- break;
- case ODBC3SQLFunctionId::NativeSql:
-
- pFunction = reinterpret_cast<oslGenericFunction>(pODBC3SQLNativeSql);
- break;
- default:
- OSL_FAIL("Function unknown!");
- }
- return pFunction;
-}
-
-
-// ODBC Environment (common for all Connections):
-SQLHANDLE ORealOdbcDriver::EnvironmentHandle(OUString &_rPath)
-{
- // Is (for this instance) already an Environment made?
- if (!m_pDriverHandle)
- {
- SQLHANDLE h = SQL_NULL_HANDLE;
- // allocate Environment
-
- // load ODBC-DLL now:
- if (!LoadLibrary_ODBC3(_rPath) || N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS)
- return SQL_NULL_HANDLE;
-
- // Save in global Structure
- m_pDriverHandle = h;
- N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION, reinterpret_cast<SQLPOINTER>(SQL_OV_ODBC3), SQL_IS_UINTEGER);
- //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER);
- }
-
- return m_pDriverHandle;
-}
-
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
-connectivity_odbc_ORealOdbcDriver_get_implementation(
- css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
-{
- return cppu::acquire(new connectivity::odbc::ORealOdbcDriver(context));
-}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index 8081e3d80192..1603f4396749 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -31,6 +31,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/types.hxx>
+#include <comphelper/scopeguard.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbexception.hxx>
#include <o3tl/safeint.hxx>
@@ -55,21 +56,87 @@ static_assert(ODBC_SQL_NOT_DEFINED != SQL_UB_ON, "ODBC_SQL_NOT_DEFINED must be u
static_assert(ODBC_SQL_NOT_DEFINED != SQL_UB_FIXED, "ODBC_SQL_NOT_DEFINED must be unique");
static_assert(ODBC_SQL_NOT_DEFINED != SQL_UB_VARIABLE, "ODBC_SQL_NOT_DEFINED must be unique");
+class connectivity::odbc::BindData
+{
+public:
+ virtual void* data() = 0;
+ virtual SQLLEN len() const = 0;
+
+ virtual ~BindData() {}
+};
+
namespace
{
- const SQLLEN nMaxBookmarkLen = 20;
-}
+const SQLLEN nMaxBookmarkLen = 20;
+
+template <typename T> class SimpleBindData : public connectivity::odbc::BindData
+{
+public:
+ SimpleBindData(const void* p)
+ : value(*static_cast<const T*>(p))
+ {
+ }
+ void* data() override { return &value; }
+ SQLLEN len() const override { return sizeof(T); }
+
+private:
+ T value;
+};
+
+template <class CHARS_t> class CharsBindData : public connectivity::odbc::BindData
+{
+public:
+ template <typename... Args>
+ CharsBindData(const void* p, Args... args)
+ : value(*static_cast<const OUString*>(p), args...)
+ {
+ }
+ template <class S> requires std::is_class_v<S>
+ CharsBindData(const S& val)
+ : value(val)
+ {
+ }
+ void* data() override { return value.get(); }
+ SQLLEN len() const override { return SQL_NTS; } // input data needs to tell it's null-terminated
+
+private:
+ CHARS_t value;
+};
+
+class NullBindData : public connectivity::odbc::BindData
+{
+public:
+ void* data() override { return &value; }
+ SQLLEN len() const override { return SQL_NULL_DATA; }
+
+private:
+ char value[2] = {};
+};
+class BinaryBindData : public connectivity::odbc::BindData
+{
+public:
+ BinaryBindData(const void* p)
+ : value(*static_cast<const css::uno::Sequence<sal_Int8>*>(p))
+ {
+ }
+ void* data() override { return const_cast<sal_Int8*>(value.getConstArray()); }
+ SQLLEN len() const override { return value.getLength(); }
+
+private:
+ css::uno::Sequence<sal_Int8> value; // ref-counted CoW
+};
+}
// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
OUString SAL_CALL OResultSet::getImplementationName( )
{
- return "com.sun.star.sdbcx.odbc.ResultSet";
+ return u"com.sun.star.sdbcx.odbc.ResultSet"_ustr;
}
Sequence< OUString > SAL_CALL OResultSet::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
+ return { u"com.sun.star.sdbc.ResultSet"_ustr, u"com.sun.star.sdbcx.ResultSet"_ustr };
}
sal_Bool SAL_CALL OResultSet::supportsService( const OUString& _rServiceName )
@@ -142,10 +209,10 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
// We use SQLFetchScroll unconditionally in several places
// the *only* difference this makes is whether ::next() uses SQLFetchScroll or SQLFetch
// so this test seems pointless
- if ( getOdbcFunction(ODBC3SQLFunctionId::GetFunctions) )
+ if (functions().has(ODBC3SQLFunctionId::GetFunctions))
{
SQLUSMALLINT nSupported = 0;
- m_bUseFetchScroll = ( N3SQLGetFunctions(m_aConnectionHandle,SQL_API_SQLFETCHSCROLL,&nSupported) == SQL_SUCCESS && nSupported == 1 );
+ m_bUseFetchScroll = ( functions().GetFunctions(m_aConnectionHandle,SQL_API_SQLFETCHSCROLL,&nSupported) == SQL_SUCCESS && nSupported == 1 );
}
}
catch(const Exception&)
@@ -169,7 +236,7 @@ void OResultSet::construct()
void OResultSet::disposing()
{
- N3SQLCloseCursor(m_aStatementHandle);
+ functions().CloseCursor(m_aStatementHandle);
OPropertySetHelper::disposing();
::osl::MutexGuard aGuard(m_aMutex);
@@ -180,135 +247,17 @@ void OResultSet::disposing()
m_xMetaData.clear();
}
+// See OResultSet::updateValue
SQLRETURN OResultSet::unbind(bool _bUnbindHandle)
{
SQLRETURN nRet = 0;
if ( _bUnbindHandle )
- nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND);
+ nRet = functions().FreeStmt(m_aStatementHandle,SQL_UNBIND);
- if ( !m_aBindVector.empty() )
- {
- for(auto& [rPtrAddr, rType] : m_aBindVector)
- {
- switch (rType)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- delete static_cast< OString* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::BIGINT:
- delete static_cast< sal_Int64* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- delete static_cast< OString* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::REAL:
- case DataType::DOUBLE:
- delete static_cast< double* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- delete [] static_cast< char* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- delete [] static_cast< char* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::DATE:
- delete static_cast< DATE_STRUCT* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::TIME:
- delete static_cast< TIME_STRUCT* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::TIMESTAMP:
- delete static_cast< TIMESTAMP_STRUCT* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::BIT:
- case DataType::TINYINT:
- delete static_cast< sal_Int8* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::SMALLINT:
- delete static_cast< sal_Int16* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::INTEGER:
- delete static_cast< sal_Int32* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::FLOAT:
- delete static_cast< float* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- delete static_cast< sal_Int8* >(reinterpret_cast< void * >(rPtrAddr));
- break;
- }
- }
- m_aBindVector.clear();
- }
+ m_aBindVector.clear();
return nRet;
}
-TVoidPtr OResultSet::allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex)
-{
- TVoidPtr aPair;
- switch (_nType)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new OString()),_nType);
- break;
- case DataType::BIGINT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int64(0)),_nType);
- break;
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new OString()),_nType);
- break;
- case DataType::REAL:
- case DataType::DOUBLE:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new double(0.0)),_nType);
- break;
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new char[2]),_nType); // only for finding
- break;
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new char[2]),_nType); // only for finding
- break;
- case DataType::DATE:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new DATE_STRUCT),_nType);
- break;
- case DataType::TIME:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new TIME_STRUCT),_nType);
- break;
- case DataType::TIMESTAMP:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new TIMESTAMP_STRUCT),_nType);
- break;
- case DataType::BIT:
- case DataType::TINYINT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int8(0)),_nType);
- break;
- case DataType::SMALLINT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int16(0)),_nType);
- break;
- case DataType::INTEGER:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int32(0)),_nType);
- break;
- case DataType::FLOAT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new float(0)),_nType);
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int8[m_aRow[_nColumnIndex].getSequence().getLength()]),_nType);
- break;
- default:
- SAL_WARN( "connectivity.odbc", "Unknown type");
- aPair = TVoidPtr(0,_nType);
- }
- return aPair;
-}
-
void OResultSet::allocBuffer()
{
Reference< XResultSetMetaData > xMeta = getMetaData();
@@ -369,8 +318,6 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName )
}
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
- return 0; // Never reached
}
void OResultSet::ensureCacheForColumn(sal_Int32 columnIndex)
@@ -407,9 +354,7 @@ Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*colu
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBinaryStream", *this );
-
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBinaryStream"_ustr, *this );
}
Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ )
@@ -417,9 +362,7 @@ Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*c
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBinaryStream", *this );
-
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBinaryStream"_ustr, *this );
}
template < typename T > T OResultSet::impl_getValue( const sal_Int32 _nColumnIndex, SQLSMALLINT nType )
@@ -443,8 +386,33 @@ template < typename T > T OResultSet::getValue( sal_Int32 columnIndex )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
fillColumn(columnIndex);
m_bWasNull = m_aRow[columnIndex].isNull();
- return m_aRow[columnIndex];
+ auto const & row = m_aRow[columnIndex];
+ if constexpr ( std::is_same_v<css::util::Time, T> )
+ return row.getTime();
+ else if constexpr ( std::is_same_v<css::util::DateTime, T> )
+ return row.getDateTime();
+ else if constexpr ( std::is_same_v<css::util::Date, T> )
+ return row.getDate();
+ else if constexpr ( std::is_same_v<OUString, T> )
+ return row.getString();
+ else if constexpr ( std::is_same_v<sal_Int64, T> )
+ return row.getLong();
+ else if constexpr ( std::is_same_v<sal_Int32, T> )
+ return row.getInt32();
+ else if constexpr ( std::is_same_v<sal_Int16, T> )
+ return row.getInt16();
+ else if constexpr ( std::is_same_v<sal_Int8, T> )
+ return row.getInt8();
+ else if constexpr ( std::is_same_v<float, T> )
+ return row.getFloat();
+ else if constexpr ( std::is_same_v<double, T> )
+ return row.getDouble();
+ else if constexpr ( std::is_same_v<bool, T> )
+ return row.getBool();
+ else
+ return row;
}
+
sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex )
{
return getValue<bool>( columnIndex );
@@ -469,11 +437,11 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex )
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- nRet = m_aRow[columnIndex];
+ nRet = m_aRow[columnIndex].getSequence();
break;
default:
{
- OUString const & sRet = m_aRow[columnIndex].getString();
+ OUString const sRet = m_aRow[columnIndex].getString();
nRet = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength());
}
}
@@ -492,7 +460,7 @@ Sequence< sal_Int8 > OResultSet::impl_getBytes( sal_Int32 columnIndex )
case SQL_CHAR:
case SQL_LONGVARCHAR:
{
- OUString const & aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding);
+ OUString const aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding);
return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength());
}
default:
@@ -572,31 +540,24 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( )
Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getArray", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getArray"_ustr, *this );
}
-
Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getClob", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getClob"_ustr, *this );
}
Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBlob", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getBlob"_ustr, *this );
}
-
Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getRef", *this );
- return nullptr;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRow::getRef"_ustr, *this );
}
-
Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& /*typeMap*/ )
{
return getValue<ORowSetValue>( columnIndex ).makeAny();
@@ -796,7 +757,7 @@ void SAL_CALL OResultSet::cancel( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- N3SQLCancel(m_aStatementHandle);
+ functions().Cancel(m_aStatementHandle);
}
void SAL_CALL OResultSet::clearWarnings( )
@@ -818,7 +779,7 @@ void SAL_CALL OResultSet::insertRow( )
Sequence<sal_Int8> aBookmark(nMaxBookmarkLen);
static_assert(o3tl::make_unsigned(nMaxBookmarkLen) >= sizeof(SQLLEN), "must be larger");
- SQLRETURN nRet = N3SQLBindCol(m_aStatementHandle,
+ SQLRETURN nRet = functions().BindCol(m_aStatementHandle,
0,
SQL_C_VARBOOKMARK,
aBookmark.getArray(),
@@ -826,47 +787,38 @@ void SAL_CALL OResultSet::insertRow( )
&nRealLen
);
- bool bPositionByBookmark = ( nullptr != getOdbcFunction( ODBC3SQLFunctionId::BulkOperations ) );
+ bool bPositionByBookmark = functions().has(ODBC3SQLFunctionId::BulkOperations);
if ( bPositionByBookmark )
{
- nRet = N3SQLBulkOperations( m_aStatementHandle, SQL_ADD );
+ nRet = functions().BulkOperations( m_aStatementHandle, SQL_ADD );
fillNeededData( nRet );
}
else
{
if(isBeforeFirst())
next(); // must be done
- nRet = N3SQLSetPos( m_aStatementHandle, 1, SQL_ADD, SQL_LOCK_NO_CHANGE );
+ nRet = functions().SetPos( m_aStatementHandle, 1, SQL_ADD, SQL_LOCK_NO_CHANGE );
fillNeededData( nRet );
}
aBookmark.realloc(nRealLen);
- try
- {
- OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- }
- catch(const SQLException&)
- {
- nRet = unbind();
- throw;
- }
-
- nRet = unbind();
+ SQLRETURN nRet2 = unbind();
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ OTools::ThrowException(m_pStatement->getOwnConnection(),nRet2,m_aStatementHandle,SQL_HANDLE_STMT,*this);
if ( bPositionByBookmark )
{
setStmtOption<SQLLEN*, SQL_IS_POINTER>(SQL_ATTR_FETCH_BOOKMARK_PTR, reinterpret_cast<SQLLEN*>(aBookmark.getArray()));
- nRet = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
+ nRet = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
}
else
- nRet = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); // OJ 06.03.2004
+ nRet = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); // OJ 06.03.2004
// sometimes we got an error but we are not interested in anymore #106047# OJ
// OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
if(m_pSkipDeletedSet)
{
- if(moveToBookmark(makeAny(aBookmark)))
+ if(moveToBookmark(Any(aBookmark)))
{
sal_Int32 nRowPos = getDriverPos();
if ( -1 == m_nRowPos )
@@ -893,14 +845,16 @@ void SAL_CALL OResultSet::updateRow( )
try
{
- bool bPositionByBookmark = ( nullptr != getOdbcFunction( ODBC3SQLFunctionId::BulkOperations ) );
+ /* tdf#148367 this block is commented out, because SQLBulkOperations fails
+ with Access ODBC 64-bit drivers on Windows
+ bool bPositionByBookmark = functions().has(ODBC3SQLFunctionId::BulkOperations);
if ( bPositionByBookmark )
{
getBookmark();
assert(m_aRow[0].isBound());
Sequence<sal_Int8> aBookmark(m_aRow[0].getSequence());
SQLLEN nRealLen = aBookmark.getLength();
- nRet = N3SQLBindCol(m_aStatementHandle,
+ nRet = functions().BindCol(m_aStatementHandle,
0,
SQL_C_VARBOOKMARK,
aBookmark.getArray(),
@@ -908,15 +862,15 @@ void SAL_CALL OResultSet::updateRow( )
&nRealLen
);
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_UPDATE_BY_BOOKMARK);
+ nRet = functions().BulkOperations(m_aStatementHandle, SQL_UPDATE_BY_BOOKMARK);
fillNeededData(nRet);
// the driver should not have touched this
// (neither the contents of aBookmark FWIW)
assert(nRealLen == aBookmark.getLength());
}
- else
+ else */
{
- nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
+ nRet = functions().SetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
fillNeededData(nRet);
}
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
@@ -940,7 +894,7 @@ void SAL_CALL OResultSet::deleteRow( )
{
SQLRETURN nRet = SQL_SUCCESS;
sal_Int32 nPos = getDriverPos();
- nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_DELETE,SQL_LOCK_NO_CHANGE);
+ nRet = functions().SetPos(m_aStatementHandle,1,SQL_DELETE,SQL_LOCK_NO_CHANGE);
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
m_bRowDeleted = ( m_pRowStatusArray[0] == SQL_ROW_DELETED );
@@ -970,7 +924,7 @@ void SAL_CALL OResultSet::moveToInsertRow( )
invalidateCache();
// first unbound all columns
OSL_VERIFY( unbind() == SQL_SUCCESS );
- // SQLRETURN nRet = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE ,(SQLPOINTER)1,SQL_IS_INTEGER);
+ // SQLRETURN nRet = functions().SetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE ,(SQLPOINTER)1,SQL_IS_INTEGER);
}
@@ -984,30 +938,115 @@ void OResultSet::updateValue(sal_Int32 columnIndex, SQLSMALLINT _nType, void con
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- m_aBindVector.push_back(allocBindColumn(OTools::MapOdbcType2Jdbc(_nType),columnIndex));
- void* pData = reinterpret_cast<void*>(m_aBindVector.rbegin()->first);
- OSL_ENSURE(pData != nullptr,"Data for update is NULL!");
- OTools::bindValue( m_pStatement->getOwnConnection(),
- m_aStatementHandle,
- columnIndex,
- _nType,
- 0,
- _pValue,
- pData,
- &m_aLengthVector[columnIndex],
- **this,
- m_nTextEncoding,
- m_pStatement->getOwnConnection()->useOldDateFormat());
+ SQLSMALLINT fCType, dummy;
+ OTools::getBindTypes(m_pStatement->getOwnConnection()->useOldDateFormat(), _nType, fCType,
+ dummy);
+
+ SQLLEN* const pLen = &m_aLengthVector[columnIndex];
+ *pLen = 0;
+ std::unique_ptr<BindData> bindData;
+ void* pData = nullptr;
+
+ if (columnIndex != 0 && !_pValue)
+ {
+ bindData = std::make_unique<NullBindData>();
+ }
+ else
+ {
+ assert(_pValue);
+
+ switch (_nType)
+ {
+ case SQL_CHAR:
+ case SQL_VARCHAR:
+ case SQL_WCHAR:
+ case SQL_WVARCHAR:
+ if (fCType == SQL_C_CHAR)
+ bindData = std::make_unique<CharsBindData<SQLChars>>(_pValue, m_nTextEncoding);
+ else
+ bindData = std::make_unique<CharsBindData<SQLWChars>>(_pValue);
+ break;
+ case SQL_DECIMAL:
+ case SQL_NUMERIC:
+ if (fCType == SQL_C_CHAR)
+ bindData = std::make_unique<CharsBindData<SQLChars>>(
+ OString::number(*static_cast<const double*>(_pValue)));
+ else
+ bindData = std::make_unique<CharsBindData<SQLWChars>>(
+ OUString::number(*static_cast<const double*>(_pValue)));
+ break;
+ case SQL_BIT:
+ case SQL_TINYINT:
+ bindData = std::make_unique<SimpleBindData<sal_Int8>>(_pValue);
+ break;
+ case SQL_SMALLINT:
+ bindData = std::make_unique<SimpleBindData<sal_Int16>>(_pValue);
+ break;
+ case SQL_INTEGER:
+ bindData = std::make_unique<SimpleBindData<sal_Int32>>(_pValue);
+ break;
+ case SQL_BIGINT:
+ bindData = std::make_unique<SimpleBindData<sal_Int64>>(_pValue);
+ break;
+ case SQL_FLOAT:
+ bindData = std::make_unique<SimpleBindData<float>>(_pValue);
+ break;
+ case SQL_REAL:
+ case SQL_DOUBLE:
+ bindData = std::make_unique<SimpleBindData<double>>(_pValue);
+ break;
+ case SQL_BINARY:
+ case SQL_VARBINARY:
+ bindData = std::make_unique<BinaryBindData>(_pValue);
+ break;
+ case SQL_LONGVARBINARY:
+ {
+ /* see https://msdn.microsoft.com/en-us/library/ms716238%28v=vs.85%29.aspx
+ * for an explanation of that apparently weird cast */
+ pData = reinterpret_cast<void*>(static_cast<sal_uIntPtr>(columnIndex));
+ sal_Int32 nLen
+ = static_cast<const css::uno::Sequence<sal_Int8>*>(_pValue)->getLength();
+ *pLen = SQL_LEN_DATA_AT_EXEC(nLen);
+ }
+ break;
+ case SQL_LONGVARCHAR:
+ case SQL_WLONGVARCHAR:
+ {
+ /* see https://msdn.microsoft.com/en-us/library/ms716238%28v=vs.85%29.aspx
+ * for an explanation of that apparently weird cast */
+ pData = reinterpret_cast<void*>(static_cast<sal_uIntPtr>(columnIndex));
+ sal_Int32 nLen = static_cast<const OUString*>(_pValue)->getLength();
+ *pLen = SQL_LEN_DATA_AT_EXEC(nLen);
+ }
+ break;
+ case SQL_DATE:
+ bindData = std::make_unique<SimpleBindData<DATE_STRUCT>>(_pValue);
+ break;
+ case SQL_TIME:
+ bindData = std::make_unique<SimpleBindData<TIME_STRUCT>>(_pValue);
+ break;
+ case SQL_TIMESTAMP:
+ bindData = std::make_unique<SimpleBindData<TIMESTAMP_STRUCT>>(_pValue);
+ break;
+ }
+ }
+
+ if (bindData)
+ {
+ pData = bindData->data();
+ *pLen = bindData->len();
+ m_aBindVector.push_back(std::move(bindData));
+ }
+
+ SQLRETURN nRetcode
+ = functions().BindCol(m_aStatementHandle, columnIndex, fCType, pData, 0, pLen);
+ OTools::ThrowException(m_pStatement->getOwnConnection(), nRetcode, m_aStatementHandle,
+ SQL_HANDLE_STMT, **this);
}
void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_aBindVector.push_back(allocBindColumn(DataType::CHAR,columnIndex));
- void* pData = reinterpret_cast<void*>(m_aBindVector.rbegin()->first);
- OTools::bindValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,SQL_CHAR,0,nullptr,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding,m_pStatement->getOwnConnection()->useOldDateFormat());
+ updateValue(columnIndex, SQL_CHAR, nullptr);
}
@@ -1034,7 +1073,7 @@ void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x )
void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRowUpdate::updateLong", *this );
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRowUpdate::updateLong"_ustr, *this );
}
void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x )
@@ -1110,8 +1149,8 @@ void SAL_CALL OResultSet::refreshRow( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- // SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE);
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0);
+ // SQLRETURN nRet = functions().SetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0);
OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
}
@@ -1180,7 +1219,7 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark )
if ( SQL_INVALID_HANDLE != nReturn && SQL_ERROR != nReturn )
{
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
TBookmarkPosMap::const_iterator aFind = m_aPosToBookmarks.find(aBookmark);
if(aFind != m_aPosToBookmarks.end())
@@ -1204,7 +1243,7 @@ sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_
bookmark >>= aBookmark;
setStmtOption<SQLLEN*, SQL_IS_POINTER>(SQL_ATTR_FETCH_BOOKMARK_PTR, reinterpret_cast<SQLLEN*>(aBookmark.getArray()));
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,rows);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,rows);
OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
}
@@ -1224,8 +1263,7 @@ sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( )
sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& /*bookmark*/ )
{
- ::dbtools::throwFunctionNotSupportedSQLException( "XRowLocate::hashBookmark", *this );
- return 0;
+ ::dbtools::throwFunctionNotSupportedSQLException( u"XRowLocate::hashBookmark"_ustr, *this );
}
// XDeleteRows
@@ -1259,14 +1297,14 @@ template < typename T, SQLINTEGER BufferLength > T OResultSet::getStmtOption (SQ
{
T result (0);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLGetStmtAttr(m_aStatementHandle, fOption, &result, BufferLength, nullptr);
+ functions().GetStmtAttr(m_aStatementHandle, fOption, &result, BufferLength, nullptr);
return result;
}
template < typename T, SQLINTEGER BufferLength > SQLRETURN OResultSet::setStmtOption (SQLINTEGER fOption, T value) const
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
SQLPOINTER sv = reinterpret_cast<SQLPOINTER>(value);
- return N3SQLSetStmtAttr(m_aStatementHandle, fOption, sv, BufferLength);
+ return functions().SetStmtAttr(m_aStatementHandle, fOption, sv, BufferLength);
}
sal_Int32 OResultSet::getResultSetConcurrency() const
@@ -1309,10 +1347,19 @@ sal_Int32 OResultSet::getFetchSize() const
OUString OResultSet::getCursorName() const
{
- SQLCHAR pName[258];
SQLSMALLINT nRealLen = 0;
- N3SQLGetCursorName(m_aStatementHandle,pName,256,&nRealLen);
- return OUString::createFromAscii(reinterpret_cast<char*>(pName));
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::GetCursorNameW))
+ {
+ SQLWCHAR pName[258]{};
+ functions().GetCursorNameW(m_aStatementHandle, pName, 256, &nRealLen);
+ return toUString(pName, nRealLen);
+ }
+ else
+ {
+ SQLCHAR pName[258]{};
+ functions().GetCursorName(m_aStatementHandle, pName, 256, &nRealLen);
+ return toUString(pName);
+ }
}
bool OResultSet::isBookmarkable() const
@@ -1353,15 +1400,9 @@ bool OResultSet::isBookmarkable() const
return (m_nUseBookmarks != SQL_UB_OFF) && (nAttr & SQL_CA1_BOOKMARK) == SQL_CA1_BOOKMARK;
}
-void OResultSet::setFetchDirection(sal_Int32 _par0)
+void OResultSet::setFetchDirection(sal_Int32 /*_par0*/)
{
- ::dbtools::throwFunctionNotSupportedSQLException( "setFetchDirection", *this );
-
- OSL_ENSURE(_par0>0,"Illegal fetch direction!");
- if ( _par0 > 0 )
- {
- setStmtOption<SQLULEN, SQL_IS_UINTEGER>(SQL_ATTR_CURSOR_TYPE, _par0);
- }
+ ::dbtools::throwFunctionNotSupportedSQLException( u"setFetchDirection"_ustr, *this );
}
void OResultSet::setFetchSize(sal_Int32 _par0)
@@ -1369,7 +1410,7 @@ void OResultSet::setFetchSize(sal_Int32 _par0)
OSL_ENSURE(_par0>0,"Illegal fetch size!");
if ( _par0 != 1 )
{
- throw css::beans::PropertyVetoException("SDBC/ODBC layer not prepared for fetchSize > 1", *this);
+ throw css::beans::PropertyVetoException(u"SDBC/ODBC layer not prepared for fetchSize > 1"_ustr, *this);
}
setStmtOption<SQLULEN, SQL_IS_UINTEGER>(SQL_ATTR_ROW_ARRAY_SIZE, _par0);
m_pRowStatusArray.reset( new SQLUSMALLINT[_par0] );
@@ -1378,28 +1419,47 @@ void OResultSet::setFetchSize(sal_Int32 _par0)
IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
{
- Sequence< Property > aProps(6);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
- PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
+ return new OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
+ PROPERTY_ID_ISBOOKMARKABLE,
+ cppu::UnoType<bool>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY
+ }
+ }
+ };
}
IPropertyArrayHelper & OResultSet::getInfoHelper()
@@ -1599,12 +1659,12 @@ void OResultSet::fillColumn(const sal_Int32 _nColumn)
}
}
-void SAL_CALL OResultSet::acquire() throw()
+void SAL_CALL OResultSet::acquire() noexcept
{
OResultSet_BASE::acquire();
}
-void SAL_CALL OResultSet::release() throw()
+void SAL_CALL OResultSet::release() noexcept
{
OResultSet_BASE::release();
}
@@ -1642,7 +1702,7 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO
TBookmarkPosMap::const_iterator aIter = std::find_if(m_aPosToBookmarks.begin(), m_aPosToBookmarks.end(),
[&_nOffset](const TBookmarkPosMap::value_type& rEntry) { return rEntry.second == _nOffset; });
if (aIter != m_aPosToBookmarks.end())
- return moveToBookmark(makeAny(aIter->first));
+ return moveToBookmark(Any(aIter->first));
SAL_WARN( "connectivity.odbc", "Bookmark not found!");
}
return false;
@@ -1656,9 +1716,9 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO
// _eCursorPosition == IResultSetHelper::NEXT/PREVIOUS
// when fetchSize > 1
if ( !m_bUseFetchScroll && _eCursorPosition == IResultSetHelper::NEXT )
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
+ m_nCurrentFetchState = functions().Fetch(m_aStatementHandle);
else
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,nFetchOrientation,_nOffset);
+ m_nCurrentFetchState = functions().FetchScroll(m_aStatementHandle,nFetchOrientation,_nOffset);
SAL_INFO(
"connectivity.odbc",
@@ -1749,7 +1809,7 @@ void OResultSet::fillNeededData(SQLRETURN _nRet)
return;
void* pColumnIndex = nullptr;
- nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
+ nRet = functions().ParamData(m_aStatementHandle,&pColumnIndex);
do
{
@@ -1764,27 +1824,26 @@ void OResultSet::fillNeededData(SQLRETURN _nRet)
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
case DataType::BLOB:
- aSeq = m_aRow[nColumnIndex];
- N3SQLPutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength());
+ aSeq = m_aRow[nColumnIndex].getSequence();
+ functions().PutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength());
break;
case SQL_WLONGVARCHAR:
{
- OUString const & sRet = m_aRow[nColumnIndex].getString();
- N3SQLPutData (m_aStatementHandle, static_cast<SQLPOINTER>(const_cast<sal_Unicode *>(sRet.getStr())), sizeof(sal_Unicode)*sRet.getLength());
+ SQLWChars data(m_aRow[nColumnIndex].getString());
+ functions().PutData(m_aStatementHandle, data.get(), data.cb());
break;
}
case DataType::LONGVARCHAR:
case DataType::CLOB:
{
- OUString sRet = m_aRow[nColumnIndex].getString();
- OString aString(OUStringToOString(sRet,m_nTextEncoding));
- N3SQLPutData (m_aStatementHandle, static_cast<SQLPOINTER>(const_cast<char *>(aString.getStr())), aString.getLength());
+ SQLChars data(m_aRow[nColumnIndex].getString(), m_nTextEncoding);
+ functions().PutData(m_aStatementHandle, data.get(), data.cb());
break;
}
default:
SAL_WARN( "connectivity.odbc", "Not supported at the moment!");
}
- nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
+ nRet = functions().ParamData(m_aStatementHandle,&pColumnIndex);
}
while (nRet == SQL_NEED_DATA);
}
diff --git a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx
index 21b95c6a7b29..260c2111fbfc 100644
--- a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx
+++ b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx
@@ -22,7 +22,6 @@
using namespace connectivity::odbc;
using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
using namespace com::sun::star::sdbc;
@@ -36,40 +35,77 @@ OUString OResultSetMetaData::getCharColAttrib(sal_Int32 _column,sal_Int32 ident)
if(_column <static_cast<sal_Int32>(m_vMapping.size())) // use mapping
column = m_vMapping[_column];
- SQLSMALLINT BUFFER_LEN = 128;
- std::unique_ptr<char[]> pName(new char[BUFFER_LEN+1]);
- SQLSMALLINT nRealLen=0;
- SQLRETURN nRet = N3SQLColAttribute(m_aStatementHandle,
- static_cast<SQLUSMALLINT>(column),
- static_cast<SQLUSMALLINT>(ident),
- static_cast<SQLPOINTER>(pName.get()),
- BUFFER_LEN,
- &nRealLen,
- nullptr
- );
OUString sValue;
- if ( nRet == SQL_SUCCESS )
+ SQLSMALLINT cbRealLen = 0;
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ColAttributeW))
{
- if ( nRealLen < 0 )
- nRealLen = BUFFER_LEN;
- sValue = OUString(pName.get(),nRealLen,m_pConnection->getTextEncoding());
+ // SQLColAttributeW gets/returns count of bytes, not characters
+ SQLSMALLINT cbBufferLen = 128 * sizeof(SQLWCHAR);
+ auto pName = std::make_unique<SQLWCHAR[]>(cbBufferLen / sizeof(SQLWCHAR) + 1);
+ SQLRETURN nRet = functions().ColAttributeW(m_aStatementHandle,
+ column,
+ ident,
+ pName.get(),
+ cbBufferLen,
+ &cbRealLen,
+ nullptr);
+ OTools::ThrowException(m_pConnection, nRet, m_aStatementHandle, SQL_HANDLE_STMT, *this);
+ if (nRet == SQL_SUCCESS)
+ {
+ if (cbRealLen < 0)
+ cbRealLen = cbBufferLen;
+ sValue = toUString(pName.get(), cbRealLen / sizeof(SQLWCHAR));
+ }
+ if (cbRealLen > cbBufferLen)
+ {
+ cbBufferLen = (cbRealLen + 1) & ~1; // Make sure it's even
+ pName = std::make_unique<SQLWCHAR[]>(cbBufferLen / sizeof(SQLWCHAR) + 1);
+ nRet = functions().ColAttributeW(m_aStatementHandle,
+ column,
+ ident,
+ pName.get(),
+ cbBufferLen,
+ &cbRealLen,
+ nullptr);
+ OTools::ThrowException(m_pConnection, nRet, m_aStatementHandle, SQL_HANDLE_STMT, *this);
+ if (nRet == SQL_SUCCESS && cbRealLen > 0)
+ sValue = toUString(pName.get(), cbRealLen / sizeof(SQLWCHAR));
+ }
}
- pName.reset();
- OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- if(nRealLen > BUFFER_LEN)
+ else
{
- pName.reset(new char[nRealLen+1]);
- nRet = N3SQLColAttribute(m_aStatementHandle,
- static_cast<SQLUSMALLINT>(column),
- static_cast<SQLUSMALLINT>(ident),
- static_cast<SQLPOINTER>(pName.get()),
- nRealLen,
- &nRealLen,
- nullptr
- );
- if ( nRet == SQL_SUCCESS && nRealLen > 0)
- sValue = OUString(pName.get(),nRealLen,m_pConnection->getTextEncoding());
+ SQLSMALLINT BUFFER_LEN = 128;
+ auto pName = std::make_unique<SQLCHAR[]>(BUFFER_LEN + 1);
+ SQLRETURN nRet = functions().ColAttribute(m_aStatementHandle,
+ static_cast<SQLUSMALLINT>(column),
+ static_cast<SQLUSMALLINT>(ident),
+ static_cast<SQLPOINTER>(pName.get()),
+ BUFFER_LEN,
+ &cbRealLen,
+ nullptr
+ );
+ if ( nRet == SQL_SUCCESS )
+ {
+ if ( cbRealLen < 0 )
+ cbRealLen = BUFFER_LEN;
+ sValue = toUString(pName.get(), cbRealLen, m_pConnection->getTextEncoding());
+ }
OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ if(cbRealLen > BUFFER_LEN)
+ {
+ pName = std::make_unique<SQLCHAR[]>(cbRealLen + 1);
+ nRet = functions().ColAttribute(m_aStatementHandle,
+ static_cast<SQLUSMALLINT>(column),
+ static_cast<SQLUSMALLINT>(ident),
+ static_cast<SQLPOINTER>(pName.get()),
+ cbRealLen,
+ &cbRealLen,
+ nullptr
+ );
+ if ( nRet == SQL_SUCCESS && cbRealLen > 0)
+ sValue = toUString(pName.get(), cbRealLen, m_pConnection->getTextEncoding());
+ OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ }
}
return sValue;
@@ -82,7 +118,7 @@ SQLLEN OResultSetMetaData::getNumColAttrib(OConnection const * _pConnection
,sal_Int32 _ident)
{
SQLLEN nValue=0;
- OTools::ThrowException(_pConnection,(*reinterpret_cast<T3SQLColAttribute>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::ColAttribute)))(_aStatementHandle,
+ OTools::ThrowException(_pConnection,_pConnection->functions().ColAttribute(_aStatementHandle,
static_cast<SQLUSMALLINT>(_column),
static_cast<SQLUSMALLINT>(_ident),
nullptr,
@@ -144,11 +180,10 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column )
catch(SQLException& ) // in this case we have an odbc 2.0 driver
{
m_bUseODBC2Types = true;
- nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE ));
}
}
- else
- nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE ));
+ if (m_bUseODBC2Types)
+ nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column, SQL_DESC_CONCISE_TYPE));
aFind = m_aColumnTypes.emplace(column,nType).first;
}
@@ -162,7 +197,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( )
if(m_nColCount != -1)
return m_nColCount;
sal_Int16 nNumResultCols=0;
- OTools::ThrowException(m_pConnection,N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ OTools::ThrowException(m_pConnection,functions().NumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
m_nColCount = nNumResultCols;
return m_nColCount;
}
@@ -231,30 +266,38 @@ sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column )
sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column )
{
sal_Int32 nType = 0;
- try
- {
- nType = getNumColAttrib(column,SQL_DESC_PRECISION);
- }
- catch(const SQLException& ) // in this case we have an odbc 2.0 driver
+ if (!m_bUseODBC2Types)
{
- m_bUseODBC2Types = true;
- nType = getNumColAttrib(column,SQL_COLUMN_PRECISION );
+ try
+ {
+ nType = getNumColAttrib(column, SQL_DESC_PRECISION);
+ }
+ catch (const SQLException&) // in this case we have an odbc 2.0 driver
+ {
+ m_bUseODBC2Types = true;
+ }
}
+ if (m_bUseODBC2Types)
+ nType = getNumColAttrib(column, SQL_COLUMN_PRECISION);
return nType;
}
sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column )
{
sal_Int32 nType = 0;
- try
+ if (!m_bUseODBC2Types)
{
- nType = getNumColAttrib(column,SQL_DESC_SCALE);
- }
- catch(const SQLException& ) // in this case we have an odbc 2.0 driver
- {
- m_bUseODBC2Types = true;
- nType = getNumColAttrib(column,SQL_COLUMN_SCALE );
+ try
+ {
+ nType = getNumColAttrib(column, SQL_DESC_SCALE);
+ }
+ catch (const SQLException&) // in this case we have an odbc 2.0 driver
+ {
+ m_bUseODBC2Types = true;
+ }
}
+ if (m_bUseODBC2Types)
+ nType = getNumColAttrib(column, SQL_COLUMN_SCALE);
return nType;
}
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx
index dc693b964d56..989db77ce462 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -49,9 +49,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
-using namespace com::sun::star::io;
using namespace com::sun::star::util;
OStatement_Base::OStatement_Base(OConnection* _pConnection )
@@ -79,16 +77,18 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection )
OStatement_Base::~OStatement_Base()
{
- OSL_ENSURE(!m_aStatementHandle,"Sohould ne null here!");
+ OSL_ENSURE(!m_aStatementHandle,"Should be null here!");
}
void OStatement_Base::disposeResultSet()
{
// free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
+ rtl::Reference< OResultSet > xComp(m_xResultSet.get());
if (xComp.is())
+ {
xComp->dispose();
- m_xResultSet.clear();
+ m_xResultSet.clear();
+ }
}
void SAL_CALL OStatement_Base::disposing()
@@ -104,7 +104,7 @@ void SAL_CALL OStatement_Base::disposing()
m_pConnection->freeStatementHandle(m_aStatementHandle);
m_pConnection.clear();
}
- OSL_ENSURE(!m_aStatementHandle,"Sohould ne null here!");
+ OSL_ENSURE(!m_aStatementHandle,"Should be null here!");
OStatement_BASE::disposing();
}
@@ -131,9 +131,10 @@ Sequence< Type > SAL_CALL OStatement_Base::getTypes( )
Sequence< Type > aOldTypes = OStatement_BASE::getTypes();
if ( m_pConnection.is() && !m_pConnection->isAutoRetrievingEnabled() )
{
- auto newEnd = std::remove(aOldTypes.begin(), aOldTypes.end(),
+ auto [begin, end] = asNonConstRange(aOldTypes);
+ auto newEnd = std::remove(begin, end,
cppu::UnoType<XGeneratedResultSet>::get());
- aOldTypes.realloc(std::distance(aOldTypes.begin(), newEnd));
+ aOldTypes.realloc(std::distance(begin, newEnd));
}
return ::comphelper::concatSequences(aTypes.getTypes(),aOldTypes);
@@ -162,7 +163,7 @@ void SAL_CALL OStatement_Base::cancel( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLCancel(m_aStatementHandle);
+ functions().Cancel(m_aStatementHandle);
}
@@ -196,7 +197,7 @@ void OStatement_Base::reset()
}
if(m_aStatementHandle)
{
- THROW_SQL(N3SQLFreeStmt(m_aStatementHandle, SQL_CLOSE));
+ THROW_SQL(functions().FreeStmt(m_aStatementHandle, SQL_CLOSE));
}
}
@@ -209,8 +210,7 @@ void OStatement_Base::clearMyResultSet()
try
{
- Reference<XCloseable> xCloseable(
- m_xResultSet.get(), css::uno::UNO_QUERY);
+ rtl::Reference<OResultSet> xCloseable(m_xResultSet.get());
if ( xCloseable.is() )
xCloseable->close();
}
@@ -228,7 +228,7 @@ SQLLEN OStatement_Base::getRowCount()
SQLLEN numRows = 0;
try {
- THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows));
+ THROW_SQL(functions().RowCount(m_aStatementHandle,&numRows));
}
catch (const SQLException&)
{
@@ -300,7 +300,7 @@ sal_Int32 OStatement_Base::getColumnCount()
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
try {
- THROW_SQL(N3SQLNumResultCols(m_aStatementHandle,&numCols));
+ THROW_SQL(functions().NumResultCols(m_aStatementHandle,&numCols));
}
catch (const SQLException&)
{
@@ -315,11 +315,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const OUString& sql )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
m_sSqlStatement = sql;
-
- OString aSql(OUStringToOString(sql,getOwnConnection()->getTextEncoding()));
-
bool hasResultSet = false;
- SQLWarning aWarning;
// Reset the statement handle and warning
@@ -334,17 +330,24 @@ sal_Bool SAL_CALL OStatement_Base::execute( const OUString& sql )
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
try {
- THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aSql.getStr())), aSql.getLength()));
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ExecDirectW))
+ {
+ SQLWChars directSQL(sql);
+ THROW_SQL(functions().ExecDirectW(m_aStatementHandle, directSQL.get(), directSQL.cch()));
+ }
+ else
+ {
+ SQLChars directSQL(sql, getOwnConnection()->getTextEncoding());
+ THROW_SQL(functions().ExecDirect(m_aStatementHandle, directSQL.get(), directSQL.cch()));
+ }
}
- catch (const SQLWarning& ex) {
-
- // Save pointer to warning and save with ResultSet
+ catch (const SQLWarning&)
+ {
+ //TODO: Save pointer to warning and save with ResultSet
// object once it is created.
-
- aWarning = ex;
}
- // Now determine if there is a result set associated with
+ // Now determine if there is a result set associated with
// the SQL statement that was executed. Get the column
// count, and if it is not zero, there is a result set.
@@ -360,7 +363,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const OUString& sql )
// getResultSet returns the current result as a ResultSet. It
// returns NULL if the current result is not a ResultSet.
-Reference< XResultSet > OStatement_Base::getResultSet(bool checkCount)
+rtl::Reference< OResultSet > OStatement_Base::getResultSet(bool checkCount)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -372,7 +375,7 @@ Reference< XResultSet > OStatement_Base::getResultSet(bool checkCount)
::dbtools::throwFunctionSequenceException(*this);
}
- OResultSet* pRs = nullptr;
+ rtl::Reference<OResultSet> pRs;
sal_Int32 numCols = 1;
// If we already know we have result columns, checkCount
@@ -387,7 +390,7 @@ Reference< XResultSet > OStatement_Base::getResultSet(bool checkCount)
if (numCols > 0)
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- pRs = createResulSet();
+ pRs = createResultSet();
pRs->construct();
// Save a copy of our last result set
@@ -408,14 +411,14 @@ template < typename T, SQLINTEGER BufferLength > T OStatement_Base::getStmtOptio
{
T result (0);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLGetStmtAttr(m_aStatementHandle, fOption, &result, BufferLength, nullptr);
+ functions().GetStmtAttr(m_aStatementHandle, fOption, &result, BufferLength, nullptr);
return result;
}
template < typename T, SQLINTEGER BufferLength > SQLRETURN OStatement_Base::setStmtOption (SQLINTEGER fOption, T value) const
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
SQLPOINTER sv = reinterpret_cast<SQLPOINTER>(value);
- return N3SQLSetStmtAttr(m_aStatementHandle, fOption, sv, BufferLength);
+ return functions().SetStmtAttr(m_aStatementHandle, fOption, sv, BufferLength);
}
@@ -425,15 +428,15 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const OUString&
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- Reference< XResultSet > xRS;
+ rtl::Reference< OResultSet > xRS;
// Execute the statement. If execute returns true, a result
// set exists.
if (execute (sql))
{
- xRS = getResultSet (false);
- m_xResultSet = xRS;
+ xRS = getResultSet(false);
+ m_xResultSet = xRS.get();
}
else
{
@@ -449,7 +452,7 @@ Reference< XConnection > SAL_CALL OStatement_Base::getConnection( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
@@ -474,28 +477,31 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- OStringBuffer aBatchSql;
sal_Int32 nLen = m_aBatchVector.size();
- for (auto const& elem : m_aBatchVector)
- {
- aBatchSql.append(OUStringToOString(elem,getOwnConnection()->getTextEncoding()));
- aBatchSql.append(";");
- }
-
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- auto s = aBatchSql.makeStringAndClear();
- THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(s.getStr())), s.getLength()));
+ OUStringBuffer uSql;
+ comphelper::intersperse(m_aBatchVector.begin(), m_aBatchVector.end(), comphelper::OUStringBufferAppender(uSql), u";");
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::ExecDirectW))
+ {
+ SQLWChars statement(uSql.makeStringAndClear());
+ THROW_SQL(functions().ExecDirectW(m_aStatementHandle, statement.get(), statement.cch()));
+ }
+ else
+ {
+ SQLChars statement(uSql, getOwnConnection()->getTextEncoding());
+ THROW_SQL(functions().ExecDirect(m_aStatementHandle, statement.get(), statement.cch()));
+ }
Sequence< sal_Int32 > aRet(nLen);
sal_Int32* pArray = aRet.getArray();
for(sal_Int32 j=0;j<nLen;++j)
{
- SQLRETURN nError = N3SQLMoreResults(m_aStatementHandle);
+ SQLRETURN nError = functions().MoreResults(m_aStatementHandle);
if(nError == SQL_SUCCESS)
{
SQLLEN nRowCount=0;
- N3SQLRowCount(m_aStatementHandle,&nRowCount);
+ functions().RowCount(m_aStatementHandle,&nRowCount);
pArray[j] = nRowCount;
}
}
@@ -537,8 +543,9 @@ Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- m_xResultSet = getResultSet(true);
- return m_xResultSet;
+ rtl::Reference<OResultSet> xRS = getResultSet(true);
+ m_xResultSet = xRS.get();
+ return xRS;
}
@@ -577,7 +584,7 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( )
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
try {
- hasResultSet = N3SQLMoreResults(m_aStatementHandle) == SQL_SUCCESS;
+ hasResultSet = functions().MoreResults(m_aStatementHandle) == SQL_SUCCESS;
}
catch (const SQLWarning &ex) {
@@ -617,7 +624,7 @@ Any SAL_CALL OStatement_Base::getWarnings( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return makeAny(m_aLastWarning);
+ return Any(m_aLastWarning);
}
@@ -706,10 +713,19 @@ sal_Int64 OStatement_Base::getMaxFieldSize() const
OUString OStatement_Base::getCursorName() const
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- SQLCHAR pName[258];
SQLSMALLINT nRealLen = 0;
- N3SQLGetCursorName(m_aStatementHandle,pName,256,&nRealLen);
- return OUString::createFromAscii(reinterpret_cast<char*>(pName));
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::GetCursorNameW))
+ {
+ SQLWCHAR pName[258]{};
+ functions().GetCursorNameW(m_aStatementHandle, pName, 256, &nRealLen);
+ return toUString(pName, nRealLen);
+ }
+ else
+ {
+ SQLCHAR pName[258]{};
+ functions().GetCursorName(m_aStatementHandle, pName, 256, &nRealLen);
+ return toUString(pName);
+ }
}
void OStatement_Base::setQueryTimeOut(sal_Int64 seconds)
@@ -833,11 +849,19 @@ void OStatement_Base::setMaxFieldSize(sal_Int64 _par0)
setStmtOption<SQLULEN, SQL_IS_UINTEGER>(SQL_ATTR_MAX_LENGTH, _par0);
}
-void OStatement_Base::setCursorName(std::u16string_view _par0)
+void OStatement_Base::setCursorName(const OUString& _par0)
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- OString aName(OUStringToOString(_par0,getOwnConnection()->getTextEncoding()));
- N3SQLSetCursorName(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aName.getStr())), static_cast<SQLSMALLINT>(aName.getLength()));
+ if (bUseWChar && functions().has(ODBC3SQLFunctionId::SetCursorNameW))
+ {
+ SQLWChars name(_par0);
+ functions().SetCursorNameW(m_aStatementHandle, name.get(), name.cch());
+ }
+ else
+ {
+ SQLChars name(_par0, getOwnConnection()->getTextEncoding());
+ functions().SetCursorName(m_aStatementHandle, name.get(), name.cch());
+ }
}
bool OStatement_Base::isUsingBookmarks() const
@@ -861,31 +885,71 @@ void OStatement_Base::setUsingBookmarks(bool _bUseBookmark)
::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
{
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
- PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
- PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
- PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
- PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
- PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
- PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
- PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
- PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
- PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
- PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
+ PROPERTY_ID_CURSORNAME,
+ cppu::UnoType<OUString>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
+ PROPERTY_ID_ESCAPEPROCESSING,
+ cppu::UnoType<bool>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
+ PROPERTY_ID_MAXFIELDSIZE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
+ PROPERTY_ID_MAXROWS,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
+ PROPERTY_ID_QUERYTIMEOUT,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ 0
+ },
+ {
+ ::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
+ PROPERTY_ID_USEBOOKMARKS,
+ cppu::UnoType<bool>::get(),
+ 0
+ }
+ }
+ };
}
@@ -1041,29 +1105,29 @@ void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
}
}
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(OStatement,u"com.sun.star.sdbcx.OStatement"_ustr,u"com.sun.star.sdbc.Statement"_ustr);
-void SAL_CALL OStatement_Base::acquire() throw()
+void SAL_CALL OStatement_Base::acquire() noexcept
{
OStatement_BASE::acquire();
}
-void SAL_CALL OStatement_Base::release() throw()
+void SAL_CALL OStatement_Base::release() noexcept
{
OStatement_BASE::release();
}
-void SAL_CALL OStatement::acquire() throw()
+void SAL_CALL OStatement::acquire() noexcept
{
OStatement_BASE2::acquire();
}
-void SAL_CALL OStatement::release() throw()
+void SAL_CALL OStatement::release() noexcept
{
OStatement_BASE2::release();
}
-OResultSet* OStatement_Base::createResulSet()
+rtl::Reference<OResultSet> OStatement_Base::createResultSet()
{
return new OResultSet(m_aStatementHandle,this);
}
diff --git a/connectivity/source/drivers/odbc/OTools.cxx b/connectivity/source/drivers/odbc/OTools.cxx
index 4781415de474..0909b03f14b2 100644
--- a/connectivity/source/drivers/odbc/OTools.cxx
+++ b/connectivity/source/drivers/odbc/OTools.cxx
@@ -115,7 +115,7 @@ void appendSQLWCHARs(OUStringBuffer & s, SQLWCHAR const * d, sal_Int32 n)
if (sizeof (SQLWCHAR) == sizeof (sal_Unicode)) {
s.append(reinterpret_cast<sal_Unicode const *>(d), n);
} else {
- for (sal_Int32 i = 0; i != n; ++i) {
+ for (sal_Int32 i = 0; i < n; ++i) {
s.appendUtf32(d[i]);
}
}
@@ -151,7 +151,7 @@ void OTools::getValue( OConnection const * _pConnection,
OSL_ENSURE(o3tl::make_unsigned(_nSize) >= properSize, "memory region is too small");
SQLLEN pcbValue = SQL_NULL_DATA;
OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetData>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetData)))(_aStatementHandle,
+ _pConnection->functions().GetData(_aStatementHandle,
static_cast<SQLUSMALLINT>(columnIndex),
_nType,
_pValue,
@@ -161,144 +161,6 @@ void OTools::getValue( OConnection const * _pConnection,
_bWasNull = pcbValue == SQL_NULL_DATA;
}
-void OTools::bindValue( OConnection const * _pConnection,
- SQLHANDLE _aStatementHandle,
- sal_Int32 columnIndex,
- SQLSMALLINT _nType,
- SQLSMALLINT _nMaxLen,
- const void* _pValue,
- void* _pData,
- SQLLEN * const pLen,
- const css::uno::Reference< css::uno::XInterface >& _xInterface,
- rtl_TextEncoding _nTextEncoding,
- bool _bUseOldTimeDate)
-{
- SQLRETURN nRetcode;
- SQLSMALLINT fSqlType;
- SQLSMALLINT fCType;
-
- OTools::getBindTypes( false,
- _bUseOldTimeDate,
- _nType,
- fCType,
- fSqlType);
-
- if (columnIndex != 0 && !_pValue)
- {
- *pLen = SQL_NULL_DATA;
- nRetcode = (*reinterpret_cast<T3SQLBindCol>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::BindCol)))(_aStatementHandle,
- static_cast<SQLUSMALLINT>(columnIndex),
- fCType,
- _pData,
- _nMaxLen,
- pLen
- );
- }
- else
- {
- try
- {
- switch (_nType)
- {
- case SQL_CHAR:
- case SQL_VARCHAR:
- {
- OString aString(OUStringToOString(*static_cast<OUString const *>(_pValue),_nTextEncoding));
- *pLen = SQL_NTS;
- *static_cast<OString*>(_pData) = aString;
-
- // Pointer on Char*
- _pData = const_cast<char *>(aString.getStr());
- } break;
- case SQL_BIGINT:
- *static_cast<sal_Int64*>(_pData) = *static_cast<sal_Int64 const *>(_pValue);
- *pLen = sizeof(sal_Int64);
- break;
- case SQL_DECIMAL:
- case SQL_NUMERIC:
- {
- OString aString = OString::number(*static_cast<double const *>(_pValue));
- *pLen = static_cast<SQLSMALLINT>(aString.getLength());
- *static_cast<OString*>(_pData) = aString;
- // Pointer on Char*
- _pData = const_cast<char *>(static_cast<OString*>(_pData)->getStr());
- } break;
- case SQL_BIT:
- case SQL_TINYINT:
- *static_cast<sal_Int8*>(_pData) = *static_cast<sal_Int8 const *>(_pValue);
- *pLen = sizeof(sal_Int8);
- break;
-
- case SQL_SMALLINT:
- *static_cast<sal_Int16*>(_pData) = *static_cast<sal_Int16 const *>(_pValue);
- *pLen = sizeof(sal_Int16);
- break;
- case SQL_INTEGER:
- *static_cast<sal_Int32*>(_pData) = *static_cast<sal_Int32 const *>(_pValue);
- *pLen = sizeof(sal_Int32);
- break;
- case SQL_FLOAT:
- *static_cast<float*>(_pData) = *static_cast<float const *>(_pValue);
- *pLen = sizeof(float);
- break;
- case SQL_REAL:
- case SQL_DOUBLE:
- *static_cast<double*>(_pData) = *static_cast<double const *>(_pValue);
- *pLen = sizeof(double);
- break;
- case SQL_BINARY:
- case SQL_VARBINARY:
- {
- _pData = const_cast<sal_Int8 *>(static_cast<const css::uno::Sequence< sal_Int8 > *>(_pValue)->getConstArray());
- *pLen = static_cast<const css::uno::Sequence< sal_Int8 > *>(_pValue)->getLength();
- } break;
- case SQL_LONGVARBINARY:
- {
- /* see https://msdn.microsoft.com/en-us/library/ms716238%28v=vs.85%29.aspx
- * for an explanation of that apparently weird cast */
- _pData = reinterpret_cast<void*>(static_cast<uintptr_t>(columnIndex));
- sal_Int32 nLen = static_cast<const css::uno::Sequence< sal_Int8 > *>(_pValue)->getLength();
- *pLen = static_cast<SQLLEN>(SQL_LEN_DATA_AT_EXEC(nLen));
- }
- break;
- case SQL_LONGVARCHAR:
- {
- /* see https://msdn.microsoft.com/en-us/library/ms716238%28v=vs.85%29.aspx
- * for an explanation of that apparently weird cast */
- _pData = reinterpret_cast<void*>(static_cast<uintptr_t>(columnIndex));
- sal_Int32 nLen = static_cast<OUString const *>(_pValue)->getLength();
- *pLen = static_cast<SQLLEN>(SQL_LEN_DATA_AT_EXEC(nLen));
- } break;
- case SQL_DATE:
- *pLen = sizeof(DATE_STRUCT);
- *static_cast<DATE_STRUCT*>(_pData) = *static_cast<DATE_STRUCT const *>(_pValue);
- break;
- case SQL_TIME:
- *pLen = sizeof(TIME_STRUCT);
- *static_cast<TIME_STRUCT*>(_pData) = *static_cast<TIME_STRUCT const *>(_pValue);
- break;
- case SQL_TIMESTAMP:
- *pLen = sizeof(TIMESTAMP_STRUCT);
- *static_cast<TIMESTAMP_STRUCT*>(_pData) = *static_cast<TIMESTAMP_STRUCT const *>(_pValue);
- break;
- }
- }
- catch ( ... )
- {
- }
-
- nRetcode = (*reinterpret_cast<T3SQLBindCol>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::BindCol)))(_aStatementHandle,
- static_cast<SQLUSMALLINT>(columnIndex),
- fCType,
- _pData,
- _nMaxLen,
- pLen
- );
- }
-
- OTools::ThrowException(_pConnection,nRetcode,_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
-}
-
void OTools::ThrowException(const OConnection* _pConnection,
const SQLRETURN _rRetCode,
const SQLHANDLE _pContext,
@@ -328,11 +190,10 @@ void OTools::ThrowException(const OConnection* _pConnection,
// Additional Information on the latest ODBC-functioncall available
// SQLError provides this Information.
- SDB_ODBC_CHAR szSqlState[5];
+ OUString errorMessage;
+ OUString sqlState;
SQLINTEGER pfNativeError;
- SDB_ODBC_CHAR szErrorMessage[SQL_MAX_MESSAGE_LENGTH];
- szErrorMessage[0] = '\0';
- SQLSMALLINT pcbErrorMsg = 0;
+ SQLRETURN n;
// Information for latest operation:
// when hstmt != SQL_NULL_HSTMT is (Used from SetStatus in SdbCursor, SdbTable, ...),
@@ -340,22 +201,46 @@ void OTools::ThrowException(const OConnection* _pConnection,
// statements of this connection [what in this case will probably be the same, but the Reference
// Manual isn't totally clear in this...].
// corresponding for hdbc.
- SQLRETURN n = (*reinterpret_cast<T3SQLGetDiagRec>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetDiagRec)))(_nHandleType,_pContext,1,
+ if (bUseWChar && _pConnection->functions().has(ODBC3SQLFunctionId::GetDiagRecW))
+ {
+ SQLWCHAR szSqlState[6];
+ SQLWCHAR szErrorMessage[SQL_MAX_MESSAGE_LENGTH];
+ szErrorMessage[0] = '\0';
+ SQLSMALLINT cchErrorMsg = 0;
+
+ n = _pConnection->functions().GetDiagRecW(_nHandleType,_pContext,1,
+ szSqlState,
+ &pfNativeError,
+ szErrorMessage, std::size(szErrorMessage) - 1, &cchErrorMsg);
+ if (SQL_SUCCEEDED(n))
+ {
+ errorMessage = toUString(szErrorMessage, cchErrorMsg);
+ sqlState = toUString(szSqlState, 5);
+ }
+ }
+ else
+ {
+ SQLCHAR szSqlState[6];
+ SQLCHAR szErrorMessage[SQL_MAX_MESSAGE_LENGTH];
+ szErrorMessage[0] = '\0';
+ SQLSMALLINT pcbErrorMsg = 0;
+
+ n = _pConnection->functions().GetDiagRec(_nHandleType,_pContext,1,
szSqlState,
&pfNativeError,
szErrorMessage,sizeof szErrorMessage - 1,&pcbErrorMsg);
+ if (SQL_SUCCEEDED(n))
+ {
+ rtl_TextEncoding _nTextEncoding = osl_getThreadTextEncoding();
+ errorMessage = toUString(szErrorMessage, pcbErrorMsg, _nTextEncoding);
+ sqlState = toUString(szSqlState, 5, _nTextEncoding);
+ }
+ }
OSL_ENSURE(n != SQL_INVALID_HANDLE,"SdbODBC3_SetStatus: SQLError returned SQL_INVALID_HANDLE");
OSL_ENSURE(n == SQL_SUCCESS || n == SQL_SUCCESS_WITH_INFO || n == SQL_NO_DATA_FOUND || n == SQL_ERROR,"SdbODBC3_SetStatus: SQLError failed");
- rtl_TextEncoding _nTextEncoding = osl_getThreadTextEncoding();
// For the Return Code of SQLError see ODBC 2.0 Programmer's Reference Page 287ff
- throw SQLException( OUString(reinterpret_cast<char *>(szErrorMessage), pcbErrorMsg, _nTextEncoding),
- _xInterface,
- OUString(reinterpret_cast<char *>(szSqlState), 5, _nTextEncoding),
- pfNativeError,
- Any()
- );
-
+ throw SQLException(errorMessage, _xInterface, sqlState, pfNativeError, Any());
}
Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
@@ -378,7 +263,7 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
while (pcbValue == SQL_NO_TOTAL || pcbValue > nMaxLen)
{
OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetData>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetData)))(
+ _pConnection->functions().GetData(
_aStatementHandle,
static_cast<SQLUSMALLINT>(columnIndex),
_fSqlType,
@@ -438,7 +323,7 @@ OUString OTools::getStringValue(OConnection const * _pConnection,
while ((pcbValue == SQL_NO_TOTAL ) || (pcbValue >= nMaxSize) )
{
OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetData>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetData)))(
+ _pConnection->functions().GetData(
_aStatementHandle,
static_cast<SQLUSMALLINT>(columnIndex),
SQL_C_WCHAR,
@@ -482,7 +367,7 @@ OUString OTools::getStringValue(OConnection const * _pConnection,
while ((pcbValue == SQL_NO_TOTAL ) || (pcbValue >= nMaxLen) )
{
OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetData>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetData)))(
+ _pConnection->functions().GetData(
_aStatementHandle,
static_cast<SQLUSMALLINT>(columnIndex),
SQL_C_CHAR,
@@ -527,13 +412,27 @@ void OTools::GetInfo(OConnection const * _pConnection,
const Reference< XInterface >& _xInterface,
rtl_TextEncoding _nTextEncoding)
{
- char aValue[512];
- SQLSMALLINT nValueLen=0;
- OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetInfo>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetInfo)))(_aConnectionHandle,_nInfo,aValue,(sizeof aValue)-1,&nValueLen),
- _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
+ if (bUseWChar && _pConnection->functions().has(ODBC3SQLFunctionId::GetInfoW))
+ {
+ SQLWCHAR aValue[512];
+ SQLSMALLINT nValueLen=0;
+ // SQLGetInfoW takes / outputs count of bytes, not characters
+ OTools::ThrowException(_pConnection,
+ _pConnection->functions().GetInfoW(_aConnectionHandle,_nInfo,aValue,sizeof(aValue)-sizeof(SQLWCHAR),&nValueLen),
+ _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
- _rValue = OUString(aValue,nValueLen,_nTextEncoding);
+ _rValue = toUString(aValue, nValueLen / sizeof(SQLWCHAR));
+ }
+ else
+ {
+ SQLCHAR aValue[512];
+ SQLSMALLINT nValueLen=0;
+ OTools::ThrowException(_pConnection,
+ _pConnection->functions().GetInfo(_aConnectionHandle,_nInfo,aValue,sizeof(aValue)-1,&nValueLen),
+ _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
+
+ _rValue = toUString(aValue, nValueLen, _nTextEncoding);
+ }
}
void OTools::GetInfo(OConnection const * _pConnection,
@@ -545,7 +444,7 @@ void OTools::GetInfo(OConnection const * _pConnection,
SQLSMALLINT nValueLen;
_rValue = 0; // in case the driver uses only 16 of the 32 bits (as it does, for example, for SQL_CATALOG_LOCATION)
OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetInfo>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetInfo)))(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
+ _pConnection->functions().GetInfo(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
_aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
}
@@ -558,7 +457,7 @@ void OTools::GetInfo(OConnection const * _pConnection,
SQLSMALLINT nValueLen;
_rValue = 0; // in case the driver uses only 16 of the 32 bits (as it does, for example, for SQL_CATALOG_LOCATION)
OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetInfo>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetInfo)))(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
+ _pConnection->functions().GetInfo(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
_aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
}
@@ -571,7 +470,7 @@ void OTools::GetInfo(OConnection const * _pConnection,
SQLSMALLINT nValueLen;
_rValue = 0; // in case the driver uses only 16 of the 32 bits (as it does, for example, for SQL_CATALOG_LOCATION)
OTools::ThrowException(_pConnection,
- (*reinterpret_cast<T3SQLGetInfo>(_pConnection->getOdbcFunction(ODBC3SQLFunctionId::GetInfo)))(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
+ _pConnection->functions().GetInfo(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
_aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
}
@@ -683,8 +582,7 @@ SQLSMALLINT OTools::jdbcTypeToOdbc(sal_Int32 jdbcType)
return odbcType;
}
-void OTools::getBindTypes(bool _bUseWChar,
- bool _bUseOldTimeDate,
+void OTools::getBindTypes(bool _bUseOldTimeDate,
SQLSMALLINT _nOdbcType,
SQLSMALLINT& fCType,
SQLSMALLINT& fSqlType
@@ -692,42 +590,36 @@ void OTools::getBindTypes(bool _bUseWChar,
{
switch(_nOdbcType)
{
- case SQL_CHAR: if(_bUseWChar)
- {
- fCType = SQL_C_WCHAR;
- fSqlType = SQL_WCHAR;
- }
- else
+ case SQL_CHAR: if (!bUseWChar)
{
fCType = SQL_C_CHAR;
fSqlType = SQL_CHAR;
+ break;
}
- break;
- case SQL_VARCHAR: if(_bUseWChar)
- {
- fCType = SQL_C_WCHAR;
- fSqlType = SQL_WVARCHAR;
- }
- else
+ [[fallthrough]];
+ case SQL_WCHAR: fCType = SQL_C_WCHAR;
+ fSqlType = SQL_WCHAR; break;
+ case SQL_VARCHAR: if (!bUseWChar)
{
fCType = SQL_C_CHAR;
fSqlType = SQL_VARCHAR;
+ break;
}
- break;
- case SQL_LONGVARCHAR: if(_bUseWChar)
- {
- fCType = SQL_C_WCHAR;
- fSqlType = SQL_WLONGVARCHAR;
- }
- else
+ [[fallthrough]];
+ case SQL_WVARCHAR: fCType = SQL_C_WCHAR;
+ fSqlType = SQL_WVARCHAR; break;
+ case SQL_LONGVARCHAR: if (!bUseWChar)
{
fCType = SQL_C_CHAR;
fSqlType = SQL_LONGVARCHAR;
+ break;
}
- break;
- case SQL_DECIMAL: fCType = _bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR;
+ [[fallthrough]];
+ case SQL_WLONGVARCHAR: fCType = SQL_C_WCHAR;
+ fSqlType = SQL_WLONGVARCHAR; break;
+ case SQL_DECIMAL: fCType = bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR;
fSqlType = SQL_DECIMAL; break;
- case SQL_NUMERIC: fCType = _bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR;
+ case SQL_NUMERIC: fCType = bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR;
fSqlType = SQL_NUMERIC; break;
case SQL_BIT: fCType = SQL_C_TINYINT;
fSqlType = SQL_INTEGER; break;
diff --git a/connectivity/source/drivers/postgresql/pq_array.cxx b/connectivity/source/drivers/postgresql/pq_array.cxx
index 5ae646f230e3..2b7ab3c9491f 100644
--- a/connectivity/source/drivers/postgresql/pq_array.cxx
+++ b/connectivity/source/drivers/postgresql/pq_array.cxx
@@ -54,7 +54,7 @@ namespace pq_sdbc_driver
OUString Array::getBaseTypeName( )
{
- return "varchar";
+ return u"varchar"_ustr;
}
sal_Int32 Array::getBaseType( )
@@ -96,11 +96,11 @@ css::uno::Reference< css::sdbc::XResultSet > Array::getResultSetAtIndex(
std::vector< Any > row( 2 );
row[0] <<= static_cast<sal_Int32>( i + index );
row[1] = m_data[i+index-1];
- ret[i] = row;
+ ret[i] = std::move(row);
}
return new SequenceResultSet(
- m_xMutex, m_owner, getStatics().resultSetArrayColumnNames, ret, m_tc );
+ m_xMutex, m_owner, std::vector(getStatics().resultSetArrayColumnNames), std::move(ret), m_tc );
}
diff --git a/connectivity/source/drivers/postgresql/pq_array.hxx b/connectivity/source/drivers/postgresql/pq_array.hxx
index c0ed6aa97efd..589fe063d234 100644
--- a/connectivity/source/drivers/postgresql/pq_array.hxx
+++ b/connectivity/source/drivers/postgresql/pq_array.hxx
@@ -34,12 +34,12 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_ARRAY_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_ARRAY_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/sdbc/XArray.hpp>
#include "pq_connection.hxx"
+#include <utility>
#include <vector>
namespace pq_sdbc_driver
@@ -54,14 +54,14 @@ class Array : public cppu::WeakImplHelper< css::sdbc::XArray >
public:
Array(
- const rtl::Reference< comphelper::RefCountedMutex > & mutex,
- const std::vector< css::uno::Any > & data,
- const css::uno::Reference< css::uno::XInterface > & owner,
- const css::uno::Reference< css::script::XTypeConverter > &tc) :
- m_data( data ),
- m_owner( owner ),
- m_tc( tc ),
- m_xMutex( mutex )
+ rtl::Reference< comphelper::RefCountedMutex > mutex,
+ std::vector< css::uno::Any > && data,
+ css::uno::Reference< css::uno::XInterface > owner,
+ css::uno::Reference< css::script::XTypeConverter > tc) :
+ m_data( std::move(data) ),
+ m_owner(std::move( owner )),
+ m_tc(std::move( tc )),
+ m_xMutex(std::move( mutex ))
{}
public: // XArray
@@ -95,6 +95,4 @@ private:
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index 9ff5e01e098a..274a0a209a17 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -74,25 +74,25 @@ static ::cppu::IPropertyArrayHelper & getResultSetPropertyArrayHelper()
static ::cppu::OPropertyArrayHelper arrayHelper(
Sequence<Property>{
Property(
- "CursorName", 0,
+ u"CursorName"_ustr, 0,
::cppu::UnoType<OUString>::get() , 0 ),
Property(
- "EscapeProcessing", 1,
+ u"EscapeProcessing"_ustr, 1,
cppu::UnoType<bool>::get() , 0 ),
Property(
- "FetchDirection", 2,
+ u"FetchDirection"_ustr, 2,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "FetchSize", 3,
+ u"FetchSize"_ustr, 3,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "IsBookmarkable", 4,
+ u"IsBookmarkable"_ustr, 4,
cppu::UnoType<bool>::get() , 0 ),
Property(
- "ResultSetConcurrency", 5,
+ u"ResultSetConcurrency"_ustr, 5,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "ResultSetType", 6,
+ u"ResultSetType"_ustr, 6,
::cppu::UnoType<sal_Int32>::get() , 0 )},
true );
return arrayHelper;
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
index 8b062ddf9ac0..90e6609a0860 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_BASERESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_BASERESULTSET_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/component.hxx>
@@ -104,8 +103,8 @@ protected:
virtual ~BaseResultSet() override;
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { BaseResultSet_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { BaseResultSet_BASE::release(); }
+ virtual void SAL_CALL acquire() noexcept override { BaseResultSet_BASE::acquire(); }
+ virtual void SAL_CALL release() noexcept override { BaseResultSet_BASE::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -200,6 +199,5 @@ public: // OComponentHelper
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 2bc1e4a42af8..74402197a0a5 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -34,6 +34,7 @@
*
************************************************************************/
+#include <utility>
#include <vector>
#include <string.h>
@@ -48,6 +49,7 @@
#include "pq_xviews.hxx"
#include "pq_xusers.hxx"
+#include <rtl/ref.hxx>
#include <rtl/uuid.h>
#include <sal/log.hxx>
@@ -95,8 +97,8 @@ class ClosableReference : public cppu::WeakImplHelper< css::uno::XReference >
rtl::Reference<Connection> m_conn;
::rtl::ByteSequence m_id;
public:
- ClosableReference( const ::rtl::ByteSequence & id , Connection *that )
- : m_conn( that ), m_id( id )
+ ClosableReference( ::rtl::ByteSequence id , Connection *that )
+ : m_conn( that ), m_id(std::move( id ))
{
}
@@ -114,9 +116,9 @@ public:
Connection::Connection(
const rtl::Reference< comphelper::RefCountedMutex > &refMutex,
- const css::uno::Reference< css::uno::XComponentContext > & ctx )
+ css::uno::Reference< css::uno::XComponentContext > ctx )
: ConnectionBase( refMutex->GetMutex() ),
- m_ctx( ctx ) ,
+ m_ctx(std::move( ctx )) ,
m_xMutex( refMutex )
{
}
@@ -146,7 +148,6 @@ void Connection::close()
vectorDispose.push_back( Reference< XComponent > ( m_settings.users, UNO_QUERY ) );
vectorDispose.push_back( Reference< XComponent > ( m_settings.tables , UNO_QUERY ) );
- vectorDispose.push_back( Reference< XComponent > ( m_meta, UNO_QUERY ) );
m_meta.clear();
m_settings.tables.clear();
m_settings.users.clear();
@@ -186,13 +187,12 @@ Reference< XStatement > Connection::createStatement()
MutexGuard guard( m_xMutex->GetMutex() );
checkClosed();
- Statement *stmt = new Statement( m_xMutex, this , &m_settings );
- Reference< XStatement > ret( stmt );
+ rtl::Reference<Statement> stmt = new Statement( m_xMutex, this , &m_settings );
::rtl::ByteSequence id( 16 );
rtl_createUuid( reinterpret_cast<sal_uInt8*>(id.getArray()), nullptr, false );
m_myStatements[ id ] = Reference< XCloseable > ( stmt );
- stmt->queryAdapter()->addReference( new ClosableReference( id, this ) );
- return ret;
+ stmt->queryAdapter()->addReference( new ClosableReference( std::move(id), this ) );
+ return stmt;
}
Reference< XPreparedStatement > Connection::prepareStatement( const OUString& sql )
@@ -201,20 +201,20 @@ Reference< XPreparedStatement > Connection::prepareStatement( const OUString& sq
checkClosed();
OString byteSql = OUStringToOString( sql, ConnectionSettings::encoding );
- PreparedStatement *stmt = new PreparedStatement( m_xMutex, this, &m_settings, byteSql );
- Reference< XPreparedStatement > ret = stmt;
+ rtl::Reference<PreparedStatement> stmt
+ = new PreparedStatement( m_xMutex, this, &m_settings, byteSql );
::rtl::ByteSequence id( 16 );
rtl_createUuid( reinterpret_cast<sal_uInt8*>(id.getArray()), nullptr, false );
m_myStatements[ id ] = Reference< XCloseable > ( stmt );
- stmt->queryAdapter()->addReference( new ClosableReference( id, this ) );
- return ret;
+ stmt->queryAdapter()->addReference(new ClosableReference(std::move(id), this));
+ return stmt;
}
Reference< XPreparedStatement > Connection::prepareCall( const OUString& )
{
throw SQLException(
- "pq_driver: Callable statements not supported",
+ u"pq_driver: Callable statements not supported"_ustr,
Reference< XInterface > (), OUString() , 1, Any() );
}
@@ -281,7 +281,7 @@ OUString Connection::getCatalog()
MutexGuard guard( m_xMutex->GetMutex() );
if( m_settings.pConnection == nullptr )
{
- throw SQLException( "pq_connection: connection is closed", *this,
+ throw SQLException( u"pq_connection: connection is closed"_ustr, *this,
OUString(), 1, Any() );
}
char * p = PQdb(m_settings.pConnection );
@@ -330,7 +330,15 @@ class cstr_vector
std::vector<char*> values;
std::vector<bool> acquired;
public:
- cstr_vector () : values(), acquired() { values.reserve(8); acquired.reserve(8); }
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 14
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif
+ cstr_vector () { values.reserve(8); acquired.reserve(8); }
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 14
+#pragma GCC diagnostic pop
+#endif
~cstr_vector ()
{
OSL_ENSURE(values.size() == acquired.size(), "pq_connection: cstr_vector values and acquired size mismatch");
@@ -418,7 +426,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
if( ! tc.is() )
{
throw RuntimeException(
- "pq_driver: Couldn't instantiate converter service" );
+ u"pq_driver: Couldn't instantiate converter service"_ustr );
}
if( aArguments.getLength() != 2 )
{
@@ -431,7 +439,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
{
throw IllegalArgumentException(
"pq_driver: expected string as first argument, got "
- + aArguments[0].getValueType().getTypeName(),
+ + aArguments[0].getValueTypeName(),
*this, 0 );
}
@@ -470,7 +478,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
// Just the most likely error; the error might be HY024 "Invalid attribute value".
throw SQLException(
"Error in database URL '" + url + "':\n" + errorMessage,
- *this, "HY092", 5, Any() );
+ *this, u"HY092"_ustr, 5, Any() );
}
for ( PQconninfoOption * opt = oOpts.get(); opt->keyword != nullptr; ++opt)
@@ -489,7 +497,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
m_settings.pConnection = PQconnectdbParams( keywords.c_array(), values.c_array(), 0 );
}
if( ! m_settings.pConnection )
- throw RuntimeException("pq_driver: out of memory" );
+ throw RuntimeException(u"pq_driver: out of memory"_ustr );
if( PQstatus( m_settings.pConnection ) == CONNECTION_BAD )
{
const char * error = PQerrorMessage( m_settings.pConnection );
@@ -506,7 +514,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
m_settings.user = OUString( p, strlen(p), RTL_TEXTENCODING_UTF8);
p = PQdb( m_settings.pConnection );
m_settings.catalog = OUString( p, strlen(p), RTL_TEXTENCODING_UTF8);
- m_settings.tc = tc;
+ m_settings.tc = std::move(tc);
SAL_INFO("connectivity.postgresql", "connection to '" << url << "' successfully opened");
}
@@ -519,7 +527,7 @@ void Connection::disposing()
void Connection::checkClosed()
{
if( !m_settings.pConnection )
- throw SQLException( "pq_connection: Connection already closed",
+ throw SQLException( u"pq_connection: Connection already closed"_ustr,
*this, OUString(), 1, Any() );
}
diff --git a/connectivity/source/drivers/postgresql/pq_connection.hxx b/connectivity/source/drivers/postgresql/pq_connection.hxx
index f8d19c406b18..2b86ce5882fd 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.hxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_CONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_CONNECTION_HXX
+#pragma once
#include <config_lgpl.h>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -61,19 +60,20 @@
#include <libpq-fe.h>
#include <unordered_map>
+#include "pq_xtables.hxx"
+#include "pq_xviews.hxx"
+
namespace pq_sdbc_driver
{
struct ConnectionSettings;
-class Tables;
-class Views;
+class DatabaseMetaData;
+
struct ConnectionSettings
{
ConnectionSettings() :
pConnection(nullptr),
maxNameLen(0),
- maxIndexKeys(0),
- pTablesImpl(nullptr),
- pViewsImpl(nullptr)
+ maxIndexKeys(0)
{}
static const rtl_TextEncoding encoding = RTL_TEXTENCODING_UTF8;
PGconn *pConnection;
@@ -83,8 +83,8 @@ struct ConnectionSettings
css::uno::Reference< css::container::XNameAccess > tables;
css::uno::Reference< css::container::XNameAccess > users;
css::uno::Reference< css::container::XNameAccess > views;
- Tables *pTablesImpl; // needed to implement renaming of tables / views
- Views *pViewsImpl; // needed to implement renaming of tables / views
+ rtl::Reference<Tables> pTablesImpl; // needed to implement renaming of tables / views
+ rtl::Reference<Views> pViewsImpl; // needed to implement renaming of tables / views
OUString user;
OUString catalog;
};
@@ -125,7 +125,7 @@ class Connection : public ConnectionBase
css::uno::Reference< css::container::XNameAccess > m_typeMap;
ConnectionSettings m_settings;
::rtl::Reference< comphelper::RefCountedMutex > m_xMutex;
- css::uno::Reference< css::sdbc::XDatabaseMetaData > m_meta;
+ rtl::Reference< DatabaseMetaData > m_meta;
WeakHashMap m_myStatements;
private:
@@ -136,7 +136,7 @@ private:
public:
Connection(
const rtl::Reference< comphelper::RefCountedMutex > &refMutex,
- const css::uno::Reference< css::uno::XComponentContext > & ctx );
+ css::uno::Reference< css::uno::XComponentContext > ctx );
virtual ~Connection( ) override;
@@ -192,6 +192,5 @@ public: // helper function
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index 07e0e85815c1..76157bc4c305 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -74,6 +74,7 @@
#include "pq_statics.hxx"
#include "pq_tools.hxx"
+#include <o3tl/string_view.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/macros.h>
#include <com/sun/star/sdbc/TransactionIsolation.hpp>
@@ -83,6 +84,7 @@
#include <com/sun/star/sdbc/IndexType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/ColumnSearch.hpp>
+#include <utility>
using ::osl::MutexGuard;
@@ -113,13 +115,13 @@ namespace pq_sdbc_driver
#define DEFERRABILITY_NONE 7
DatabaseMetaData::DatabaseMetaData(
- const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
- const css::uno::Reference< css::sdbc::XConnection > & origin,
+ ::rtl::Reference< comphelper::RefCountedMutex > refMutex,
+ css::uno::Reference< css::sdbc::XConnection > origin,
ConnectionSettings *pSettings )
- : m_xMutex( refMutex ),
+ : m_xMutex(std::move( refMutex )),
m_pSettings( pSettings ),
- m_origin( origin ),
- m_getIntSetting_stmt ( m_origin->prepareStatement("SELECT setting FROM pg_catalog.pg_settings WHERE name=?") )
+ m_origin(std::move( origin )),
+ m_getIntSetting_stmt ( m_origin->prepareStatement(u"SELECT setting FROM pg_catalog.pg_settings WHERE name=?"_ustr) )
{
init_getReferences_stmt();
init_getPrivs_stmt();
@@ -179,7 +181,7 @@ sal_Bool DatabaseMetaData::nullsAreSortedAtEnd( )
OUString DatabaseMetaData::getDatabaseProductName( )
{
- return "PostgreSQL";
+ return u"PostgreSQL"_ustr;
}
OUString DatabaseMetaData::getDatabaseProductVersion( )
@@ -188,7 +190,7 @@ OUString DatabaseMetaData::getDatabaseProductVersion( )
}
OUString DatabaseMetaData::getDriverName( )
{
- return "postgresql-sdbc";
+ return u"postgresql-sdbc"_ustr;
}
OUString DatabaseMetaData::getDriverVersion( )
@@ -209,10 +211,10 @@ sal_Int32 DatabaseMetaData::getDriverMinorVersion( )
sal_Bool DatabaseMetaData::usesLocalFiles( )
{
// LEM TODO:
- // http://wiki.openoffice.org/wiki/Documentation/DevGuide/Database/XDatabaseMetaData_Interface
+ // https://wiki.documentfoundation.org/Documentation/DevGuide/Database_Access#XDatabaseMetaData_Interface
// says "Returns true when the catalog name of the
// database should not appear in the DatasourceBrowser
- // of OpenOffice.org API, otherwise false is returned."
+ // of LibreOffice API, otherwise false is returned."
// So, hmmm, think about it.
return false;
}
@@ -269,7 +271,7 @@ sal_Bool DatabaseMetaData::storesMixedCaseQuotedIdentifiers( )
OUString DatabaseMetaData::getIdentifierQuoteString( )
{
- return "\"";
+ return u"\""_ustr;
}
OUString DatabaseMetaData::getSQLKeywords( )
@@ -280,7 +282,7 @@ OUString DatabaseMetaData::getSQLKeywords( )
// See http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html
// LEM TODO: consider using pg_get_keywords(), filter on catcode
return
- "ANALYSE,"
+ u"ANALYSE,"
"ANALYZE,"
"ARRAY," //SQL:1999
"ASYMMETRIC," //SQL:2003
@@ -304,19 +306,19 @@ OUString DatabaseMetaData::getSQLKeywords( )
"SIMILAR," //SQL:2003
"VARIADIC,"
"VERBOSE,"
- "WINDOW" //SQL:2003
+ "WINDOW"_ustr //SQL:2003
;
}
OUString DatabaseMetaData::getNumericFunctions( )
{
- // See http://www.postgresql.org/docs/9.1/static/functions-math.html
- // LEM TODO: Err... http://wiki.openoffice.org/wiki/Documentation/DevGuide/Database/Support_Scalar_Functions
+ // See https://www.postgresql.org/docs/9.1/static/functions-math.html
+ // LEM TODO: Err... https://wiki.documentfoundation.org/Documentation/DevGuide/Database_Access#Support_Scalar_Functions
// says this should be "Open Group CLI" names, not PostgreSQL names.
// Currently this is just a list of supported functions in PostgreSQL, with PostgreSQL names.
// And it is my job to map from Open Group CLI names/syntax to PostgreSQL names/syntax. Where? By parsing the SQL???
// Should look at what the JDBC driver is doing.
return
- "abs,"
+ u"abs,"
"cbrt,"
"ceil,"
"ceiling,"
@@ -344,7 +346,7 @@ OUString DatabaseMetaData::getNumericFunctions( )
"cos,"
"cot,"
"sin,"
- "tan"
+ "tan"_ustr
;
}
@@ -352,7 +354,7 @@ OUString DatabaseMetaData::getStringFunctions( )
{
// See http://www.postgresql.org/docs/9.1/static/functions-string.html
return
- "bit_length,"
+ u"bit_length,"
"char_length,"
"character_length,"
"lower,"
@@ -398,7 +400,7 @@ OUString DatabaseMetaData::getStringFunctions( )
"substr,"
"to_ascii,"
"to_hex,"
- "translate"
+ "translate"_ustr
;
}
@@ -407,7 +409,7 @@ OUString DatabaseMetaData::getSystemFunctions( )
// See http://www.postgresql.org/docs/9.1/static/functions-info.html
// and http://www.postgresql.org/docs/9.1/static/functions-admin.html
return
- "current_catalog,"
+ u"current_catalog,"
"current_database,"
"current_query,"
"current_schema,"
@@ -528,14 +530,14 @@ OUString DatabaseMetaData::getSystemFunctions( )
"pg_try_advisory_lock_shared,"
"pg_try_advisory_xact_lock,"
"pg_try_advisory_xact_lock_shared,"
- "pg_sleep"
+ "pg_sleep"_ustr
;
}
OUString DatabaseMetaData::getTimeDateFunctions( )
{
// TODO
return
- "age,"
+ u"age,"
"age,"
"clock_timestamp,"
"current_date,"
@@ -557,16 +559,16 @@ OUString DatabaseMetaData::getTimeDateFunctions( )
"now,"
"statement_timestamp,"
"timeofday,"
- "transaction_timestamp,"
+ "transaction_timestamp,"_ustr
;
}
OUString DatabaseMetaData::getSearchStringEscape( )
{
- return "\\";
+ return u"\\"_ustr;
}
OUString DatabaseMetaData::getExtraNameCharacters( )
{
- return "$";
+ return u"$"_ustr;
}
sal_Bool DatabaseMetaData::supportsAlterTableWithAddColumn( )
@@ -721,17 +723,17 @@ sal_Bool DatabaseMetaData::supportsLimitedOuterJoins( )
OUString DatabaseMetaData::getSchemaTerm( )
{
- return "SCHEMA";
+ return u"SCHEMA"_ustr;
}
OUString DatabaseMetaData::getProcedureTerm( )
{
- return "function";
+ return u"function"_ustr;
}
OUString DatabaseMetaData::getCatalogTerm( )
{
- return "DATABASE";
+ return u"DATABASE"_ustr;
}
sal_Bool DatabaseMetaData::isCatalogAtStart( )
@@ -741,7 +743,7 @@ sal_Bool DatabaseMetaData::isCatalogAtStart( )
OUString DatabaseMetaData::getCatalogSeparator( )
{
- return ".";
+ return u"."_ustr;
}
sal_Bool DatabaseMetaData::supportsSchemasInDataManipulation( )
@@ -908,7 +910,7 @@ sal_Int32 DatabaseMetaData::getIntSetting(const OUString& settingName)
sal_Int32 DatabaseMetaData::getMaxNameLength()
{
if ( m_pSettings->maxNameLen == 0)
- m_pSettings->maxNameLen = getIntSetting( "max_identifier_length" );
+ m_pSettings->maxNameLen = getIntSetting( u"max_identifier_length"_ustr );
OSL_ENSURE(m_pSettings->maxNameLen, "postgresql-sdbc: maxNameLen is zero");
return m_pSettings->maxNameLen;
}
@@ -916,7 +918,7 @@ sal_Int32 DatabaseMetaData::getMaxNameLength()
sal_Int32 DatabaseMetaData::getMaxIndexKeys()
{
if ( m_pSettings->maxIndexKeys == 0)
- m_pSettings->maxIndexKeys = getIntSetting("max_index_keys");
+ m_pSettings->maxIndexKeys = getIntSetting(u"max_index_keys"_ustr);
OSL_ENSURE(m_pSettings->maxIndexKeys, "postgresql-sdbc: maxIndexKeys is zero");
return m_pSettings->maxIndexKeys;
}
@@ -1122,14 +1124,14 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTables(
// Take "inspiration" from JDBC driver
// Ah, this is used to create a XResultSet manually... Try to do it directly in SQL
Reference< XPreparedStatement > statement = m_origin->prepareStatement(
- "SELECT "
+ u"SELECT "
"DISTINCT ON (pg_namespace.nspname, relname ) " // avoid duplicates (pg_settings !)
"pg_namespace.nspname, relname, relkind, pg_description.description "
"FROM pg_namespace, pg_class LEFT JOIN pg_description ON pg_class.oid = pg_description.objoid "
"WHERE relnamespace = pg_namespace.oid "
"AND ( relkind = 'r' OR relkind = 'v') "
"AND pg_namespace.nspname LIKE ? "
- "AND relname LIKE ? "
+ "AND relname LIKE ? "_ustr
// "ORDER BY pg_namespace.nspname || relname"
);
@@ -1178,46 +1180,46 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTables(
closeable->close();
return new SequenceResultSet(
- m_xMutex, *this, statics.tablesRowNames, vec, m_pSettings->tc );
+ m_xMutex, *this, std::vector(statics.tablesRowNames), std::move(vec), m_pSettings->tc );
}
namespace
{
// sort no schema first, then "public", then normal schemas, then internal schemas
- int compare_schema(const OUString &nsA, const OUString &nsB)
+ int compare_schema(std::u16string_view nsA, std::u16string_view nsB)
{
- if (nsA.isEmpty())
+ if (nsA.empty())
{
- return nsB.isEmpty() ? 0 : -1;
+ return nsB.empty() ? 0 : -1;
}
- else if (nsB.isEmpty())
+ else if (nsB.empty())
{
- assert(!nsA.isEmpty());
+ assert(!nsA.empty());
return 1;
}
- else if(nsA == "public")
+ else if(nsA == u"public")
{
- return (nsB == "public") ? 0 : -1;
+ return (nsB == u"public") ? 0 : -1;
}
- else if(nsB == "public")
+ else if(nsB == u"public")
{
- assert(nsA != "public");
+ assert(nsA != u"public");
return 1;
}
- else if(nsA.startsWith("pg_"))
+ else if(o3tl::starts_with(nsA, u"pg_"))
{
- if(nsB.startsWith("pg_"))
- return nsA.compareTo(nsB);
+ if(o3tl::starts_with(nsB, u"pg_"))
+ return nsA.compare(nsB);
else
return 1;
}
- else if(nsB.startsWith("pg_"))
+ else if(o3tl::starts_with(nsB, u"pg_"))
{
return -1;
}
else
{
- return nsA.compareTo(nsB);
+ return nsA.compare(nsB);
}
}
@@ -1229,7 +1231,7 @@ namespace
OUString valueB;
a[0] >>= valueA;
b[0] >>= valueB;
- return compare_schema(valueA, valueB);
+ return compare_schema(valueA, valueB) < 0;
}
};
}
@@ -1243,7 +1245,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getSchemas( )
// <b>TABLE_SCHEM</b> string =&amp;gt; schema name
Reference< XStatement > statement = m_origin->createStatement();
Reference< XResultSet > rs = statement->executeQuery(
- "SELECT nspname from pg_namespace" );
+ u"SELECT nspname from pg_namespace"_ustr );
// LEM TODO: look at JDBC driver and consider doing the same
// in particular, excluding temporary schemas, but maybe better through pg_is_other_temp_schema(oid) OR == pg_my_temp_schema()
@@ -1251,9 +1253,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getSchemas( )
std::vector< std::vector<Any> > vec;
while( rs->next() )
{
- std::vector<Any> row(1);
- row[0] <<= xRow->getString(1);
- vec.push_back( row );
+ vec.push_back( { Any(xRow->getString(1)) } );
}
// sort public first, sort internal schemas last, sort rest in alphabetic order
@@ -1263,7 +1263,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getSchemas( )
if( closeable.is() )
closeable->close();
return new SequenceResultSet(
- m_xMutex, *this, getStatics().schemaNames, vec, m_pSettings->tc );
+ m_xMutex, *this, std::vector(getStatics().schemaNames), std::move(vec), m_pSettings->tc );
}
css::uno::Reference< XResultSet > DatabaseMetaData::getCatalogs( )
@@ -1280,7 +1280,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTableTypes( )
// LEM TODO: this can be made dynamic, see JDBC driver
MutexGuard guard( m_xMutex->GetMutex() );
return new SequenceResultSet(
- m_xMutex, *this, getStatics().tableTypeNames, getStatics().tableTypeData,
+ m_xMutex, *this, std::vector(getStatics().tableTypeNames), std::vector(getStatics().tableTypeData),
m_pSettings->tc );
}
@@ -1365,9 +1365,9 @@ namespace {
{
DatabaseTypeDescription()
{}
- DatabaseTypeDescription( const OUString &name, const OUString & type ) :
- typeName( name ),
- typeType( type )
+ DatabaseTypeDescription( OUString name, OUString type ) :
+ typeName(std::move( name )),
+ typeType(std::move( type ))
{}
DatabaseTypeDescription( const DatabaseTypeDescription &source ) :
typeName( source.typeName ),
@@ -1406,8 +1406,7 @@ static void columnMetaData2DatabaseTypeDescription(
oidMap[row->getInt(12)] = DatabaseTypeDescription();
if( domains )
queryBuf.append( " OR " );
- queryBuf.append( "oid = " );
- queryBuf.append( row->getInt(12 ) );
+ queryBuf.append( "oid = " + OUString::number( row->getInt(12 ) ) );
domains ++;
}
}
@@ -1535,8 +1534,8 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getColumns(
columnMetaData2DatabaseTypeDescription( domainMap, rs, domainTypeStmt );
sal_uInt32 colNum(0);
- OUString sSchema( "#invalid#" );
- OUString sTable( "#invalid#" );
+ OUString sSchema( u"#invalid#"_ustr );
+ OUString sTable( u"#invalid#"_ustr );
while( rs->next() )
{
@@ -1600,7 +1599,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getColumns(
closeable->close();
return new SequenceResultSet(
- m_xMutex, *this, statics.columnRowNames, vec, m_pSettings->tc );
+ m_xMutex, *this, std::vector(statics.columnRowNames), std::move(vec), m_pSettings->tc );
}
css::uno::Reference< XResultSet > DatabaseMetaData::getColumnPrivileges(
@@ -1686,14 +1685,14 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getPrimaryKeys(
<< schema << "." << table);
Reference< XPreparedStatement > statement = m_origin->prepareStatement(
- "SELECT nmsp.nspname, "
+ u"SELECT nmsp.nspname, "
"cl.relname, "
"con.conkey, "
"con.conname, "
"con.conrelid "
"FROM pg_constraint as con,pg_class as cl, pg_namespace as nmsp "
"WHERE con.connamespace = nmsp.oid AND con.conrelid = cl.oid AND con.contype = 'p' "
- "AND nmsp.nspname LIKE ? AND cl.relname LIKE ?" );
+ "AND nmsp.nspname LIKE ? AND cl.relname LIKE ?"_ustr );
Reference< XParameters > parameters( statement, UNO_QUERY_THROW );
parameters->setString( 1 , schema );
@@ -1754,9 +1753,9 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getPrimaryKeys(
row[4] >>= tableOid;
row[3] >>= attnum;
statement = m_origin->prepareStatement(
- "SELECT att.attname FROM "
+ u"SELECT att.attname FROM "
"pg_attribute AS att, pg_class AS cl WHERE "
- "att.attrelid = ? AND att.attnum = ?" );
+ "att.attrelid = ? AND att.attnum = ?"_ustr );
parameters.set( statement, UNO_QUERY_THROW );
parameters->setString( 1 , tableOid );
@@ -1779,11 +1778,11 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getPrimaryKeys(
if( closeable.is() )
closeable->close();
}
- ret[elements] = row;
+ ret[elements] = std::move(row);
elements ++;
}
return new SequenceResultSet(
- m_xMutex, *this, getStatics().primaryKeyNames, ret, m_pSettings->tc );
+ m_xMutex, *this, std::vector(getStatics().primaryKeyNames), std::move(ret), m_pSettings->tc );
}
// Copied / adapted / simplified from JDBC driver
@@ -1827,100 +1826,100 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getPrimaryKeys(
#define SQL_GET_REFERENCES_ORDER_NO_PTABLE "ORDER BY pkn.nspname, pkc.relname, conkeyseq"
#define SQL_GET_REFERENCES_NONE_NONE_NONE_NONE \
- SQL_GET_REFERENCES \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ u"" SQL_GET_REFERENCES \
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_NONE_NONE_NONE \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_NONE_SOME_NONE_NONE \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PTABLE \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_SOME_NONE_NONE \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
SQL_GET_REFERENCES_PTABLE \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
#define SQL_GET_REFERENCES_NONE_NONE_SOME_NONE \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_FSCHEMA \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_NONE_NONE_NONE_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_NONE_NONE_SOME_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_FSCHEMA \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_NONE_SOME_NONE \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
SQL_GET_REFERENCES_FSCHEMA \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_NONE_NONE_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_NONE_SOME_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
SQL_GET_REFERENCES_FSCHEMA \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_NO_PTABLE
+ SQL_GET_REFERENCES_ORDER_NO_PTABLE ""_ustr
#define SQL_GET_REFERENCES_NONE_SOME_SOME_NONE \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PTABLE \
SQL_GET_REFERENCES_FSCHEMA \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
#define SQL_GET_REFERENCES_NONE_SOME_NONE_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PTABLE \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
#define SQL_GET_REFERENCES_NONE_SOME_SOME_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PTABLE \
SQL_GET_REFERENCES_FSCHEMA \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_SOME_SOME_NONE \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
SQL_GET_REFERENCES_PTABLE \
SQL_GET_REFERENCES_FSCHEMA \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_SOME_NONE_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
SQL_GET_REFERENCES_PTABLE \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
#define SQL_GET_REFERENCES_SOME_SOME_SOME_SOME \
- SQL_GET_REFERENCES \
+ u"" SQL_GET_REFERENCES \
SQL_GET_REFERENCES_PSCHEMA \
SQL_GET_REFERENCES_PTABLE \
SQL_GET_REFERENCES_FSCHEMA \
SQL_GET_REFERENCES_FTABLE \
- SQL_GET_REFERENCES_ORDER_SOME_PTABLE
+ SQL_GET_REFERENCES_ORDER_SOME_PTABLE ""_ustr
void DatabaseMetaData::init_getReferences_stmt ()
{
@@ -2087,45 +2086,45 @@ namespace
OUString nameB;
a[0 /*TYPE_NAME*/] >>= nameA;
b[0 /*TYPE_NAME*/] >>= nameB;
- OUString nsA, tnA, nsB, tnB;
+ std::u16string_view nsA, tnA, nsB, tnB;
// parse typename into schema and typename
sal_Int32 nIndex=0;
- nsA = nameA.getToken(0, '.', nIndex);
+ nsA = o3tl::getToken(nameA, 0, '.', nIndex);
if (nIndex<0)
{
tnA = nsA;
- nsA.clear();
+ nsA = std::u16string_view();
}
else
{
- tnA = nameA.getToken(0, '.', nIndex);
+ tnA = o3tl::getToken(nameA, 0, '.', nIndex);
assert(nIndex < 0);
}
nIndex=0;
- nsB = nameB.getToken(0, '.', nIndex);
+ nsB = o3tl::getToken(nameB, 0, '.', nIndex);
if (nIndex<0)
{
tnB = nsB;
- nsB.clear();
+ nsB = std::u16string_view();
}
else
{
- tnB = nameB.getToken(0, '.', nIndex);
+ tnB = o3tl::getToken(nameB, 0, '.', nIndex);
assert(nIndex < 0);
}
const int ns_comp = compare_schema(nsA, nsB);
if(ns_comp == 0)
{
- if(nsA.isEmpty())
+ if(nsA.empty())
{
- assert(nsB.isEmpty());
+ assert(nsB.empty());
// within each type category, sort privileged choice first
- if( tnA == "int4" || tnA == "varchar" || tnA == "char" || tnA == "text")
+ if( tnA == u"int4" || tnA == u"varchar" || tnA == u"char" || tnA == u"text")
return true;
- if( tnB == "int4" || tnB == "varchar" || tnB == "char" || tnB == "text")
+ if( tnB == u"int4" || tnB == u"varchar" || tnB == u"char" || tnB == u"text")
return false;
}
return nameA.compareTo( nameB ) < 0;
@@ -2227,12 +2226,12 @@ namespace
// in postgresql the upper limit is optional, no limit means unlimited
// length (=1GB).
precision = 0x40000000; // about 1 GB, see character type docs in postgresql
- row[CREATE_PARAMS] <<= OUString("length");
+ row[CREATE_PARAMS] <<= u"length"_ustr;
}
else if( dataType == css::sdbc::DataType::NUMERIC )
{
precision = 1000;
- row[CREATE_PARAMS] <<= OUString("length, scale");
+ row[CREATE_PARAMS] <<= u"length, scale"_ustr;
}
row[TYPE_NAME] <<= construct_full_typename(xRow->getString(6), xRow->getString(1));
@@ -2244,15 +2243,15 @@ namespace
row[NULLABLE] <<= OUString::number(nullable);
row[CASE_SENSITIVE] <<= OUString::number(1);
row[SEARCHABLE] <<= OUString::number( calcSearchable( dataType ) );
- row[UNSIGNED_ATTRIBUTE] <<= OUString("0");
+ row[UNSIGNED_ATTRIBUTE] <<= u"0"_ustr;
if( css::sdbc::DataType::INTEGER == dataType ||
css::sdbc::DataType::BIGINT == dataType )
- row[AUTO_INCREMENT] <<= OUString("1"); // TODO
+ row[AUTO_INCREMENT] <<= u"1"_ustr; // TODO
else
- row[AUTO_INCREMENT] <<= OUString("0"); // TODO
- row[MINIMUM_SCALE] <<= OUString("0"); // TODO: what is this ?
+ row[AUTO_INCREMENT] <<= u"0"_ustr; // TODO
+ row[MINIMUM_SCALE] <<= u"0"_ustr; // TODO: what is this ?
row[MAXIMUM_SCALE] <<= OUString::number( getMaxScale( dataType ) );
- row[NUM_PREC_RADIX] <<= OUString("10"); // TODO: what is this ?
+ row[NUM_PREC_RADIX] <<= u"10"_ustr; // TODO: what is this ?
vec.push_back( row );
}
}
@@ -2268,7 +2267,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTypeInfo( )
Reference< XStatement > statement = m_origin->createStatement();
Reference< XResultSet > rs = statement->executeQuery(
- "SELECT pg_type.typname AS typname," //1
+ u"SELECT pg_type.typname AS typname," //1
"pg_type.typtype AS typtype," //2
"pg_type.typlen AS typlen," //3
"pg_type.typnotnull AS typnotnull," //4
@@ -2276,7 +2275,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTypeInfo( )
"pg_namespace.nspname as typns " //6
"FROM pg_type LEFT JOIN pg_namespace ON pg_type.typnamespace=pg_namespace.oid "
"WHERE pg_type.typtype = 'b' "
- "OR pg_type.typtype = 'p'"
+ "OR pg_type.typtype = 'p'"_ustr
);
std::vector< std::vector<Any> > vec;
@@ -2284,14 +2283,14 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTypeInfo( )
// check for domain types
rs = statement->executeQuery(
- "SELECT t1.typname as typname,"
+ u"SELECT t1.typname as typname,"
"t2.typtype AS typtype,"
"t2.typlen AS typlen,"
"t2.typnotnull AS typnotnull,"
"t2.typname as realtypname, "
"pg_namespace.nspname as typns "
"FROM pg_type as t1 LEFT JOIN pg_type AS t2 ON t1.typbasetype=t2.oid LEFT JOIN pg_namespace ON t1.typnamespace=pg_namespace.oid "
- "WHERE t1.typtype = 'd'" );
+ "WHERE t1.typtype = 'd'"_ustr );
pgTypeInfo2ResultSet( vec, rs );
std::sort( vec.begin(), vec.end(), TypeInfoByDataTypeSorter() );
@@ -2299,8 +2298,8 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTypeInfo( )
return new SequenceResultSet(
m_xMutex,
*this,
- getStatics().typeinfoColumnNames,
- vec,
+ std::vector(getStatics().typeinfoColumnNames),
+ std::move(vec),
m_pSettings->tc,
&( getStatics().typeInfoMetaData ));
}
@@ -2363,7 +2362,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getIndexInfo(
static const sal_Int32 R_COLUMN_NAME = 8;
Reference< XPreparedStatement > stmt = m_origin->prepareStatement(
- "SELECT nspname, " // 1
+ u"SELECT nspname, " // 1
"pg_class.relname, " // 2
"class2.relname, " // 3
"indisclustered, " // 4
@@ -2373,7 +2372,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getIndexInfo(
"FROM pg_index INNER JOIN pg_class ON indrelid = pg_class.oid "
"INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid "
"INNER JOIN pg_class as class2 ON pg_index.indexrelid = class2.oid "
- "WHERE nspname = ? AND pg_class.relname = ?" );
+ "WHERE nspname = ? AND pg_class.relname = ?"_ustr );
Reference< XParameters > param ( stmt, UNO_QUERY_THROW );
param->setString( 1, schema );
@@ -2386,11 +2385,11 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getIndexInfo(
{
std::vector< sal_Int32 > columns = parseIntArray( xRow->getString(C_COLUMNS) );
Reference< XPreparedStatement > columnsStmt = m_origin->prepareStatement(
- "SELECT attnum, attname "
+ u"SELECT attnum, attname "
"FROM pg_attribute "
" INNER JOIN pg_class ON attrelid = pg_class.oid "
" INNER JOIN pg_namespace ON pg_class.relnamespace=pg_namespace.oid "
- " WHERE pg_namespace.nspname=? AND pg_class.relname=?" );
+ " WHERE pg_namespace.nspname=? AND pg_class.relname=?"_ustr );
Reference< XParameters > paramColumn ( columnsStmt, UNO_QUERY_THROW );
OUString currentSchema = xRow->getString( C_SCHEMA );
OUString currentTable = xRow->getString( C_TABLENAME );
@@ -2424,8 +2423,8 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getIndexInfo(
}
}
return new SequenceResultSet(
- m_xMutex, *this, getStatics().indexinfoColumnNames,
- vec,
+ m_xMutex, *this, std::vector(getStatics().indexinfoColumnNames),
+ std::move(vec),
m_pSettings->tc );
}
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
index c016886f2643..4e8b717a96b2 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DATABASEMETADATA_HXX
+#pragma once
#include "pq_connection.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -75,8 +74,8 @@ class DatabaseMetaData :
public:
DatabaseMetaData(
- const ::rtl::Reference< comphelper::RefCountedMutex > & reMutex,
- const css::uno::Reference< css::sdbc::XConnection > & origin,
+ ::rtl::Reference< comphelper::RefCountedMutex > reMutex,
+ css::uno::Reference< css::sdbc::XConnection > origin,
ConnectionSettings *pSettings
);
@@ -235,6 +234,4 @@ public:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx
index 87eb5682a2b2..a1025017d8c7 100644
--- a/connectivity/source/drivers/postgresql/pq_driver.cxx
+++ b/connectivity/source/drivers/postgresql/pq_driver.cxx
@@ -40,12 +40,6 @@
#include "pq_driver.hxx"
-using osl::MutexGuard;
-
-using com::sun::star::lang::XSingleComponentFactory;
-using com::sun::star::lang::XServiceInfo;
-using com::sun::star::lang::XComponent;
-
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Reference;
using com::sun::star::uno::XInterface;
@@ -70,12 +64,10 @@ Reference< XConnection > Driver::connect(
if( ! acceptsURL( url ) ) // XDriver spec tells me to do so ...
return Reference< XConnection > ();
- Sequence< Any > seq ( 2 );
- seq[0] <<= url;
- seq[1] <<= info;
+ Sequence< Any > seq{ Any(url), Any(info) };
return Reference< XConnection> (
m_smgr->createInstanceWithArgumentsAndContext(
- "org.openoffice.comp.connectivity.pq.Connection.noext",
+ u"org.openoffice.comp.connectivity.pq.Connection.noext"_ustr,
seq, m_ctx ),
UNO_QUERY );
}
@@ -105,7 +97,7 @@ sal_Int32 Driver::getMinorVersion( )
// XServiceInfo
OUString SAL_CALL Driver::getImplementationName()
{
- return "org.openoffice.comp.connectivity.pq.Driver.noext";
+ return u"org.openoffice.comp.connectivity.pq.Driver.noext"_ustr;
}
sal_Bool Driver::supportsService(const OUString& ServiceName)
@@ -115,7 +107,7 @@ sal_Bool Driver::supportsService(const OUString& ServiceName)
Sequence< OUString > Driver::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr };
}
// XComponent
@@ -143,7 +135,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
connectivity_pq_sdbc_driver_get_implementation(
css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
- return cppu::acquire(static_cast<cppu::OWeakObject*>(new pq_sdbc_driver::Driver(context)));
+ return cppu::acquire(new pq_sdbc_driver::Driver(context));
}
diff --git a/connectivity/source/drivers/postgresql/pq_driver.hxx b/connectivity/source/drivers/postgresql/pq_driver.hxx
index 3b61a7bcf269..31d407f36965 100644
--- a/connectivity/source/drivers/postgresql/pq_driver.hxx
+++ b/connectivity/source/drivers/postgresql/pq_driver.hxx
@@ -34,12 +34,11 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DRIVER_HXX
+#pragma once
-#include <osl/mutex.hxx>
#include <sal/macros.h>
#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -55,7 +54,6 @@ namespace pq_sdbc_driver
SAL_STRINGIFY(PQ_SDBC_MINOR) "." \
SAL_STRINGIFY(PQ_SDBC_MICRO)
-struct MutexHolder { osl::Mutex m_mutex; };
// use this to switch off sdbc support !
// typedef cppu::WeakComponentImplHelper<
// css::sdbc::XDriver,
@@ -65,14 +63,14 @@ typedef cppu::WeakComponentImplHelper<
css::sdbc::XDriver,
css::lang::XServiceInfo,
css::sdbcx::XDataDefinitionSupplier > DriverBase ;
-class Driver : public MutexHolder, public DriverBase
+class Driver : public cppu::BaseMutex, public DriverBase
{
css::uno::Reference< css::uno::XComponentContext > m_ctx;
css::uno::Reference< css::lang::XMultiComponentFactory > m_smgr;
public:
explicit Driver ( const css::uno::Reference < css::uno::XComponentContext > & ctx )
- : DriverBase( m_mutex ),
+ : DriverBase( m_aMutex ),
m_ctx( ctx ),
m_smgr( ctx->getServiceManager() )
{}
@@ -115,6 +113,4 @@ public:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx
index a75897ccb211..216a25220355 100644
--- a/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/sdbc/SQLException.hpp>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <utility>
using com::sun::star::uno::Sequence;
@@ -58,9 +59,9 @@ FakedUpdateableResultSet::FakedUpdateableResultSet(
PGresult *result,
const OUString &schema,
const OUString &table,
- const OUString &aReason )
+ OUString aReason )
: ResultSet( mutex, owner, pSettings, result, schema, table ),
- m_aReason( aReason )
+ m_aReason(std::move( aReason ))
{}
diff --git a/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx b/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx
index 65113344cdec..44e7dc9bcf13 100644
--- a/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_FAKEDUPDATEABLERESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_FAKEDUPDATEABLERESULTSET_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#include <com/sun/star/sdbc/XRowUpdate.hpp>
@@ -62,11 +61,11 @@ public:
PGresult *result,
const OUString &schema,
const OUString &table,
- const OUString &aReason );
+ OUString aReason );
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { ResultSet::acquire(); }
- virtual void SAL_CALL release() throw() override { ResultSet::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ResultSet::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ResultSet::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -103,6 +102,5 @@ public: // XRowUpdate
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 344c27175850..0daacfbdc33f 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -40,7 +40,7 @@
#include "pq_statics.hxx"
#include "pq_statement.hxx"
-#include <o3tl/deleter.hxx>
+#include <o3tl/safeint.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -57,6 +57,7 @@
#include <string_view>
#include <connectivity/dbconversion.hxx>
+#include <utility>
using osl::MutexGuard;
@@ -90,31 +91,31 @@ static ::cppu::IPropertyArrayHelper & getPreparedStatementPropertyArrayHelper()
static ::cppu::OPropertyArrayHelper arrayHelper(
Sequence<Property>{
Property(
- "CursorName", 0,
+ u"CursorName"_ustr, 0,
::cppu::UnoType<OUString>::get() , 0 ),
Property(
- "EscapeProcessing", 1,
+ u"EscapeProcessing"_ustr, 1,
cppu::UnoType<bool>::get() , 0 ),
Property(
- "FetchDirection", 2,
+ u"FetchDirection"_ustr, 2,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "FetchSize", 3,
+ u"FetchSize"_ustr, 3,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "MaxFieldSize", 4,
+ u"MaxFieldSize"_ustr, 4,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "MaxRows", 5,
+ u"MaxRows"_ustr, 5,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "QueryTimeOut", 6,
+ u"QueryTimeOut"_ustr, 6,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "ResultSetConcurrency", 7,
+ u"ResultSetConcurrency"_ustr, 7,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "ResultSetType", 8,
+ u"ResultSetType"_ustr, 8,
::cppu::UnoType<sal_Int32>::get() , 0 )},
true );
static ::cppu::IPropertyArrayHelper *pArrayHelper = &arrayHelper;
@@ -149,12 +150,12 @@ PreparedStatement::PreparedStatement(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const Reference< XConnection > & conn,
struct ConnectionSettings *pSettings,
- const OString & stmt )
+ OString stmt )
: PreparedStatement_BASE(refMutex->GetMutex())
, OPropertySetHelper(PreparedStatement_BASE::rBHelper)
, m_connection(conn)
, m_pSettings(pSettings)
- , m_stmt(stmt)
+ , m_stmt(std::move(stmt))
, m_xMutex(refMutex)
, m_multipleResultAvailable(false)
, m_multipleResultUpdateCount(0)
@@ -198,7 +199,7 @@ PreparedStatement::~PreparedStatement()
void PreparedStatement::checkColumnIndex( sal_Int32 parameterIndex )
{
- if( parameterIndex < 1 || parameterIndex > static_cast<sal_Int32>(m_vars.size()) )
+ if( parameterIndex < 1 || o3tl::make_unsigned(parameterIndex) > m_vars.size() )
{
throw SQLException(
"pq_preparedstatement: parameter index out of range (expected 1 to "
@@ -213,7 +214,7 @@ void PreparedStatement::checkClosed()
{
if( ! m_pSettings || ! m_pSettings->pConnection )
throw SQLException(
- "pq_driver: PreparedStatement or connection has already been closed !",
+ u"pq_driver: PreparedStatement or connection has already been closed !"_ustr,
*this, OUString(),1,Any());
}
@@ -262,10 +263,9 @@ void PreparedStatement::close( )
void PreparedStatement::raiseSQLException( const char * errorMsg )
{
OUStringBuffer buf(128);
- buf.append( "pq_driver: ");
- buf.append(
- OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding ) );
- buf.append( " (caused by statement '" );
+ buf.append( "pq_driver: "
+ + OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding )
+ + " (caused by statement '" );
buf.appendAscii( m_executedStatement.getStr() );
buf.append( "')" );
OUString error = buf.makeStringAndClear();
@@ -390,7 +390,7 @@ void PreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 )
MutexGuard guard( m_xMutex->GetMutex() );
checkClosed();
checkColumnIndex( parameterIndex );
- m_vars[parameterIndex-1] = OString( "NULL" );
+ m_vars[parameterIndex-1] = "NULL"_ostr;
}
void PreparedStatement::setObjectNull(
@@ -399,7 +399,7 @@ void PreparedStatement::setObjectNull(
MutexGuard guard( m_xMutex->GetMutex() );
checkClosed();
checkColumnIndex( parameterIndex );
- m_vars[parameterIndex-1] = OString( "NULL" );
+ m_vars[parameterIndex-1] = "NULL"_ostr;
}
@@ -409,9 +409,9 @@ void PreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x )
checkClosed();
checkColumnIndex( parameterIndex );
if( x )
- m_vars[parameterIndex-1] = OString( "'t'" );
+ m_vars[parameterIndex-1] = "'t'"_ostr;
else
- m_vars[parameterIndex-1] = OString( "'f'" );
+ m_vars[parameterIndex-1] = "'f'"_ostr;
}
void PreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x )
@@ -486,7 +486,7 @@ void PreparedStatement::setBytes(
if( ! escapedString )
{
throw SQLException(
- "pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string",
+ u"pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string"_ustr,
*this, OUString(), 1, Any() );
}
m_vars[parameterIndex-1]
@@ -516,7 +516,7 @@ void PreparedStatement::setBinaryStream(
sal_Int32 )
{
throw SQLException(
- "pq_preparedstatement: setBinaryStream not implemented",
+ u"pq_preparedstatement: setBinaryStream not implemented"_ustr,
*this, OUString(), 1, Any () );
}
@@ -526,7 +526,7 @@ void PreparedStatement::setCharacterStream(
sal_Int32 )
{
throw SQLException(
- "pq_preparedstatement: setCharacterStream not implemented",
+ u"pq_preparedstatement: setCharacterStream not implemented"_ustr,
*this, OUString(), 1, Any () );
}
@@ -581,7 +581,7 @@ void PreparedStatement::setRef(
const Reference< XRef >& )
{
throw SQLException(
- "pq_preparedstatement: setRef not implemented",
+ u"pq_preparedstatement: setRef not implemented"_ustr,
*this, OUString(), 1, Any () );
}
@@ -590,7 +590,7 @@ void PreparedStatement::setBlob(
const Reference< XBlob >& )
{
throw SQLException(
- "pq_preparedstatement: setBlob not implemented",
+ u"pq_preparedstatement: setBlob not implemented"_ustr,
*this, OUString(), 1, Any () );
}
@@ -599,7 +599,7 @@ void PreparedStatement::setClob(
const Reference< XClob >& )
{
throw SQLException(
- "pq_preparedstatement: setClob not implemented",
+ u"pq_preparedstatement: setClob not implemented"_ustr,
*this, OUString(), 1, Any () );
}
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx
index eb0794f9efe0..ed81420cec7d 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_PREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_PREPAREDSTATEMENT_HXX
+#pragma once
#include <vector>
#include <libpq-fe.h>
@@ -99,12 +98,12 @@ public:
PreparedStatement( const rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection> & con,
struct ConnectionSettings *pSettings,
- const OString &stmt );
+ OString stmt );
virtual ~PreparedStatement() override;
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { PreparedStatement_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { PreparedStatement_BASE::release(); }
+ virtual void SAL_CALL acquire() noexcept override { PreparedStatement_BASE::acquire(); }
+ virtual void SAL_CALL release() noexcept override { PreparedStatement_BASE::release(); }
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & reqType ) override;
public: // XCloseable
@@ -218,6 +217,5 @@ private:
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_resultset.cxx b/connectivity/source/drivers/postgresql/pq_resultset.cxx
index 556bae92d5be..62b33fa10ba9 100644
--- a/connectivity/source/drivers/postgresql/pq_resultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultset.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
+#include <utility>
using osl::MutexGuard;
@@ -63,13 +64,13 @@ void ResultSet::checkClosed()
{
if( ! m_result )
{
- throw SQLException( "pq_resultset: already closed",
+ throw SQLException( u"pq_resultset: already closed"_ustr,
*this, OUString(), 1, Any() );
}
if( ! m_ppSettings || ! *m_ppSettings || ! (*m_ppSettings)->pConnection )
{
- throw SQLException( "pq_resultset: statement has been closed already",
+ throw SQLException( u"pq_resultset: statement has been closed already"_ustr,
*this, OUString(), 1, Any() );
}
@@ -79,14 +80,14 @@ ResultSet::ResultSet( const ::rtl::Reference< comphelper::RefCountedMutex > & re
const Reference< XInterface > & owner,
ConnectionSettings **ppSettings,
PGresult * result,
- const OUString &schema,
- const OUString &table)
+ OUString schema,
+ OUString table)
: BaseResultSet(
refMutex, owner, PQntuples( result ),
PQnfields( result ),(*ppSettings)->tc ),
m_result( result ),
- m_schema( schema ),
- m_table( table ),
+ m_schema(std::move( schema )),
+ m_table(std::move( table )),
m_ppSettings( ppSettings )
{
// LEM TODO: shouldn't these things be inherited from the statement or something like that?
@@ -164,7 +165,6 @@ sal_Int32 ResultSet::findColumn( const OUString& columnName )
else
{
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
}
return res;
}
diff --git a/connectivity/source/drivers/postgresql/pq_resultset.hxx b/connectivity/source/drivers/postgresql/pq_resultset.hxx
index 4b2bb6f41fb9..cf2888bf5b93 100644
--- a/connectivity/source/drivers/postgresql/pq_resultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_resultset.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_RESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_RESULTSET_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/component.hxx>
@@ -73,8 +72,8 @@ public:
const css::uno::Reference< css::uno::XInterface > &owner,
ConnectionSettings **pSettings,
PGresult *result,
- const OUString &schema,
- const OUString &table );
+ OUString schema,
+ OUString table );
virtual ~ResultSet() override;
public: // XCloseable
@@ -91,6 +90,5 @@ public:
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index fbe10f82dacb..26b11de27985 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
+#include <utility>
#include <string.h>
@@ -113,18 +114,18 @@ static void extractPrecisionAndScale( sal_Int32 atttypmod, sal_Int32 *precision,
}
ResultSetMetaData::ResultSetMetaData(
- const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
- const css::uno::Reference< css::sdbc::XResultSet > & origin,
+ ::rtl::Reference< comphelper::RefCountedMutex > refMutex,
+ css::uno::Reference< css::sdbc::XResultSet > origin,
ResultSet * pResultSet,
ConnectionSettings **ppSettings,
PGresult const *pResult,
- const OUString &schemaName,
- const OUString &tableName ) :
- m_xMutex( refMutex ),
+ OUString schemaName,
+ OUString tableName ) :
+ m_xMutex(std::move( refMutex )),
m_ppSettings( ppSettings ),
- m_origin( origin ),
- m_tableName( tableName ),
- m_schemaName( schemaName ),
+ m_origin(std::move( origin )),
+ m_tableName(std::move( tableName )),
+ m_schemaName(std::move( schemaName )),
m_colDesc( PQnfields( pResult ) ),
m_pResultSet( pResultSet ),
m_checkedForTable( false ),
@@ -166,8 +167,7 @@ void ResultSetMetaData::checkForTypes()
if( i > 0 )
buf.append( " OR " );
int oid = m_colDesc[i].typeOid;
- buf.append( "oid=" );
- buf.append( static_cast<sal_Int32>(oid) );
+ buf.append( "oid=" + OUString::number(static_cast<sal_Int32>(oid)) );
}
Reference< XResultSet > rs = stmt->executeQuery( buf.makeStringAndClear() );
Reference< XRow > xRow( rs, UNO_QUERY );
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
index 2c1b5e5e5965..71c98190ba2b 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_RESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_RESULTSETMETADATA_HXX
+#pragma once
#include <vector>
#include "pq_connection.hxx"
@@ -90,13 +89,13 @@ class ResultSetMetaData :
public:
ResultSetMetaData(
- const ::rtl::Reference< comphelper::RefCountedMutex > & reMutex,
- const css::uno::Reference< css::sdbc::XResultSet > & origin,
+ ::rtl::Reference< comphelper::RefCountedMutex > reMutex,
+ css::uno::Reference< css::sdbc::XResultSet > origin,
ResultSet *pResultSet,
ConnectionSettings **pSettings,
PGresult const *pResult,
- const OUString &schemaName,
- const OUString &tableName );
+ OUString schemaName,
+ OUString tableName );
public:
// Methods
@@ -125,6 +124,4 @@ public:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx b/connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx
index 02030729ad73..84db1fa63389 100644
--- a/connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx
@@ -65,17 +65,17 @@ Any SequenceResultSet::getValue( sal_Int32 columnIndex )
SequenceResultSet::SequenceResultSet(
const ::rtl::Reference< comphelper::RefCountedMutex > & mutex,
const css::uno::Reference< css::uno::XInterface > &owner,
- const std::vector< OUString > &colNames,
- const std::vector< std::vector< Any > > &data,
+ std::vector< OUString >&& colNames,
+ std::vector< std::vector< Any > >&& data,
const Reference< css::script::XTypeConverter > & tc,
const ColumnMetaDataVector *pVec) :
BaseResultSet( mutex, owner, data.size(), colNames.size(), tc ),
- m_data(data ),
- m_columnNames( colNames )
+ m_data(std::move(data) ),
+ m_columnNames( std::move(colNames) )
{
if( pVec )
{
- m_meta = new SequenceResultSetMetaData( *pVec, m_columnNames.size() );
+ m_meta = new SequenceResultSetMetaData( std::vector(*pVec), m_columnNames.size() );
}
}
@@ -95,11 +95,11 @@ Reference< XResultSetMetaData > SAL_CALL SequenceResultSet::getMetaData( )
{
// Oh no, not again
throw css::sdbc::SQLException(
- "pq_sequenceresultset: no meta supported ", *this,
+ u"pq_sequenceresultset: no meta supported "_ustr, *this,
// I did not find "IM001" in a specific standard,
// but it seems to be used by other systems (such as ODBC)
// and some parts of LibreOffice special-case it.
- "IM001", 1, Any() );
+ u"IM001"_ustr, 1, Any() );
}
return m_meta;
}
@@ -117,8 +117,6 @@ sal_Int32 SAL_CALL SequenceResultSet::findColumn(
}
}
::dbtools::throwInvalidColumnException( columnName, *this );
- assert(false);
- return 0; // Never reached
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx b/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx
index 3b97e24a3001..64ac212b6b76 100644
--- a/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_SEQUENCERESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_SEQUENCERESULTSET_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/component.hxx>
@@ -72,8 +71,8 @@ public:
SequenceResultSet(
const ::rtl::Reference< comphelper::RefCountedMutex > & mutex,
const css::uno::Reference< css::uno::XInterface > &owner,
- const std::vector< OUString > &colNames,
- const std::vector< std::vector< css::uno::Any > > &data,
+ std::vector< OUString >&& colNames,
+ std::vector< std::vector< css::uno::Any > >&& data,
const css::uno::Reference< css::script::XTypeConverter > &tc,
const ColumnMetaDataVector *pVec = nullptr);
virtual ~SequenceResultSet() override;
@@ -89,6 +88,5 @@ public: // XColumnLocate
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx
index d45ffc0a614a..568e6bb9f49d 100644
--- a/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx
@@ -46,9 +46,9 @@ namespace pq_sdbc_driver
{
SequenceResultSetMetaData::SequenceResultSetMetaData(
- const ColumnMetaDataVector &metaDataVector,
+ ColumnMetaDataVector&& metaDataVector,
int colCount ) :
- m_columnData( metaDataVector ),
+ m_columnData( std::move(metaDataVector) ),
m_colCount( colCount )
{
}
diff --git a/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx b/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx
index 2bba06aa7d2f..3cd32ff66d7a 100644
--- a/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_SEQUENCERESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_SEQUENCERESULTSETMETADATA_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
@@ -57,7 +56,7 @@ namespace pq_sdbc_driver
public:
SequenceResultSetMetaData(
- const ColumnMetaDataVector &vec,
+ ColumnMetaDataVector&& vec,
int colCount );
public:
@@ -87,6 +86,4 @@ namespace pq_sdbc_driver
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_SEQUENCERESULTSETMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 946d25b0c91e..5867d5cdbf33 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -44,7 +44,6 @@
#include <osl/time.h>
#include <rtl/ustrbuf.hxx>
-#include <rtl/strbuf.hxx>
#include <comphelper/sequence.hxx>
@@ -60,6 +59,7 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <cstddef>
#include <string.h>
#include <string_view>
@@ -103,31 +103,31 @@ static ::cppu::IPropertyArrayHelper & getStatementPropertyArrayHelper()
static ::cppu::OPropertyArrayHelper arrayHelper(
Sequence<Property>{
Property(
- "CursorName", 0,
+ u"CursorName"_ustr, 0,
::cppu::UnoType<OUString>::get() , 0 ),
Property(
- "EscapeProcessing", 1,
+ u"EscapeProcessing"_ustr, 1,
cppu::UnoType<bool>::get() , 0 ),
Property(
- "FetchDirection", 2,
+ u"FetchDirection"_ustr, 2,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "FetchSize", 3,
+ u"FetchSize"_ustr, 3,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "MaxFieldSize", 4,
+ u"MaxFieldSize"_ustr, 4,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "MaxRows", 5,
+ u"MaxRows"_ustr, 5,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "QueryTimeOut", 6,
+ u"QueryTimeOut"_ustr, 6,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "ResultSetConcurrency", 7,
+ u"ResultSetConcurrency"_ustr, 7,
::cppu::UnoType<sal_Int32>::get() , 0 ),
Property(
- "ResultSetType", 8,
+ u"ResultSetType"_ustr, 8,
::cppu::UnoType<sal_Int32>::get() , 0 )},
true );
@@ -162,7 +162,7 @@ void Statement::checkClosed()
{
if( ! m_pSettings || ! m_pSettings->pConnection )
throw SQLException(
- "pq_driver: Statement or connection has already been closed !",
+ u"pq_driver: Statement or connection has already been closed !"_ustr,
*this, OUString(),1,Any());
}
@@ -253,10 +253,10 @@ static void raiseSQLException(
buf.append( "]" );
}
buf.append(
- OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding ) );
- buf.append( " (caused by statement '" );
- buf.append( OStringToOUString( sql, ConnectionSettings::encoding ) );
- buf.append( "')" );
+ OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding )
+ + " (caused by statement '"
+ + OStringToOUString( sql, ConnectionSettings::encoding )
+ + "')" );
OUString error = buf.makeStringAndClear();
SAL_WARN("connectivity.postgresql", error);
throw SQLException( error, owner, OUString(), 1, Any() );
@@ -430,8 +430,8 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
&table);
// check, whether the columns are in the result set (required !)
- int i;
- for( i = 0 ; i < static_cast<int>(sourceTableKeys.size()) ; i ++ )
+ std::size_t i;
+ for( i = 0 ; i < sourceTableKeys.size() ; i ++ )
{
if( -1 == PQfnumber(
result,
@@ -442,12 +442,12 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
}
}
- if( !sourceTableKeys.empty() && i == static_cast<int>(sourceTableKeys.size()) )
+ if( !sourceTableKeys.empty() && i == sourceTableKeys.size() )
{
*(data->pLastResultset) =
UpdateableResultSet::createFromPGResultSet(
data->refMutex, data->owner, data->ppSettings, result,
- schema, table,sourceTableKeys );
+ schema, table, std::move(sourceTableKeys) );
}
else if( ! table.getLength() )
{
@@ -456,15 +456,12 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
}
else if( !sourceTableKeys.empty() )
{
- OStringBuffer buf( 128 );
- buf.append( "can't support updateable resultset for table " );
- buf.append( OUStringToOString( schema, ConnectionSettings::encoding ) );
- buf.append( "." );
- buf.append( OUStringToOString( table, ConnectionSettings::encoding ) );
- buf.append( ", because resultset does not contain a part of the primary key ( column " );
- buf.append( OUStringToOString( sourceTableKeys[i], ConnectionSettings::encoding ) );
- buf.append( " is missing )" );
- aReason = buf.makeStringAndClear();
+ aReason = "can't support updateable resultset for table "
+ + OUStringToOString( schema, ConnectionSettings::encoding ) + "."
+ + OUStringToOString( table, ConnectionSettings::encoding )
+ + ", because resultset does not contain a part of the primary key ( column "
+ + OUStringToOString( sourceTableKeys[i], ConnectionSettings::encoding )
+ + " is missing )";
}
else
{
@@ -534,12 +531,12 @@ static Sequence< OUString > getPrimaryKeyColumnNames(
// retrieve the primary key ...
Reference< XPreparedStatement > stmt = connection->prepareStatement(
- "SELECT conkey " // 7
+ u"SELECT conkey " // 7
"FROM pg_constraint INNER JOIN pg_class ON conrelid = pg_class.oid "
"INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid "
"LEFT JOIN pg_class AS class2 ON confrelid = class2.oid "
"LEFT JOIN pg_namespace AS nmsp2 ON class2.relnamespace=nmsp2.oid "
- "WHERE pg_class.relname = ? AND pg_namespace.nspname = ? AND pg_constraint.contype='p'" );
+ "WHERE pg_class.relname = ? AND pg_namespace.nspname = ? AND pg_constraint.contype='p'"_ustr );
DisposeGuard guard( stmt );
Reference< XParameters > paras( stmt, UNO_QUERY );
paras->setString( 1 , tableName );
@@ -559,7 +556,7 @@ static void getAutoValues(
const Reference< XConnection > & connection,
const OUString &schemaName,
const OUString & tableName,
- ConnectionSettings *pConnectionSettings )
+ const ConnectionSettings *pConnectionSettings )
{
OUString strDefaultValue = getColExprForDefaultSettingVal(pConnectionSettings);
Reference< XPreparedStatement > stmt = connection->prepareStatement(
@@ -593,7 +590,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
ConnectionSettings *pConnectionSettings,
const Reference< XConnection > &connection,
sal_Int32 nLastOid,
- const OUString & lastTableInserted,
+ std::u16string_view lastTableInserted,
const OString & lastQuery )
{
Reference< XResultSet > ret;
@@ -602,7 +599,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
splitConcatenatedIdentifier(
lastTableInserted, &schemaName, &tableName );
- if( nLastOid && lastTableInserted.getLength() )
+ if( nLastOid && lastTableInserted.size() )
{
OUStringBuffer buf( 128 );
buf.append( "SELECT * FROM " );
@@ -610,11 +607,10 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
bufferQuoteQualifiedIdentifier(buf, schemaName, tableName, pConnectionSettings );
else
bufferQuoteIdentifier( buf, lastTableInserted, pConnectionSettings );
- buf.append( " WHERE oid = " );
- buf.append( nLastOid );
+ buf.append( " WHERE oid = " + OUString::number(nLastOid) );
query = buf.makeStringAndClear();
}
- else if ( lastTableInserted.getLength() && lastQuery.getLength() )
+ else if ( lastTableInserted.size() && lastQuery.getLength() )
{
// extract nameValue Pairs
String2StringMap namedValues;
@@ -703,8 +699,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
if( bAdditionalCondition )
buf.append( " AND " );
bufferQuoteIdentifier( buf, columnNameUnicode, pConnectionSettings );
- buf.append( " = " );
- buf.append( value );
+ buf.append( " = " + value );
bAdditionalCondition = true;
}
query = buf.makeStringAndClear();
diff --git a/connectivity/source/drivers/postgresql/pq_statement.hxx b/connectivity/source/drivers/postgresql/pq_statement.hxx
index 6f9fb3bb1ecc..816d2a55afaa 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.hxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATEMENT_HXX
+#pragma once
#include <sal/config.h>
@@ -101,8 +100,8 @@ public:
virtual ~Statement() override;
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { Statement_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { Statement_BASE::release(); }
+ virtual void SAL_CALL acquire() noexcept override { Statement_BASE::acquire(); }
+ virtual void SAL_CALL release() noexcept override { Statement_BASE::release(); }
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & reqType ) override;
public: // XCloseable
@@ -190,11 +189,10 @@ css::uno::Reference< css::sdbc::XResultSet > getGeneratedValuesFromLastInsert(
ConnectionSettings *pConnectionSettings,
const css::uno::Reference< css::sdbc::XConnection > &connection,
sal_Int32 nLastOid,
- const OUString & lastTableInserted,
+ std::u16string_view lastTableInserted,
const OString & lastQuery );
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx
index a68242e2c55d..937e8df26686 100644
--- a/connectivity/source/drivers/postgresql/pq_statics.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statics.cxx
@@ -35,9 +35,9 @@
************************************************************************/
#include "pq_statics.hxx"
-#include "pq_updateableresultset.hxx"
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <utility>
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Any;
@@ -69,8 +69,8 @@ struct BaseTypeDef { const char * typeName; sal_Int32 value; };
struct PropertyDef
{
- PropertyDef( const OUString &str, const Type &t )
- : name( str ) , type( t ) {}
+ PropertyDef( OUString str, const Type &t )
+ : name(std::move( str )) , type( t ) {}
OUString name;
css::uno::Type type;
};
@@ -89,9 +89,10 @@ static cppu::IPropertyArrayHelper * createPropertyArrayHelper(
PropertyDef const *props, int count , sal_Int16 attr )
{
Sequence< Property > seq( count );
+ auto seqRange = asNonConstRange(seq);
for( int i = 0 ; i < count ; i ++ )
{
- seq[i] = Property( props[i].name, i, props[i].type, attr );
+ seqRange[i] = Property( props[i].name, i, props[i].type, attr );
}
return new cppu::OPropertyArrayHelper( seq, true );
}
@@ -100,9 +101,10 @@ static cppu::IPropertyArrayHelper * createPropertyArrayHelper(
PropertyDefEx const *props, int count )
{
Sequence< Property > seq( count );
+ auto seqRange = asNonConstRange(seq);
for( int i = 0 ; i < count ; i ++ )
{
- seq[i] = Property( props[i].name, i, props[i].type, props[i].attribute );
+ seqRange[i] = Property( props[i].name, i, props[i].type, props[i].attribute );
}
return new cppu::OPropertyArrayHelper( seq, true );
}
@@ -184,8 +186,7 @@ Statics & getStatics()
// Table props set
ImplementationStatics &ist = statics.refl.table;
ist.implName = "org.openoffice.comp.pq.sdbcx.Table";
- ist.serviceNames = Sequence< OUString > ( 1 );
- ist.serviceNames[0] = "com.sun.star.sdbcx.Table";
+ ist.serviceNames = { u"com.sun.star.sdbcx.Table"_ustr };
PropertyDef tableDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -196,13 +197,11 @@ Statics & getStatics()
PropertyDef( statics.TYPE , tString )
};
ist.pProps = createPropertyArrayHelper(
- tableDef, SAL_N_ELEMENTS(tableDef), READONLY );
+ tableDef, std::size(tableDef), READONLY );
statics.refl.tableDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.TableDescriptor";
- statics.refl.tableDescriptor.serviceNames = Sequence< OUString > (1);
- statics.refl.tableDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.TableDescriptor";
+ statics.refl.tableDescriptor.serviceNames = { u"com.sun.star.sdbcx.TableDescriptor"_ustr };
PropertyDef tableDescDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -212,12 +211,11 @@ Statics & getStatics()
PropertyDef( statics.SCHEMA_NAME , tString )
};
statics.refl.tableDescriptor.pProps = createPropertyArrayHelper(
- tableDescDef, SAL_N_ELEMENTS(tableDescDef), 0 );
+ tableDescDef, std::size(tableDescDef), 0 );
// Column props set
statics.refl.column.implName = "org.openoffice.comp.pq.sdbcx.Column";
- statics.refl.column.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.column.serviceNames[0] = "com.sun.star.sdbcx.Column";
+ statics.refl.column.serviceNames = { u"com.sun.star.sdbcx.Column"_ustr };
PropertyDefEx columnDef[] =
{
PropertyDefEx( statics.CATALOG_NAME , tString, READONLY ),
@@ -235,13 +233,11 @@ Statics & getStatics()
PropertyDefEx( statics.TYPE_NAME , tString ,READONLY)
};
statics.refl.column.pProps = createPropertyArrayHelper(
- columnDef, SAL_N_ELEMENTS(columnDef) );
+ columnDef, std::size(columnDef) );
statics.refl.columnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.ColumnDescriptor";
- statics.refl.columnDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.columnDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.ColumnDescriptor";
+ statics.refl.columnDescriptor.serviceNames = { u"com.sun.star.sdbcx.ColumnDescriptor"_ustr };
PropertyDef columnDescDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -260,12 +256,11 @@ Statics & getStatics()
};
statics.refl.columnDescriptor.pProps = createPropertyArrayHelper(
- columnDescDef, SAL_N_ELEMENTS(columnDescDef), 0 );
+ columnDescDef, std::size(columnDescDef), 0 );
// Key properties
statics.refl.key.implName = "org.openoffice.comp.pq.sdbcx.Key";
- statics.refl.key.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.key.serviceNames[0] = "com.sun.star.sdbcx.Key";
+ statics.refl.key.serviceNames = { u"com.sun.star.sdbcx.Key"_ustr };
PropertyDef keyDef[] =
{
PropertyDef( statics.DELETE_RULE, tInt ),
@@ -277,15 +272,13 @@ Statics & getStatics()
PropertyDef( statics.UPDATE_RULE, tInt )
};
statics.refl.key.pProps = createPropertyArrayHelper(
- keyDef, SAL_N_ELEMENTS(keyDef), READONLY );
+ keyDef, std::size(keyDef), READONLY );
// Key properties
statics.refl.keyDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.KeyDescriptor";
- statics.refl.keyDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.keyDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.KeyDescriptor";
+ statics.refl.keyDescriptor.serviceNames = { u"com.sun.star.sdbcx.KeyDescriptor"_ustr };
PropertyDef keyDescDef[] =
{
PropertyDef( statics.DELETE_RULE, tInt ),
@@ -295,13 +288,12 @@ Statics & getStatics()
PropertyDef( statics.UPDATE_RULE, tInt )
};
statics.refl.keyDescriptor.pProps = createPropertyArrayHelper(
- keyDescDef, SAL_N_ELEMENTS(keyDescDef), 0 );
+ keyDescDef, std::size(keyDescDef), 0 );
// KeyColumn props set
statics.refl.keycolumn.implName = "org.openoffice.comp.pq.sdbcx.KeyColumn";
- statics.refl.keycolumn.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.keycolumn.serviceNames[0] = "com.sun.star.sdbcx.KeyColumn";
+ statics.refl.keycolumn.serviceNames = { u"com.sun.star.sdbcx.KeyColumn"_ustr };
PropertyDef keycolumnDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -319,26 +311,24 @@ Statics & getStatics()
PropertyDef( statics.TYPE_NAME , tString )
};
statics.refl.keycolumn.pProps = createPropertyArrayHelper(
- keycolumnDef, SAL_N_ELEMENTS(keycolumnDef), READONLY );
+ keycolumnDef, std::size(keycolumnDef), READONLY );
// KeyColumn props set
statics.refl.keycolumnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.KeyColumnDescriptor";
- statics.refl.keycolumnDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.keycolumnDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.KeyColumnDescriptor";
+ statics.refl.keycolumnDescriptor.serviceNames =
+ { u"com.sun.star.sdbcx.KeyColumnDescriptor"_ustr };
PropertyDef keycolumnDescDef[] =
{
PropertyDef( statics.NAME , tString ),
PropertyDef( statics.RELATED_COLUMN, tString )
};
statics.refl.keycolumnDescriptor.pProps = createPropertyArrayHelper(
- keycolumnDescDef, SAL_N_ELEMENTS(keycolumnDescDef), 0 );
+ keycolumnDescDef, std::size(keycolumnDescDef), 0 );
// view props set
statics.refl.view.implName = "org.openoffice.comp.pq.sdbcx.View";
- statics.refl.view.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.view.serviceNames[0] = "com.sun.star.sdbcx.View";
+ statics.refl.view.serviceNames = { u"com.sun.star.sdbcx.View"_ustr };
PropertyDef viewDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -348,43 +338,38 @@ Statics & getStatics()
PropertyDef( statics.SCHEMA_NAME , tString )
};
statics.refl.view.pProps = createPropertyArrayHelper(
- viewDef, SAL_N_ELEMENTS(viewDef), READONLY );
+ viewDef, std::size(viewDef), READONLY );
// view props set
statics.refl.viewDescriptor.implName = "org.openoffice.comp.pq.sdbcx.ViewDescriptor";
- statics.refl.viewDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.viewDescriptor.serviceNames[0] = "com.sun.star.sdbcx.ViewDescriptor";
+ statics.refl.viewDescriptor.serviceNames = { u"com.sun.star.sdbcx.ViewDescriptor"_ustr };
statics.refl.viewDescriptor.pProps = createPropertyArrayHelper(
- viewDef, SAL_N_ELEMENTS(viewDef), 0 ); // reuse view, as it is identical
+ viewDef, std::size(viewDef), 0 ); // reuse view, as it is identical
// user props set
statics.refl.user.implName = "org.openoffice.comp.pq.sdbcx.User";
- statics.refl.user.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.user.serviceNames[0] = "com.sun.star.sdbcx.User";
+ statics.refl.user.serviceNames = { u"com.sun.star.sdbcx.User"_ustr };
PropertyDef userDefRO[] =
{
PropertyDef( statics.NAME , tString )
};
statics.refl.user.pProps = createPropertyArrayHelper(
- userDefRO, SAL_N_ELEMENTS(userDefRO), READONLY );
+ userDefRO, std::size(userDefRO), READONLY );
// user props set
statics.refl.userDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.UserDescriptor";
- statics.refl.userDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.userDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.UserDescriptor";
+ statics.refl.userDescriptor.serviceNames = { u"com.sun.star.sdbcx.UserDescriptor"_ustr };
PropertyDef userDefWR[] =
{
PropertyDef( statics.NAME , tString ),
PropertyDef( statics.PASSWORD , tString )
};
statics.refl.userDescriptor.pProps = createPropertyArrayHelper(
- userDefWR, SAL_N_ELEMENTS(userDefWR), 0 );
+ userDefWR, std::size(userDefWR), 0 );
// index props set
statics.refl.index.implName = "org.openoffice.comp.pq.sdbcx.Index";
- statics.refl.index.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.index.serviceNames[0] = "com.sun.star.sdbcx.Index";
+ statics.refl.index.serviceNames = { u"com.sun.star.sdbcx.Index"_ustr };
PropertyDef indexDef[] =
{
PropertyDef( statics.CATALOG , tString ),
@@ -395,21 +380,18 @@ Statics & getStatics()
PropertyDef( statics.PRIVATE_COLUMN_INDEXES, tStringSequence )
};
statics.refl.index.pProps = createPropertyArrayHelper(
- indexDef, SAL_N_ELEMENTS(indexDef), READONLY );
+ indexDef, std::size(indexDef), READONLY );
// index props set
statics.refl.indexDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.IndexDescriptor";
- statics.refl.indexDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.indexDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.IndexDescriptor";
+ statics.refl.indexDescriptor.serviceNames = { u"com.sun.star.sdbcx.IndexDescriptor"_ustr };
statics.refl.indexDescriptor.pProps = createPropertyArrayHelper(
- indexDef, SAL_N_ELEMENTS(indexDef), 0 );
+ indexDef, std::size(indexDef), 0 );
// indexColumn props set
statics.refl.indexColumn.implName = "org.openoffice.comp.pq.sdbcx.IndexColumn";
- statics.refl.indexColumn.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.indexColumn.serviceNames[0] = "com.sun.star.sdbcx.IndexColumn";
+ statics.refl.indexColumn.serviceNames = { u"com.sun.star.sdbcx.IndexColumn"_ustr };
PropertyDef indexColumnDef[] =
{
PropertyDef( statics.CATALOG_NAME , tString ),
@@ -427,47 +409,20 @@ Statics & getStatics()
PropertyDef( statics.TYPE_NAME , tString )
};
statics.refl.indexColumn.pProps = createPropertyArrayHelper(
- indexColumnDef, SAL_N_ELEMENTS(indexColumnDef), READONLY );
+ indexColumnDef, std::size(indexColumnDef), READONLY );
// indexColumn props set
statics.refl.indexColumnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.IndexColumnDescriptor";
- statics.refl.indexColumnDescriptor.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.indexColumnDescriptor.serviceNames[0] =
- "com.sun.star.sdbcx.IndexColumnDescriptor";
+ statics.refl.indexColumnDescriptor.serviceNames =
+ { u"com.sun.star.sdbcx.IndexColumnDescriptor"_ustr };
PropertyDef indexColumnDescDef[] =
{
PropertyDef( statics.IS_ASCENDING, tBool ),
PropertyDef( statics.NAME , tString )
};
statics.refl.indexColumnDescriptor.pProps = createPropertyArrayHelper(
- indexColumnDescDef, SAL_N_ELEMENTS(indexColumnDescDef), 0 );
-
- // resultset
- statics.refl.resultSet.implName = "org.openoffice.comp.pq.ResultSet";
- statics.refl.resultSet.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.resultSet.serviceNames[0] = "com.sun.star.sdbc.ResultSet";
- statics.refl.resultSet.types = UpdateableResultSet::getStaticTypes( false /* updateable */ );
- PropertyDef resultSet[] =
- {
- PropertyDef( statics.CURSOR_NAME , tString ),
- PropertyDef( statics.ESCAPE_PROCESSING , tBool ),
- PropertyDef( statics.FETCH_DIRECTION , tInt ),
- PropertyDef( statics.FETCH_SIZE , tInt ),
- PropertyDef( statics.IS_BOOKMARKABLE , tBool ),
- PropertyDef( statics.RESULT_SET_CONCURRENCY , tInt ),
- PropertyDef( statics.RESULT_SET_TYPE , tInt )
- };
- statics.refl.resultSet.pProps = createPropertyArrayHelper(
- resultSet, SAL_N_ELEMENTS(resultSet), 0 );
-
- // updateableResultset
- statics.refl.updateableResultSet.implName = "org.openoffice.comp.pq.UpdateableResultSet";
- statics.refl.updateableResultSet.serviceNames = Sequence< OUString > ( 1 );
- statics.refl.updateableResultSet.serviceNames[0] = "com.sun.star.sdbc.ResultSet";
- statics.refl.updateableResultSet.types = UpdateableResultSet::getStaticTypes( true /* updateable */ );
- statics.refl.updateableResultSet.pProps = createPropertyArrayHelper(
- resultSet, SAL_N_ELEMENTS(resultSet), 0 );
+ indexColumnDescDef, std::size(indexColumnDescDef), 0 );
// databasemetadata
statics.tablesRowNames = std::vector< OUString > ( 5 );
@@ -518,32 +473,32 @@ Statics & getStatics()
statics.columnRowNames =
{
- "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME",
- "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH",
- "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS",
- "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH",
- "ORDINAL_POSITION", "IS_NULLABLE"
+ u"TABLE_CAT"_ustr, u"TABLE_SCHEM"_ustr, u"TABLE_NAME"_ustr, u"COLUMN_NAME"_ustr,
+ u"DATA_TYPE"_ustr, u"TYPE_NAME"_ustr, u"COLUMN_SIZE"_ustr, u"BUFFER_LENGTH"_ustr,
+ u"DECIMAL_DIGITS"_ustr, u"NUM_PREC_RADIX"_ustr, u"NULLABLE"_ustr, u"REMARKS"_ustr,
+ u"COLUMN_DEF"_ustr, u"SQL_DATA_TYPE"_ustr, u"SQL_DATETIME_SUB"_ustr, u"CHAR_OCTET_LENGTH"_ustr,
+ u"ORDINAL_POSITION"_ustr, u"IS_NULLABLE"_ustr
};
statics.typeinfoColumnNames =
{
- "TYPE_NAME", "DATA_TYPE", "PRECISION", "LITERAL_PREFIX",
- "LITERAL_SUFFIX", "CREATE_PARAMS", "NULLABLE", "CASE_SENSITIVE",
- "SEARCHABLE", "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE",
- "AUTO_INCREMENT", "LOCAL_TYPE_NAME", "MINIMUM_SCALE",
- "MAXIMUM_SCALE", "SQL_DATA_TYPE", "SQL_DATETIME_SUB",
- "NUM_PREC_RADIX"
+ u"TYPE_NAME"_ustr, u"DATA_TYPE"_ustr, u"PRECISION"_ustr, u"LITERAL_PREFIX"_ustr,
+ u"LITERAL_SUFFIX"_ustr, u"CREATE_PARAMS"_ustr, u"NULLABLE"_ustr, u"CASE_SENSITIVE"_ustr,
+ u"SEARCHABLE"_ustr, u"UNSIGNED_ATTRIBUTE"_ustr, u"FIXED_PREC_SCALE"_ustr,
+ u"AUTO_INCREMENT"_ustr, u"LOCAL_TYPE_NAME"_ustr, u"MINIMUM_SCALE"_ustr,
+ u"MAXIMUM_SCALE"_ustr, u"SQL_DATA_TYPE"_ustr, u"SQL_DATETIME_SUB"_ustr,
+ u"NUM_PREC_RADIX"_ustr
};
statics.indexinfoColumnNames =
{
- "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
- "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME",
- "TYPE", "ORDINAL_POSITION", "COLUMN_NAME",
- "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION"
+ u"TABLE_CAT"_ustr, u"TABLE_SCHEM"_ustr, u"TABLE_NAME"_ustr,
+ u"NON_UNIQUE"_ustr, u"INDEX_QUALIFIER"_ustr, u"INDEX_NAME"_ustr,
+ u"TYPE"_ustr, u"ORDINAL_POSITION"_ustr, u"COLUMN_NAME"_ustr,
+ u"ASC_OR_DESC"_ustr, u"CARDINALITY"_ustr, u"PAGES"_ustr, u"FILTER_CONDITION"_ustr
};
- statics.resultSetArrayColumnNames = { "INDEX" , "VALUE" };
+ statics.resultSetArrayColumnNames = { u"INDEX"_ustr , u"VALUE"_ustr };
// LEM TODO see if a refresh is needed; obtain automatically from pg_catalog.pg_type?
BaseTypeDef baseTypeDefs[] =
diff --git a/connectivity/source/drivers/postgresql/pq_statics.hxx b/connectivity/source/drivers/postgresql/pq_statics.hxx
index 017f49b5a655..4e745e4086ee 100644
--- a/connectivity/source/drivers/postgresql/pq_statics.hxx
+++ b/connectivity/source/drivers/postgresql/pq_statics.hxx
@@ -34,10 +34,10 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATICS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATICS_HXX
+#pragma once
#include <unordered_map>
+#include <utility>
#include <vector>
#include <com/sun/star/uno/Any.hxx>
@@ -51,20 +51,20 @@ namespace pq_sdbc_driver
struct ColumnMetaData
{
ColumnMetaData(
- const OUString &_columnName,
- const OUString &_tableName,
- const OUString &_schemaTableName,
- const OUString &_typeName,
+ OUString _columnName,
+ OUString _tableName,
+ OUString _schemaTableName,
+ OUString _typeName,
sal_Int32 _type,
sal_Int32 _precision,
sal_Int32 _scale,
bool _isCurrency,
bool _isNullable,
bool _isAutoIncrement ) :
- columnName( _columnName ),
- tableName( _tableName ),
- schemaTableName( _schemaTableName ),
- typeName( _typeName ),
+ columnName(std::move( _columnName )),
+ tableName(std::move( _tableName )),
+ schemaTableName(std::move( _schemaTableName )),
+ typeName(std::move( _typeName )),
type( _type ),
precision( _precision ),
scale( _scale ),
@@ -123,9 +123,6 @@ struct ReflectionImplementations
struct ImplementationStatics indexDescriptor;
struct ImplementationStatics indexColumn;
struct ImplementationStatics indexColumnDescriptor;
-
- struct ImplementationStatics updateableResultSet;
- struct ImplementationStatics resultSet;
};
const sal_Int32 TABLE_INDEX_CATALOG = 0;
@@ -239,6 +236,5 @@ private:
Statics & getStatics();
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 1bb089a5407a..b6e5d28f938e 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -37,6 +37,7 @@
#include <sal/config.h>
#include <o3tl/any.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
@@ -79,7 +80,6 @@ using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::XInterface;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::container::XEnumeration;
using com::sun::star::container::XEnumerationAccess;
@@ -118,14 +118,14 @@ void bufferEscapeConstant( OUStringBuffer & buf, std::u16string_view value, Conn
// We have no good XInterface Reference to pass here, so just give NULL
throw SQLException(OUString(errstr, strlen(errstr), ConnectionSettings::encoding),
nullptr,
- "22018",
+ u"22018"_ustr,
-1,
Any());
}
strbuf.setLength( len );
// Previously here RTL_TEXTENCODING_ASCII_US; as we set the PostgreSQL client_encoding to UTF8,
// we get UTF8 here, too. I'm not sure why it worked well before...
- buf.append( OStringToOUString( strbuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) );
+ buf.append( OStringToOUString( strbuf, RTL_TEXTENCODING_UTF8 ) );
}
static void ibufferQuoteConstant( OUStringBuffer & buf, std::u16string_view value, ConnectionSettings *settings )
@@ -154,7 +154,7 @@ void bufferQuoteAnyConstant( OUStringBuffer & buf, const Any &val, ConnectionSet
static void ibufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view toQuote, ConnectionSettings *settings )
{
- OSL_ENSURE(settings, "pgsql-sdbc: bufferQuoteIdentifier got NULL settings");
+ assert(settings && "pgsql-sdbc: bufferQuoteIdentifier got NULL settings");
OString y = iOUStringToOString( toQuote, settings );
char *cstr = PQescapeIdentifier(settings->pConnection, y.getStr(), y.getLength());
@@ -164,7 +164,7 @@ static void ibufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view to
// Implementation-defined SQLACCESS error
throw SQLException(OUString(errstr, strlen(errstr), ConnectionSettings::encoding),
nullptr,
- "22018",
+ u"22018"_ustr,
-1,
Any());
}
@@ -259,7 +259,7 @@ Reference< XConnection > extractConnectionFromStatement( const Reference< XInter
ret = myowner->getConnection();
if( ! ret.is() )
throw SQLException(
- "PQSDBC: Couldn't retrieve connection from statement",
+ u"PQSDBC: Couldn't retrieve connection from statement"_ustr,
Reference< XInterface > () , OUString(), 0 , css::uno::Any() );
}
@@ -315,30 +315,30 @@ bool isWhitespace( sal_Unicode c )
return ' ' == c || 9 == c || 10 == c || 13 == c;
}
-OUString extractTableFromInsert( const OUString & sql )
+OUString extractTableFromInsert( std::u16string_view sql )
{
OUString ret;
- int i = 0;
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ size_t i = 0;
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
- if( sql.matchIgnoreAsciiCase("insert", i) )
+ if( o3tl::matchIgnoreAsciiCase(sql, u"insert", i) )
{
i += 6;
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
- if( sql.matchIgnoreAsciiCase("into", i) )
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
+ if( o3tl::matchIgnoreAsciiCase(sql, u"into", i) )
{
i +=4;
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
int start = i;
bool quote = (sql[i] == '"');
- for( i++ ; i < sql.getLength() ; i ++ )
+ for( i++ ; i < sql.size() ; i ++ )
{
if( quote && sql[i] == '"' )
{
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
if( '.' == sql[i] )
{
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
if( '"' == sql[i] )
{
// the second part of the table name does not use quotes
@@ -361,7 +361,7 @@ OUString extractTableFromInsert( const OUString & sql )
}
}
}
- ret = sql.copy(start, i - start ).trim();
+ ret = o3tl::trim(sql.substr(start, i - start ));
// printf( "pq_statement: parsed table name %s from insert\n" ,
// OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US).getStr() );
}
@@ -416,7 +416,7 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
{
if( '"' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i-start+1 ) );
+ vec.emplace_back( &sql.getStr()[start], i-start+1 );
start = i + 1;
doubleQuote = false;
}
@@ -431,7 +431,7 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
}
else if( '\'' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start +1 ) );
+ vec.emplace_back( &sql.getStr()[start], i - start +1 );
start = i + 1; // leave single quotes !
singleQuote = false;
}
@@ -440,20 +440,20 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
{
if( '"' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
doubleQuote = true;
start = i;
}
else if( '\'' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
singleQuote = true;
start = i;
}
}
}
if( start < i )
- vec.push_back( OString( &sql.getStr()[start] , i - start ) );
+ vec.emplace_back( &sql.getStr()[start] , i - start );
// for( i = 0 ; i < vec.size() ; i ++ )
// printf( "%s!" , vec[i].getStr() );
@@ -476,7 +476,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
{
if( '"' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i-start ) );
+ vec.emplace_back( &sql.getStr()[start], i-start );
start = i + 1;
doubleQuote = false;
}
@@ -485,7 +485,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
{
if( '\'' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start +1 ) );
+ vec.emplace_back( &sql.getStr()[start], i - start +1 );
start = i + 1; // leave single quotes !
singleQuote = false;
}
@@ -508,15 +508,15 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
start ++; // skip additional whitespace
else
{
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
start = i +1;
}
}
else if( ',' == c || isOperator( c ) || '(' == c || ')' == c )
{
if( i - start )
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
- vec.push_back( OString( &sql.getStr()[i], 1 ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
+ vec.emplace_back( &sql.getStr()[i], 1 );
start = i + 1;
}
else if( '.' == c )
@@ -529,15 +529,15 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
else
{
if( i - start )
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
- vec.push_back( OString( "." ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
+ vec.emplace_back( "." );
start = i + 1;
}
}
}
}
if( start < i )
- vec.push_back( OString( &sql.getStr()[start] , i - start ) );
+ vec.emplace_back( &sql.getStr()[start] , i - start );
// for( i = 0 ; i < vec.size() ; i ++ )
// printf( "%s!" , vec[i].getStr() );
@@ -596,12 +596,12 @@ OUString array2String( const css::uno::Sequence< Any > &seq )
}
-std::vector< Any > parseArray( const OUString & str )
+std::vector< Any > parseArray( std::u16string_view str )
{
- int len = str.getLength();
+ size_t len = str.size();
bool doubleQuote = false;
int brackets = 0;
- int i = 0;
+ size_t i = 0;
OUStringBuffer current;
std::vector<Any> elements;
@@ -644,7 +644,7 @@ std::vector< Any > parseArray( const OUString & str )
if( brackets == 0 )
{
if( !current.isEmpty() || doubleQuotedValue )
- elements.push_back( makeAny( current.makeStringAndClear() ) );
+ elements.emplace_back( current.makeStringAndClear() );
}
else
{
@@ -673,7 +673,7 @@ std::vector< Any > parseArray( const OUString & str )
else if( ',' == c && brackets == 1)
{
doubleQuotedValue = false;
- elements.push_back( makeAny( current.makeStringAndClear() ) );
+ elements.emplace_back( current.makeStringAndClear() );
}
else if( isWhitespace( c ) )
{
@@ -711,11 +711,11 @@ void fillAttnum2attnameMap(
const OUString &table )
{
Reference< XPreparedStatement > prep = conn->prepareStatement(
- "SELECT attname,attnum "
+ u"SELECT attname,attnum "
"FROM pg_attribute "
"INNER JOIN pg_class ON attrelid = pg_class.oid "
"INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid "
- "WHERE relname=? AND nspname=?" );
+ "WHERE relname=? AND nspname=?"_ustr );
Reference< XParameters > paras( prep, UNO_QUERY_THROW );
paras->setString( 1 , table );
@@ -836,21 +836,21 @@ OString extractSingleTableFromSelect( const std::vector< OString > &vec )
OUString getColExprForDefaultSettingVal(ConnectionSettings const *settings)
{
return (PQserverVersion( settings->pConnection ) < 80000)?
- OUString("pg_attrdef.adsrc"):
- OUString("pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid, true)");
+ u"pg_attrdef.adsrc"_ustr:
+ u"pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid, true)"_ustr;
}
-css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
+css::uno::Sequence< sal_Int32 > string2intarray( std::u16string_view str )
{
css::uno::Sequence< sal_Int32 > ret;
- const sal_Int32 strlen = str.getLength();
- if( str.getLength() > 1 )
+ const sal_Int32 strlen = str.size();
+ if( strlen > 1 )
{
sal_Int32 start = 0;
sal_uInt32 c;
for (;;)
{
- c = str.iterateCodePoints(&start);
+ c = o3tl::iterateCodePoints(str, &start);
if (!iswspace(c))
break;
if ( start == strlen)
@@ -860,7 +860,7 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
return ret;
for (;;)
{
- c = str.iterateCodePoints(&start);
+ c = o3tl::iterateCodePoints(str, &start);
if ( !iswspace(c) )
break;
if ( start == strlen)
@@ -879,7 +879,7 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
break;
if ( start == strlen)
return ret;
- c=str.iterateCodePoints(&start);
+ c = o3tl::iterateCodePoints(str, &start);
} while ( c );
do
{
@@ -888,20 +888,20 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
if ( start == strlen)
return ret;
digits.append(OUString(&c, 1));
- c = str.iterateCodePoints(&start);
+ c = o3tl::iterateCodePoints(str, &start);
} while ( c );
- vec.push_back( digits.makeStringAndClear().toInt32() );
+ vec.push_back( o3tl::toInt32(digits) );
do
{
if(!iswspace(c))
break;
if ( start == strlen)
return ret;
- c = str.iterateCodePoints(&start);
+ c = o3tl::iterateCodePoints(str, &start);
} while ( c );
if ( c == L'}' )
break;
- if ( str.iterateCodePoints(&start) != L',' )
+ if ( o3tl::iterateCodePoints(str, &start) != L',' )
return ret;
if ( start == strlen)
return ret;
@@ -918,11 +918,12 @@ Sequence< OUString > convertMappedIntArray2StringArray(
const Int2StringMap &map, const Sequence< sal_Int32 > &intArray )
{
Sequence< OUString > ret( intArray.getLength() );
+ auto retRange = asNonConstRange(ret);
for( int i = 0; i < intArray.getLength() ; i ++ )
{
Int2StringMap::const_iterator ii = map.find( intArray[i] );
if( ii != map.end() )
- ret[i] = ii->second;
+ retRange[i] = ii->second;
}
return ret;
}
@@ -942,19 +943,17 @@ OUString sqltype2string( const Reference< XPropertySet > & desc )
case css::sdbc::DataType::VARCHAR:
case css::sdbc::DataType::CHAR:
{
- typeName.append( "(" );
- typeName.append( precision );
- typeName.append( ")" );
+ typeName.append( "(" + OUString::number(precision) + ")" );
break;
}
case css::sdbc::DataType::DECIMAL:
case css::sdbc::DataType::NUMERIC:
{
- typeName.append( "(" );
- typeName.append( precision );
- typeName.append( "," );
- typeName.append( extractIntProperty( desc, getStatics().SCALE ) );
- typeName.append( ")" );
+ typeName.append( "("
+ + OUString::number(precision)
+ + ","
+ + OUString::number(extractIntProperty( desc, getStatics().SCALE ))
+ + ")" );
break;
}
default:
diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx
index 6d11e9b40425..c5f9174111ca 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.hxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_TOOLS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_TOOLS_HXX
+#pragma once
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
@@ -107,7 +106,7 @@ bool extractBoolProperty(
void disposeNoThrow( const css::uno::Reference< css::uno::XInterface > & r );
void disposeObject( const css::uno::Reference< css::uno::XInterface > & r );
-OUString extractTableFromInsert( const OUString & sql );
+OUString extractTableFromInsert( std::u16string_view sql );
OString extractSingleTableFromSelect( const std::vector< OString > &vec );
OUString getColExprForDefaultSettingVal(ConnectionSettings const *settings);
@@ -116,7 +115,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec );
void splitSQL( const OString & sql, std::vector< OString > &vec );
std::vector< sal_Int32 > parseIntArray( const OUString & str );
/// @throws css::sdbc::SQLException
-std::vector< css::uno::Any > parseArray( const OUString & str );
+std::vector< css::uno::Any > parseArray( std::u16string_view str );
OUString array2String( const css::uno::Sequence< css::uno::Any > &seq );
@@ -132,7 +131,7 @@ void fillAttnum2attnameMap(
const OUString &schema,
const OUString &table );
-css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str );
+css::uno::Sequence< sal_Int32 > string2intarray( std::u16string_view str );
css::uno::Sequence< OUString > convertMappedIntArray2StringArray(
const Int2StringMap &map, const css::uno::Sequence< sal_Int32> &source );
@@ -174,6 +173,4 @@ public:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index d8780e76c563..d8d2edfc6c04 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -35,6 +35,7 @@
************************************************************************/
#include <sal/log.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/queryinterface.hxx>
@@ -88,7 +89,7 @@ css::uno::Reference< css::sdbc::XCloseable > UpdateableResultSet::createFromPGRe
PGresult *result,
const OUString &schema,
const OUString &table,
- const std::vector< OUString > &primaryKey )
+ std::vector< OUString > && primaryKey )
{
sal_Int32 columnCount = PQnfields( result );
sal_Int32 rowCount = PQntuples( result );
@@ -115,19 +116,17 @@ css::uno::Reference< css::sdbc::XCloseable > UpdateableResultSet::createFromPGRe
OUString( val, strlen( val ), ConnectionSettings::encoding );
}
}
- data[row] = aRow;
+ data[row] = std::move(aRow);
}
- UpdateableResultSet *pRS = new UpdateableResultSet(
- mutex, owner, columnNames, data, ppSettings, schema, table, primaryKey );
-
- Reference <XCloseable > ret = pRS; // give it a refcount
+ rtl::Reference<UpdateableResultSet> pRS = new UpdateableResultSet(
+ mutex, owner, std::move(columnNames), std::move(data), ppSettings, schema, table, std::move(primaryKey) );
pRS->m_meta = new ResultSetMetaData( mutex, pRS,nullptr, ppSettings, result, schema, table );
PQclear( result ); // we don't need it anymore
- return ret;
+ return pRS;
}
css::uno::Any UpdateableResultSet::queryInterface(
@@ -188,7 +187,7 @@ void UpdateableResultSet::insertRow( )
if( ! m_insertRow )
throw SQLException(
- "pq_resultset.insertRow: moveToInsertRow has not been called !",
+ u"pq_resultset.insertRow: moveToInsertRow has not been called !"_ustr,
*this, OUString(), 1, Any() );
OUStringBuffer buf( 128 );
@@ -280,7 +279,7 @@ void UpdateableResultSet::updateRow( )
if( m_insertRow )
throw SQLException(
- "pq_resultset.updateRow: moveToCurrentRow has not been called !",
+ u"pq_resultset.updateRow: moveToCurrentRow has not been called !"_ustr,
*this, OUString(), 1, Any() );
OUStringBuffer buf( 128 );
@@ -297,8 +296,8 @@ void UpdateableResultSet::updateRow( )
buf.append( ", " );
columns ++;
- buf.append( m_columnNames[i] );
- buf.append( " = " );
+ buf.append( m_columnNames[i]
+ + " = " );
bufferQuoteAnyConstant( buf, m_updateableField[i].value, *m_ppSettings );
// OUString val;
// m_updateableField[i].value >>= val;
@@ -327,7 +326,7 @@ void UpdateableResultSet::deleteRow( )
if( m_insertRow )
throw SQLException(
- "pq_resultset.deleteRow: deleteRow cannot be called when on insert row !",
+ u"pq_resultset.deleteRow: deleteRow cannot be called when on insert row !"_ustr,
*this, OUString(), 1, Any() );
if( m_row < 0 || m_row >= m_rowCount )
@@ -343,8 +342,8 @@ void UpdateableResultSet::deleteRow( )
OUStringBuffer buf( 128 );
buf.append( "DELETE FROM " );
bufferQuoteQualifiedIdentifier( buf, m_schema, m_table, *m_ppSettings );
- buf.append( " " );
- buf.append( buildWhereClause() );
+ buf.append( " "
+ + buildWhereClause() );
stmt->executeUpdate( buf.makeStringAndClear() );
@@ -474,7 +473,7 @@ void UpdateableResultSet::updateBytes( sal_Int32 columnIndex, const css::uno::Se
if( ! escapedString )
{
throw SQLException(
- "pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string",
+ u"pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string"_ustr,
*this, OUString(), 1, Any() );
}
// buf.append( (const char *)escapedString, len -1 );
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
index feb3f53225d5..52cb513a5856 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_UPDATEABLERESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_UPDATEABLERESULTSET_HXX
+#pragma once
#include "pq_sequenceresultset.hxx"
#include "pq_resultsetmetadata.hxx"
@@ -45,6 +44,7 @@
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#include <com/sun/star/sdbc/XRowUpdate.hpp>
+#include <utility>
namespace pq_sdbc_driver
{
@@ -76,17 +76,17 @@ private:
UpdateableResultSet(
const ::rtl::Reference< comphelper::RefCountedMutex > & mutex,
const css::uno::Reference< css::uno::XInterface > &owner,
- const std::vector< OUString > &colNames,
- const std::vector< std::vector< css::uno::Any > > &data,
+ std::vector< OUString >&& colNames,
+ std::vector< std::vector< css::uno::Any > >&& data,
ConnectionSettings **ppSettings,
- const OUString &schema,
- const OUString &table,
- const std::vector< OUString > &primaryKey)
- : SequenceResultSet( mutex, owner, colNames, data, (*ppSettings)->tc ),
+ OUString schema,
+ OUString table,
+ std::vector< OUString >&& primaryKey)
+ : SequenceResultSet( mutex, owner, std::move(colNames), std::move(data), (*ppSettings)->tc ),
m_ppSettings( ppSettings ),
- m_schema( schema ),
- m_table( table ),
- m_primaryKey( primaryKey ),
+ m_schema(std::move( schema )),
+ m_table(std::move( table )),
+ m_primaryKey( std::move(primaryKey) ),
m_insertRow( false )
{
// LEM TODO: this duplicates code in pq_resultset.cxx, except for different value
@@ -119,11 +119,11 @@ public:
PGresult *result,
const OUString &schema,
const OUString &table,
- const std::vector< OUString > &primaryKey );
+ std::vector< OUString > && primaryKey );
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { SequenceResultSet::acquire(); }
- virtual void SAL_CALL release() throw() override { SequenceResultSet::release(); }
+ virtual void SAL_CALL acquire() noexcept override { SequenceResultSet::acquire(); }
+ virtual void SAL_CALL release() noexcept override { SequenceResultSet::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -167,6 +167,4 @@ public:
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_UPDATEABLERESULTSET_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xbase.cxx b/connectivity/source/drivers/postgresql/pq_xbase.cxx
index 1fec4130a9db..dd9579fce0da 100644
--- a/connectivity/source/drivers/postgresql/pq_xbase.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xbase.cxx
@@ -36,7 +36,9 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
+#include <utility>
+#include "pq_statics.hxx"
#include "pq_tools.hxx"
#include "pq_xbase.hxx"
@@ -55,18 +57,18 @@ namespace pq_sdbc_driver
{
ReflectionBase::ReflectionBase(
- const OUString &implName,
+ OUString implName,
const css::uno::Sequence< OUString > &supportedServices,
const ::rtl::Reference< comphelper::RefCountedMutex >& refMutex,
- const css::uno::Reference< css::sdbc::XConnection > &conn,
+ css::uno::Reference< css::sdbc::XConnection > conn,
ConnectionSettings *pSettings,
cppu::IPropertyArrayHelper & props /* must survive this object !*/ )
: ReflectionBase_BASE( refMutex->GetMutex() ),
OPropertySetHelper( ReflectionBase_BASE::rBHelper ),
- m_implName( implName ),
+ m_implName(std::move( implName )),
m_supportedServices( supportedServices ),
m_xMutex( refMutex ),
- m_conn( conn ),
+ m_conn(std::move( conn )),
m_pSettings( pSettings ),
m_propsDesc( props ),
m_values( props.getProperties().getLength() )
@@ -203,7 +205,7 @@ OUString ReflectionBase::getName( )
void ReflectionBase::setName( const OUString& /* aName */ )
{
throw RuntimeException(
- "pq_sdbc::ReflectionBase::setName not implemented",
+ u"pq_sdbc::ReflectionBase::setName not implemented"_ustr,
*this );
//setPropertyValue( getStatics().NAME , makeAny( aName ) );
}
diff --git a/connectivity/source/drivers/postgresql/pq_xbase.hxx b/connectivity/source/drivers/postgresql/pq_xbase.hxx
index 6e7ac8413f47..e4ca16fd5e6a 100644
--- a/connectivity/source/drivers/postgresql/pq_xbase.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xbase.hxx
@@ -34,10 +34,8 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XBASE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XBASE_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
-#include <cppuhelper/component.hxx>
#include <cppuhelper/compbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -67,10 +65,10 @@ protected:
std::vector< css::uno::Any > m_values;
public:
ReflectionBase(
- const OUString &implName,
+ OUString implName,
const css::uno::Sequence< OUString > &supportedServices,
const ::rtl::Reference< comphelper::RefCountedMutex >& refMutex,
- const css::uno::Reference< css::sdbc::XConnection > &conn,
+ css::uno::Reference< css::sdbc::XConnection > conn,
ConnectionSettings *pSettings,
cppu::IPropertyArrayHelper & props /* must survive this object !*/ );
@@ -82,8 +80,8 @@ public: // for initialization purposes only, not exported via an interface !
const OUString & name, const css::uno::Any & value );
public: //XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase_BASE::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase_BASE::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase_BASE::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -129,6 +127,5 @@ public: // XNamed
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumn.cxx b/connectivity/source/drivers/postgresql/pq_xcolumn.cxx
index c6d98b0fcb85..b19d95c3c994 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumn.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumn.cxx
@@ -34,6 +34,11 @@
*
************************************************************************/
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include "pq_statics.hxx"
#include "pq_xcolumn.hxx"
using com::sun::star::uno::Reference;
@@ -56,7 +61,7 @@ Column::Column( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex
Reference< XPropertySet > Column::createDataDescriptor( )
{
- ColumnDescriptor * pColumn = new ColumnDescriptor(
+ rtl::Reference<ColumnDescriptor> pColumn = new ColumnDescriptor(
m_xMutex, m_conn, m_pSettings );
pColumn->copyValuesFrom( this );
return Reference< XPropertySet > ( pColumn );
@@ -77,7 +82,7 @@ ColumnDescriptor::ColumnDescriptor(
Reference< XPropertySet > ColumnDescriptor::createDataDescriptor( )
{
- ColumnDescriptor * pColumn = new ColumnDescriptor(
+ rtl::Reference<ColumnDescriptor> pColumn = new ColumnDescriptor(
m_xMutex, m_conn, m_pSettings );
pColumn->copyValuesFrom( this );
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumn.hxx b/connectivity/source/drivers/postgresql/pq_xcolumn.hxx
index ea4e099fcd2b..794b5851d3c7 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumn.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumn.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMN_HXX
+#pragma once
#include <cppuhelper/component.hxx>
#include <cppuhelper/propshlp.hxx>
@@ -80,6 +79,4 @@ public: // XDataDescriptorFactory
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index ed3af3579d2a..5d98a452bfd7 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -34,6 +34,13 @@
*
************************************************************************/
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -43,6 +50,7 @@
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <utility>
#include "pq_xcolumns.hxx"
#include "pq_xcolumn.hxx"
@@ -55,7 +63,6 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
using com::sun::star::uno::RuntimeException;
@@ -69,9 +76,9 @@ using com::sun::star::sdbc::SQLException;
namespace pq_sdbc_driver
{
-static Any isCurrency( const OUString & typeName )
+static Any isCurrency( std::u16string_view typeName )
{
- return Any( typeName.equalsIgnoreAsciiCase("money") );
+ return Any( o3tl::equalsIgnoreAsciiCase(typeName, u"money") );
}
// static sal_Bool isAutoIncrement8( const OUString & typeName )
@@ -80,9 +87,9 @@ static Any isCurrency( const OUString & typeName )
// typeName.equalsIgnoreAsciiCase("bigserial");
// }
-static Any isAutoIncrement( const OUString & defaultValue )
+static Any isAutoIncrement( std::u16string_view defaultValue )
{
- bool ret = defaultValue.startsWith( "nextval(" );
+ bool ret = o3tl::starts_with( defaultValue, u"nextval(" );
// printf( "%s %d\n",
// OUStringToOString(defaultValue, RTL_TEXTENCODING_ASCII_US).getStr(),
// ret );
@@ -103,11 +110,11 @@ Columns::Columns(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName)
- : Container( refMutex, origin, pSettings, "COLUMN" ),
- m_schemaName( schemaName ),
- m_tableName( tableName )
+ OUString schemaName,
+ OUString tableName)
+ : Container( refMutex, origin, pSettings, u"COLUMN"_ustr ),
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName ))
{}
Columns::~Columns()
@@ -179,25 +186,25 @@ OUString columnMetaData2SDBCX(
OUString typeName = xRow->getString( TYPE_NAME );
pBase->setPropertyValue_NoBroadcast_public(
- st.NAME, makeAny( name ) );
+ st.NAME, Any( name ) );
pBase->setPropertyValue_NoBroadcast_public(
- st.TYPE, makeAny( xRow->getInt( DATA_TYPE ) ) );
+ st.TYPE, Any( xRow->getInt( DATA_TYPE ) ) );
pBase->setPropertyValue_NoBroadcast_public(
- st.TYPE_NAME, makeAny( typeName ) );
+ st.TYPE_NAME, Any( typeName ) );
pBase->setPropertyValue_NoBroadcast_public(
- st.PRECISION, makeAny( xRow->getInt( COLUMN_SIZE ) ) );
+ st.PRECISION, Any( xRow->getInt( COLUMN_SIZE ) ) );
pBase->setPropertyValue_NoBroadcast_public(
- st.SCALE, makeAny( xRow->getInt( DECIMAL_DIGITS ) ) );
+ st.SCALE, Any( xRow->getInt( DECIMAL_DIGITS ) ) );
pBase->setPropertyValue_NoBroadcast_public(
- st.IS_NULLABLE, makeAny( xRow->getInt( IS_NULLABLE ) ) );
+ st.IS_NULLABLE, Any( xRow->getInt( IS_NULLABLE ) ) );
pBase->setPropertyValue_NoBroadcast_public(
- st.DEFAULT_VALUE, makeAny( xRow->getString( DEFAULT_VALUE ) ) );
+ st.DEFAULT_VALUE, Any( xRow->getString( DEFAULT_VALUE ) ) );
// pBase->setPropertyValue_NoBroadcast_public(
// st.DESCRIPTION, makeAny( xRow->getString( DESCRIPTION ) ) );
@@ -207,7 +214,7 @@ OUString columnMetaData2SDBCX(
// st.HELP_TEXT, makeAny( xRow->getString( DESCRIPTION ) ) );
// else // for key columns, etc. ...
pBase->setPropertyValue_NoBroadcast_public(
- st.DESCRIPTION, makeAny( xRow->getString( DESCRIPTION ) ) );
+ st.DESCRIPTION, Any( xRow->getString( DESCRIPTION ) ) );
// maybe a better criterion than the type name can be found in future
@@ -294,11 +301,10 @@ void Columns::refresh()
int columnIndex = 0;
while( rs->next() )
{
- Column * pColumn =
+ rtl::Reference<Column> pColumn =
new Column( m_xMutex, m_origin, m_pSettings );
- Reference< css::beans::XPropertySet > prop = pColumn;
- OUString name = columnMetaData2SDBCX( pColumn, xRow );
+ OUString name = columnMetaData2SDBCX( pColumn.get(), xRow );
// pColumn->addPropertyChangeListener(
// st.HELP_TEXT,
// new CommentChanger(
@@ -310,7 +316,7 @@ void Columns::refresh()
// name ) );
{
- m_values.push_back( makeAny( prop ) );
+ m_values.emplace_back(Reference< css::beans::XPropertySet >(pColumn));
map[ name ] = columnIndex;
++columnIndex;
}
@@ -375,7 +381,7 @@ void alterColumnByDescriptor(
if( pastTypeName != futureTypeName )
{
throw RuntimeException(
- "Can't modify column types, drop the column and create a new one" );
+ u"Can't modify column types, drop the column and create a new one"_ustr );
}
if( pastColumnName != futureColumnName )
@@ -399,11 +405,10 @@ void alterColumnByDescriptor(
bufferQuoteQualifiedIdentifier( buf, schemaName, tableName, settings );
buf.append( "ALTER COLUMN" );
bufferQuoteIdentifier( buf, futureColumnName, settings );
- buf.append( "SET DEFAULT " );
// LEM TODO: check out
// default value is not quoted, caller needs to quote himself (otherwise
// how to pass e.g. nextval('something' ) ????
- buf.append( futureDefaultValue );
+ buf.append( "SET DEFAULT " + futureDefaultValue );
// bufferQuoteConstant( buf, defaultValue, encoding );
transaction.executeUpdate( buf.makeStringAndClear() );
}
@@ -455,7 +460,7 @@ void Columns::appendByDescriptor(
osl::MutexGuard guard( m_xMutex->GetMutex() );
Statics & st = getStatics();
Reference< XPropertySet > past = createDataDescriptor();
- past->setPropertyValue( st.IS_NULLABLE, makeAny( css::sdbc::ColumnValue::NULLABLE ) );
+ past->setPropertyValue( st.IS_NULLABLE, Any( css::sdbc::ColumnValue::NULLABLE ) );
alterColumnByDescriptor(
m_schemaName, m_tableName, m_pSettings, m_origin->createStatement() , past, future );
@@ -487,7 +492,7 @@ void Columns::appendByDescriptor(
void Columns::dropByIndex( sal_Int32 index )
{
osl::MutexGuard guard( m_xMutex->GetMutex() );
- if( index < 0 || index >= static_cast<sal_Int32>(m_values.size()) )
+ if( index < 0 || o3tl::make_unsigned(index) >= m_values.size() )
{
throw css::lang::IndexOutOfBoundsException(
"COLUMNS: Index out of range (allowed 0 to "
@@ -526,14 +531,13 @@ Reference< css::container::XNameAccess > Columns::create(
ConnectionSettings *pSettings,
const OUString &schemaName,
const OUString &tableName,
- Columns **ppColumns)
+ rtl::Reference<Columns> *ppColumns)
{
*ppColumns = new Columns(
refMutex, origin, pSettings, schemaName, tableName );
- Reference< css::container::XNameAccess > ret = *ppColumns;
(*ppColumns)->refresh();
- return ret;
+ return *ppColumns;
}
@@ -541,7 +545,7 @@ ColumnDescriptors::ColumnDescriptors(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings )
- : Container( refMutex, origin, pSettings, "COLUMN-DESCRIPTOR" )
+ : Container( refMutex, origin, pSettings, u"COLUMN-DESCRIPTOR"_ustr )
{}
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx
index 78bb9770ebdf..8ff8fcfbd95c 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx
@@ -34,13 +34,14 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMNS_HXX
+#pragma once
#include <sal/config.h>
#include <string_view>
+#include <rtl/ref.hxx>
+
#include "pq_xcontainer.hxx"
#include "pq_xbase.hxx"
@@ -72,15 +73,15 @@ public: // instances Columns 'exception safe'
ConnectionSettings *pSettings,
const OUString &schemaName,
const OUString &tableName,
- Columns **pColumns);
+ rtl::Reference<Columns> *pColumns);
private:
Columns(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName);
+ OUString schemaName,
+ OUString tableName);
virtual ~Columns() override;
@@ -117,6 +118,5 @@ public: // XDataDescriptorFactory
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
index 06323615f4b7..eec72bac8feb 100644
--- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
@@ -36,7 +36,10 @@
#include <com/sun/star/container/ElementExistException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/implbase.hxx>
+#include <o3tl/safeint.hxx>
+#include <utility>
#include "pq_xcontainer.hxx"
#include "pq_statics.hxx"
@@ -47,7 +50,6 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::Type;
using com::sun::star::uno::XInterface;
using com::sun::star::uno::Reference;
@@ -76,7 +78,7 @@ public:
const OUString & name,
const Any & newElement,
const OUString & oldElement ) :
- m_event( source, makeAny( name ), newElement, makeAny(oldElement) )
+ m_event( source, Any( name ), newElement, Any(oldElement) )
{}
virtual void fire( XEventListener * listener ) const override
@@ -97,7 +99,7 @@ public:
const Reference< XInterface > & source,
const OUString & name,
const Any & newElement ) :
- m_event( source, makeAny( name ), newElement, Any() )
+ m_event( source, Any( name ), newElement, Any() )
{}
virtual void fire( XEventListener * listener ) const override
@@ -118,7 +120,7 @@ public:
RemovedBroadcaster(
const Reference< XInterface > & source,
const OUString & name) :
- m_event( source, makeAny( name ), Any(), Any() )
+ m_event( source, Any( name ), Any(), Any() )
{}
virtual void fire( XEventListener * listener ) const override
@@ -136,14 +138,14 @@ public:
Container::Container(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
- const css::uno::Reference< css::sdbc::XConnection > & origin,
+ css::uno::Reference< css::sdbc::XConnection > origin,
ConnectionSettings *pSettings,
- const OUString &type)
+ OUString type)
: ContainerBase( refMutex->GetMutex() ),
m_xMutex( refMutex ),
m_pSettings( pSettings ),
- m_origin( origin ),
- m_type( type )
+ m_origin(std::move( origin )),
+ m_type(std::move( type ))
{
}
@@ -156,17 +158,18 @@ Any Container::getByName( const OUString& aName )
"Element " + aName + " unknown in " + m_type + "-Container",
*this );
}
- OSL_ASSERT( ii->second >= 0 && ii->second < static_cast<int>(m_values.size()) );
+ OSL_ASSERT( ii->second >= 0 && o3tl::make_unsigned(ii->second) < m_values.size() );
return m_values[ ii->second ];
}
Sequence< OUString > Container::getElementNames( )
{
Sequence< OUString > ret( m_values.size() );
+ auto retRange = asNonConstRange(ret);
for( const auto& [rName, rIndex] : m_name2index )
{
// give element names in index order !
- ret[rIndex] = rName;
+ retRange[rIndex] = rName;
}
return ret;
}
@@ -188,7 +191,7 @@ sal_Bool Container::hasElements( )
Any Container::getByIndex( sal_Int32 Index )
{
- if( Index < 0 || Index >= static_cast<sal_Int32>(m_values.size()) )
+ if( Index < 0 || o3tl::make_unsigned(Index) >= m_values.size() )
{
throw IndexOutOfBoundsException(
"Index " + OUString::number( Index )
@@ -211,8 +214,8 @@ class ContainerEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
std::vector< css::uno::Any > m_vec;
sal_Int32 m_index;
public:
- explicit ContainerEnumeration( const std::vector< css::uno::Any > &vec )
- : m_vec( vec ),
+ explicit ContainerEnumeration( std::vector< css::uno::Any >&& vec )
+ : m_vec( std::move(vec) ),
m_index( -1 )
{}
@@ -235,7 +238,7 @@ css::uno::Any ContainerEnumeration::nextElement()
if( ! hasMoreElements() )
{
throw NoSuchElementException(
- "NoSuchElementException during enumeration", *this );
+ u"NoSuchElementException during enumeration"_ustr, *this );
}
m_index ++;
return m_vec[m_index];
@@ -243,7 +246,7 @@ css::uno::Any ContainerEnumeration::nextElement()
Reference< XEnumeration > Container::createEnumeration( )
{
- return new ContainerEnumeration( m_values );
+ return new ContainerEnumeration( std::vector(m_values) );
}
void Container::addRefreshListener(
@@ -298,7 +301,7 @@ void Container::dropByName( const OUString& elementName )
void Container::dropByIndex( sal_Int32 index )
{
osl::MutexGuard guard( m_xMutex->GetMutex() );
- if( index < 0 || index >=static_cast<sal_Int32>(m_values.size()) )
+ if( index < 0 || o3tl::make_unsigned(index) >=m_values.size() )
{
throw css::lang::IndexOutOfBoundsException(
"Index out of range (allowed 0 to "
@@ -349,10 +352,10 @@ void Container::append(
}
int index = m_values.size();
- m_values.push_back( makeAny( descriptor ) );
+ m_values.emplace_back(descriptor);
m_name2index[name] = index;
- fire( InsertedBroadcaster( *this, name, makeAny( descriptor ) ) );
+ fire( InsertedBroadcaster( *this, name, Any( descriptor ) ) );
}
void Container::appendByDescriptor(
@@ -390,13 +393,13 @@ void Container::fire( const EventBroadcastHelper &helper )
}
catch ( css::uno::RuntimeException & )
{
- OSL_ENSURE( false, "exception caught" );
+ TOOLS_WARN_EXCEPTION( "connectivity.postgresql", "exception caught" );
// loose coupling, a runtime exception shall not break anything
// TODO: log away as warning !
}
catch( css::uno::Exception & )
{
- OSL_ENSURE( false, "exception from listener flying through" );
+ TOOLS_WARN_EXCEPTION( "connectivity.postgresql", "exception from listener flying through" );
throw;
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.hxx b/connectivity/source/drivers/postgresql/pq_xcontainer.hxx
index f53b0303ae1b..4b6c190b0a59 100644
--- a/connectivity/source/drivers/postgresql/pq_xcontainer.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xcontainer.hxx
@@ -34,29 +34,30 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCONTAINER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCONTAINER_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbcx/XAppend.hpp>
#include <com/sun/star/sdbcx/XDrop.hpp>
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
+#include <comphelper/refcountedmutex.hxx>
#include <cppuhelper/compbase.hxx>
+#include <rtl/ref.hxx>
#include <unordered_map>
-#include "pq_connection.hxx"
-#include "pq_statics.hxx"
-
namespace pq_sdbc_driver
{
+struct ConnectionSettings;
+
class EventBroadcastHelper
{
public:
@@ -116,9 +117,9 @@ protected:
public:
Container(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
- const css::uno::Reference< css::sdbc::XConnection > & origin,
+ css::uno::Reference< css::sdbc::XConnection > origin,
ConnectionSettings *pSettings,
- const OUString & type // for exception messages
+ OUString type // for exception messages
);
public: // XIndexAccess
@@ -183,6 +184,5 @@ protected:
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xindex.cxx b/connectivity/source/drivers/postgresql/pq_xindex.cxx
index c340484a17df..4753b5fd4e3c 100644
--- a/connectivity/source/drivers/postgresql/pq_xindex.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindex.cxx
@@ -36,6 +36,8 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <rtl/ref.hxx>
+#include <utility>
#include "pq_xindex.hxx"
#include "pq_xindexcolumns.hxx"
@@ -57,8 +59,8 @@ namespace pq_sdbc_driver
Index::Index( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const Reference< css::sdbc::XConnection > & connection,
ConnectionSettings *pSettings,
- const OUString & schemaName,
- const OUString & tableName )
+ OUString schemaName,
+ OUString tableName )
: ReflectionBase(
getStatics().refl.index.implName,
getStatics().refl.index.serviceNames,
@@ -66,13 +68,13 @@ Index::Index( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
connection,
pSettings,
* getStatics().refl.index.pProps ),
- m_schemaName( schemaName ),
- m_tableName( tableName )
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName ))
{}
Reference< XPropertySet > Index::createDataDescriptor( )
{
- IndexDescriptor * pIndex = new IndexDescriptor(
+ rtl::Reference<IndexDescriptor> pIndex = new IndexDescriptor(
m_xMutex, m_conn, m_pSettings );
pIndex->copyValuesFrom( this );
@@ -133,7 +135,7 @@ IndexDescriptor::IndexDescriptor(
Reference< XPropertySet > IndexDescriptor::createDataDescriptor( )
{
- IndexDescriptor * pIndex = new IndexDescriptor(
+ rtl::Reference<IndexDescriptor> pIndex = new IndexDescriptor(
m_xMutex, m_conn, m_pSettings );
pIndex->copyValuesFrom( this );
return Reference< XPropertySet > ( pIndex );
diff --git a/connectivity/source/drivers/postgresql/pq_xindex.hxx b/connectivity/source/drivers/postgresql/pq_xindex.hxx
index 26e5613630a2..8ccf45660467 100644
--- a/connectivity/source/drivers/postgresql/pq_xindex.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xindex.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEX_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEX_HXX
+#pragma once
#include <cppuhelper/component.hxx>
#include <cppuhelper/propshlp.hxx>
@@ -62,12 +61,12 @@ public:
Index( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & connection,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName);
+ OUString schemaName,
+ OUString tableName);
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -98,8 +97,8 @@ public:
ConnectionSettings *pSettings);
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -121,6 +120,4 @@ public: // XDataDescriptorFactory
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx b/connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx
index 58b36234b1fb..fe72059bc15a 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx
@@ -34,6 +34,11 @@
*
************************************************************************/
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include "pq_statics.hxx"
#include "pq_xindexcolumn.hxx"
using com::sun::star::uno::Reference;
@@ -56,7 +61,7 @@ IndexColumn::IndexColumn( const ::rtl::Reference< comphelper::RefCountedMutex >
Reference< XPropertySet > IndexColumn::createDataDescriptor( )
{
- IndexColumnDescriptor * pIndexColumn = new IndexColumnDescriptor(
+ rtl::Reference<IndexColumnDescriptor> pIndexColumn = new IndexColumnDescriptor(
m_xMutex, m_conn, m_pSettings );
pIndexColumn->copyValuesFrom( this );
@@ -79,7 +84,7 @@ IndexColumnDescriptor::IndexColumnDescriptor(
Reference< XPropertySet > IndexColumnDescriptor::createDataDescriptor( )
{
- IndexColumnDescriptor * pIndexColumn = new IndexColumnDescriptor(
+ rtl::Reference<IndexColumnDescriptor> pIndexColumn = new IndexColumnDescriptor(
m_xMutex, m_conn, m_pSettings );
pIndexColumn->copyValuesFrom( this );
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx b/connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx
index 5e7ae8d4fa65..7872985ec801 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEXCOLUMN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEXCOLUMN_HXX
+#pragma once
#include <cppuhelper/component.hxx>
#include <cppuhelper/propshlp.hxx>
@@ -81,6 +80,4 @@ public: // XDataDescriptorFactory
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
index a16d22d0cf2f..eb004b565c3e 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
@@ -37,12 +37,14 @@
#include <sal/log.hxx>
#include <string_view>
+#include <utility>
#include <vector>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <rtl/ref.hxx>
#include "pq_xcolumns.hxx"
#include "pq_xindexcolumns.hxx"
@@ -55,7 +57,6 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
@@ -72,14 +73,14 @@ IndexColumns::IndexColumns(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName,
- const OUString &indexName,
+ OUString schemaName,
+ OUString tableName,
+ OUString indexName,
const css::uno::Sequence< OUString > &columns )
- : Container( refMutex, origin, pSettings, "INDEX_COLUMN" ),
- m_schemaName( schemaName ),
- m_tableName( tableName ),
- m_indexName( indexName ),
+ : Container( refMutex, origin, pSettings, u"INDEX_COLUMN"_ustr ),
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName )),
+ m_indexName(std::move( indexName )),
m_columns( columns )
{}
@@ -124,15 +125,14 @@ void IndexColumns::refresh()
if( index >= m_columns.getLength() )
continue;
- IndexColumn * pIndexColumn =
+ rtl::Reference<IndexColumn> pIndexColumn =
new IndexColumn( m_xMutex, m_origin, m_pSettings );
- Reference< css::beans::XPropertySet > prop = pIndexColumn;
- columnMetaData2SDBCX( pIndexColumn, xRow );
+ columnMetaData2SDBCX( pIndexColumn.get(), xRow );
pIndexColumn->setPropertyValue_NoBroadcast_public(
- st.IS_ASCENDING , makeAny( false ) );
+ st.IS_ASCENDING , Any( false ) );
- m_values[ index ] <<= prop;
+ m_values[ index ] <<= Reference< css::beans::XPropertySet >(pIndexColumn);
m_name2index[ columnName ] = index;
}
}
@@ -151,7 +151,7 @@ void IndexColumns::appendByDescriptor(
const css::uno::Reference< css::beans::XPropertySet >& /*future*/ )
{
throw css::sdbc::SQLException(
- "SDBC-POSTGRESQL: IndexesColumns.appendByDescriptor not yet implemented",
+ u"SDBC-POSTGRESQL: IndexesColumns.appendByDescriptor not yet implemented"_ustr,
*this, OUString(), 1, Any() );
// osl::MutexGuard guard( m_xMutex->GetMutex() );
// Statics & st = getStatics();
@@ -165,7 +165,7 @@ void IndexColumns::appendByDescriptor(
void IndexColumns::dropByName( const OUString& )
{
throw css::sdbc::SQLException(
- "SDBC-POSTGRESQL: IndexesColumns.dropByName not yet implemented",
+ u"SDBC-POSTGRESQL: IndexesColumns.dropByName not yet implemented"_ustr,
*this, OUString(), 1, Any() );
// String2IntMap::const_iterator ii = m_name2index.find( elementName );
// if( ii == m_name2index.end() )
@@ -187,7 +187,7 @@ void IndexColumns::dropByName( const OUString& )
void IndexColumns::dropByIndex( sal_Int32 )
{
throw css::sdbc::SQLException(
- "SDBC-POSTGRESQL: IndexesColumns.dropByIndex not yet implemented",
+ u"SDBC-POSTGRESQL: IndexesColumns.dropByIndex not yet implemented"_ustr,
*this, OUString(), 1, Any() );
// osl::MutexGuard guard( m_xMutex->GetMutex() );
// if( index < 0 || index >= m_values.getLength() )
@@ -234,12 +234,11 @@ Reference< css::container::XNameAccess > IndexColumns::create(
const OUString &indexName,
const Sequence< OUString > &columns )
{
- IndexColumns *pIndexColumns = new IndexColumns(
+ rtl::Reference<IndexColumns> pIndexColumns = new IndexColumns(
refMutex, origin, pSettings, schemaName, tableName, indexName, columns );
- Reference< css::container::XNameAccess > ret = pIndexColumns;
pIndexColumns->refresh();
- return ret;
+ return pIndexColumns;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx b/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx
index 353b75ddbf63..a838d5d66908 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEXCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEXCOLUMNS_HXX
+#pragma once
#include "pq_xcontainer.hxx"
@@ -64,9 +63,9 @@ private:
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName,
- const OUString &indexName,
+ OUString schemaName,
+ OUString tableName,
+ OUString indexName,
const css::uno::Sequence< OUString > &columns );
virtual ~IndexColumns() override;
@@ -107,6 +106,5 @@ public: // XDataDescriptorFactory
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index 2f6df914f0a2..c74929eab2fa 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -35,6 +35,7 @@
************************************************************************/
#include <sal/log.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -42,6 +43,8 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <o3tl/safeint.hxx>
+#include <utility>
#include "pq_xindexes.hxx"
#include "pq_xindex.hxx"
@@ -54,7 +57,6 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
@@ -77,11 +79,11 @@ Indexes::Indexes(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName)
+ OUString schemaName,
+ OUString tableName)
: Container( refMutex, origin, pSettings, getStatics().KEY ),
- m_schemaName( schemaName ),
- m_tableName( tableName )
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName ))
{
}
@@ -102,7 +104,7 @@ void Indexes::refresh()
// see XDatabaseMetaData::getIndexInfo()
Reference< XPreparedStatement > stmt = m_origin->prepareStatement(
- "SELECT nspname, " // 1
+ u"SELECT nspname, " // 1
"pg_class.relname, " // 2
"class2.relname, " // 3
"indisclustered, " // 4
@@ -112,7 +114,7 @@ void Indexes::refresh()
"FROM pg_index INNER JOIN pg_class ON indrelid = pg_class.oid "
"INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid "
"INNER JOIN pg_class as class2 ON pg_index.indexrelid = class2.oid "
- "WHERE nspname = ? AND pg_class.relname = ?" );
+ "WHERE nspname = ? AND pg_class.relname = ?"_ustr );
Reference< XParameters > params( stmt, UNO_QUERY);
params->setString( 1, m_schemaName );
@@ -133,14 +135,13 @@ void Indexes::refresh()
static const sal_Int32 C_IS_PRIMARY = 6;
static const sal_Int32 C_COLUMNS = 7;
OUString currentIndexName = row->getString( C_INDEXNAME );
- Index *pIndex =
+ rtl::Reference<Index> pIndex =
new Index( m_xMutex, m_origin, m_pSettings,
m_schemaName, m_tableName );
bool isUnique = row->getBoolean( C_IS_UNIQUE );
bool isPrimary = row->getBoolean( C_IS_PRIMARY );
bool isClusterd = row->getBoolean( C_IS_CLUSTERED );
- Reference< css::beans::XPropertySet > prop = pIndex;
pIndex->setPropertyValue_NoBroadcast_public(
st.IS_UNIQUE, Any( isUnique ) );
pIndex->setPropertyValue_NoBroadcast_public(
@@ -148,20 +149,21 @@ void Indexes::refresh()
pIndex->setPropertyValue_NoBroadcast_public(
st.IS_CLUSTERED, Any( isClusterd ) );
pIndex->setPropertyValue_NoBroadcast_public(
- st.NAME, makeAny( currentIndexName ) );
+ st.NAME, Any( currentIndexName ) );
std::vector< sal_Int32 > seq = parseIntArray( row->getString( C_COLUMNS ) );
Sequence< OUString > columnNames(seq.size());
+ auto columnNamesRange = asNonConstRange(columnNames);
for( size_t columns = 0 ; columns < seq.size() ; columns ++ )
{
- columnNames[columns] = column2NameMap[ seq[columns] ];
+ columnNamesRange[columns] = column2NameMap[ seq[columns] ];
}
pIndex->setPropertyValue_NoBroadcast_public(
- st.PRIVATE_COLUMN_INDEXES, makeAny( columnNames ));
+ st.PRIVATE_COLUMN_INDEXES, Any( columnNames ));
{
- m_values.push_back( makeAny( prop ) );
+ m_values.emplace_back(Reference< css::beans::XPropertySet >(pIndex));
map[ currentIndexName ] = index;
++index;
}
@@ -233,7 +235,7 @@ void Indexes::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_xMutex->GetMutex() );
- if( index < 0 || index >= static_cast<sal_Int32>(m_values.size()) )
+ if( index < 0 || o3tl::make_unsigned(index) >= m_values.size() )
{
throw css::lang::IndexOutOfBoundsException(
"Indexes: Index out of range (allowed 0 to "
@@ -268,10 +270,10 @@ Reference< css::container::XNameAccess > Indexes::create(
const OUString & schemaName,
const OUString & tableName)
{
- Indexes *pIndexes = new Indexes( refMutex, origin, pSettings, schemaName, tableName );
- Reference< css::container::XNameAccess > ret = pIndexes;
+ rtl::Reference<Indexes> pIndexes
+ = new Indexes( refMutex, origin, pSettings, schemaName, tableName );
pIndexes->refresh();
- return ret;
+ return pIndexes;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.hxx b/connectivity/source/drivers/postgresql/pq_xindexes.hxx
index 7991058f5799..536d17b96198 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEXES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XINDEXES_HXX
+#pragma once
#include "pq_xcontainer.hxx"
@@ -59,8 +58,8 @@ private:
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName);
+ OUString schemaName,
+ OUString tableName);
virtual ~Indexes() override;
@@ -99,6 +98,5 @@ public: // XDataDescriptorFactory
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xkey.cxx b/connectivity/source/drivers/postgresql/pq_xkey.cxx
index ed0b2669e894..81d1f7a86eb6 100644
--- a/connectivity/source/drivers/postgresql/pq_xkey.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkey.cxx
@@ -36,6 +36,8 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <rtl/ref.hxx>
+#include <utility>
#include "pq_xkey.hxx"
#include "pq_xkeycolumns.hxx"
@@ -56,8 +58,8 @@ namespace pq_sdbc_driver
Key::Key( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const Reference< css::sdbc::XConnection > & connection,
ConnectionSettings *pSettings,
- const OUString & schemaName,
- const OUString & tableName )
+ OUString schemaName,
+ OUString tableName )
: ReflectionBase(
getStatics().refl.key.implName,
getStatics().refl.key.serviceNames,
@@ -65,13 +67,13 @@ Key::Key( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
connection,
pSettings,
* getStatics().refl.key.pProps ),
- m_schemaName( schemaName ),
- m_tableName( tableName )
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName ))
{}
Reference< XPropertySet > Key::createDataDescriptor( )
{
- KeyDescriptor * pKeyDescriptor = new KeyDescriptor(
+ rtl::Reference<KeyDescriptor> pKeyDescriptor = new KeyDescriptor(
m_xMutex, m_conn, m_pSettings );
pKeyDescriptor->copyValuesFrom( this );
@@ -134,7 +136,7 @@ KeyDescriptor::KeyDescriptor( const ::rtl::Reference< comphelper::RefCountedMute
Reference< XPropertySet > KeyDescriptor::createDataDescriptor( )
{
- KeyDescriptor * pKeyDescriptor = new KeyDescriptor(
+ rtl::Reference<KeyDescriptor> pKeyDescriptor = new KeyDescriptor(
m_xMutex, m_conn, m_pSettings );
pKeyDescriptor->copyValuesFrom( this );
diff --git a/connectivity/source/drivers/postgresql/pq_xkey.hxx b/connectivity/source/drivers/postgresql/pq_xkey.hxx
index 3174d189206b..d162fde24270 100644
--- a/connectivity/source/drivers/postgresql/pq_xkey.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xkey.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEY_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEY_HXX
+#pragma once
#include <cppuhelper/component.hxx>
#include <cppuhelper/propshlp.hxx>
@@ -49,6 +48,7 @@
namespace pq_sdbc_driver
{
+class KeyColumnDescriptors;
class Key : public ReflectionBase,
public css::sdbcx::XColumnsSupplier
@@ -62,12 +62,12 @@ public:
Key( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & connection,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName);
+ OUString schemaName,
+ OUString tableName);
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -88,7 +88,7 @@ public: // XDataDescriptorFactory
class KeyDescriptor : public ReflectionBase, public css::sdbcx::XColumnsSupplier
{
- css::uno::Reference< css::container::XNameAccess > m_keyColumns;
+ rtl::Reference<KeyColumnDescriptors> m_keyColumns;
public:
KeyDescriptor( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
@@ -96,8 +96,8 @@ public:
ConnectionSettings *pSettings );
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -117,6 +117,4 @@ public: // XDataDescriptorFactory
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx b/connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx
index 9eea45204f3d..30eef179716c 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx
@@ -34,6 +34,11 @@
*
************************************************************************/
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+
+#include "pq_statics.hxx"
#include "pq_xkeycolumn.hxx"
using com::sun::star::uno::Reference;
@@ -56,7 +61,7 @@ KeyColumn::KeyColumn( const ::rtl::Reference< comphelper::RefCountedMutex > & re
Reference< XPropertySet > KeyColumn::createDataDescriptor( )
{
- KeyColumnDescriptor * pKeyColumn = new KeyColumnDescriptor(
+ rtl::Reference<KeyColumnDescriptor> pKeyColumn = new KeyColumnDescriptor(
m_xMutex, m_conn, m_pSettings );
pKeyColumn->copyValuesFrom( this );
@@ -78,7 +83,7 @@ KeyColumnDescriptor::KeyColumnDescriptor(
Reference< XPropertySet > KeyColumnDescriptor::createDataDescriptor( )
{
- KeyColumnDescriptor * pKeyColumn = new KeyColumnDescriptor(
+ rtl::Reference<KeyColumnDescriptor> pKeyColumn = new KeyColumnDescriptor(
m_xMutex, m_conn, m_pSettings );
pKeyColumn->copyValuesFrom( this );
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx b/connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx
index 14baf7f66cf2..7d49d5d26570 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEYCOLUMN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEYCOLUMN_HXX
+#pragma once
#include <cppuhelper/component.hxx>
#include <cppuhelper/propshlp.hxx>
@@ -80,6 +79,4 @@ public: // XDataDescriptorFactory
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
index 890b57fa7420..e53e84605aa8 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
@@ -39,6 +39,8 @@
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <rtl/ref.hxx>
+#include <utility>
#include "pq_xcolumns.hxx"
#include "pq_xkeycolumns.hxx"
@@ -51,7 +53,6 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
@@ -68,13 +69,13 @@ KeyColumns::KeyColumns(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName,
+ OUString schemaName,
+ OUString tableName,
const Sequence< OUString > &columnNames,
const Sequence< OUString > &foreignColumnNames )
- : Container( refMutex, origin, pSettings, "KEY_COLUMN" ),
- m_schemaName( schemaName ),
- m_tableName( tableName ),
+ : Container( refMutex, origin, pSettings, u"KEY_COLUMN"_ustr ),
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName )),
m_columnNames( columnNames ),
m_foreignColumnNames( foreignColumnNames )
{}
@@ -117,19 +118,18 @@ void KeyColumns::refresh()
if( m_columnNames.getLength() == keyindex )
continue;
- KeyColumn * pKeyColumn =
+ rtl::Reference<KeyColumn> pKeyColumn =
new KeyColumn( m_xMutex, m_origin, m_pSettings );
- Reference< css::beans::XPropertySet > prop = pKeyColumn;
- OUString name = columnMetaData2SDBCX( pKeyColumn, xRow );
+ OUString name = columnMetaData2SDBCX( pKeyColumn.get(), xRow );
if( keyindex < m_foreignColumnNames.getLength() )
{
pKeyColumn->setPropertyValue_NoBroadcast_public(
- st.RELATED_COLUMN, makeAny( m_foreignColumnNames[keyindex]) );
+ st.RELATED_COLUMN, Any( m_foreignColumnNames[keyindex]) );
}
{
- m_values.push_back( makeAny( prop ) );
+ m_values.emplace_back(Reference< css::beans::XPropertySet >(pKeyColumn));
map[ name ] = columnIndex;
++columnIndex;
}
@@ -151,7 +151,7 @@ void KeyColumns::appendByDescriptor(
const css::uno::Reference< css::beans::XPropertySet >& )
{
throw css::sdbc::SQLException(
- "KeyColumns::appendByDescriptor not implemented yet",
+ u"KeyColumns::appendByDescriptor not implemented yet"_ustr,
*this, OUString(), 1, Any() );
// osl::MutexGuard guard( m_xMutex->GetMutex() );
@@ -167,7 +167,7 @@ void KeyColumns::appendByDescriptor(
void KeyColumns::dropByIndex( sal_Int32 )
{
throw css::sdbc::SQLException(
- "KeyColumns::dropByIndex not implemented yet",
+ u"KeyColumns::dropByIndex not implemented yet"_ustr,
*this, OUString(), 1, Any() );
// osl::MutexGuard guard( m_xMutex->GetMutex() );
// if( index < 0 || index >= m_values.getLength() )
@@ -214,12 +214,11 @@ Reference< css::container::XNameAccess > KeyColumns::create(
const Sequence< OUString > &columnNames ,
const Sequence< OUString > &foreignColumnNames )
{
- KeyColumns *pKeyColumns = new KeyColumns(
+ rtl::Reference<KeyColumns> pKeyColumns = new KeyColumns(
refMutex, origin, pSettings, schemaName, tableName, columnNames, foreignColumnNames );
- Reference< css::container::XNameAccess > ret = pKeyColumns;
pKeyColumns->refresh();
- return ret;
+ return pKeyColumns;
}
@@ -227,7 +226,7 @@ KeyColumnDescriptors::KeyColumnDescriptors(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings )
- : Container( refMutex, origin, pSettings, "KEY_COLUMN" )
+ : Container( refMutex, origin, pSettings, u"KEY_COLUMN"_ustr )
{}
Reference< css::beans::XPropertySet > KeyColumnDescriptors::createDataDescriptor()
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx b/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx
index 0ada98aa4052..60bbd0c0de36 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEYCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEYCOLUMNS_HXX
+#pragma once
#include "pq_xcontainer.hxx"
@@ -64,8 +63,8 @@ private:
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName,
+ OUString schemaName,
+ OUString tableName,
const css::uno::Sequence< OUString > &keyColumns,
const css::uno::Sequence< OUString > &foreignColumnNames);
@@ -98,6 +97,5 @@ public: // XDataDescriptorFactory
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override;
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
index 969ce4dd398c..5dde7d22fdf5 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
@@ -39,6 +39,7 @@
#include <string_view>
#include <sal/log.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -48,6 +49,8 @@
#include <com/sun/star/sdbc/KeyRule.hpp>
#include <com/sun/star/sdbcx/KeyType.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <o3tl/safeint.hxx>
+#include <utility>
#include "pq_xkeys.hxx"
#include "pq_xkey.hxx"
@@ -59,7 +62,7 @@ using osl::MutexGuard;
using css::beans::XPropertySet;
-using com::sun::star::uno::makeAny;
+using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
@@ -77,11 +80,11 @@ Keys::Keys(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName)
+ OUString schemaName,
+ OUString tableName)
: Container( refMutex, origin, pSettings, getStatics().KEY ),
- m_schemaName( schemaName ),
- m_tableName( tableName )
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName ))
{}
Keys::~Keys()
@@ -124,7 +127,7 @@ void Keys::refresh()
fillAttnum2attnameMap( mainMap, m_origin, m_schemaName, m_tableName );
Reference< XPreparedStatement > stmt = m_origin->prepareStatement(
- "SELECT conname, " // 1
+ u"SELECT conname, " // 1
"contype, " // 2
"confupdtype, " // 3
"confdeltype, " // 4
@@ -136,7 +139,7 @@ void Keys::refresh()
"INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid "
"LEFT JOIN pg_class AS class2 ON confrelid = class2.oid "
"LEFT JOIN pg_namespace AS nmsp2 ON class2.relnamespace=nmsp2.oid "
- "WHERE pg_class.relname = ? AND pg_namespace.nspname = ?" );
+ "WHERE pg_class.relname = ? AND pg_namespace.nspname = ?"_ustr );
Reference< XParameters > paras( stmt, UNO_QUERY );
paras->setString( 1 , m_tableName );
@@ -150,37 +153,35 @@ void Keys::refresh()
int keyIndex = 0;
while( rs->next() )
{
- Key * pKey =
+ rtl::Reference<Key> pKey =
new Key( m_xMutex, m_origin, m_pSettings , m_schemaName, m_tableName );
- Reference< css::beans::XPropertySet > prop = pKey;
pKey->setPropertyValue_NoBroadcast_public(
- st.NAME, makeAny( xRow->getString( 1 ) ) );
+ st.NAME, Any( xRow->getString( 1 ) ) );
sal_Int32 keyType = string2keytype( xRow->getString(2) );
- pKey->setPropertyValue_NoBroadcast_public( st.TYPE, makeAny( keyType ) );
+ pKey->setPropertyValue_NoBroadcast_public( st.TYPE, Any( keyType ) );
pKey->setPropertyValue_NoBroadcast_public(
- st.UPDATE_RULE, makeAny( string2keyrule( xRow->getString(3) ) ) );
+ st.UPDATE_RULE, Any( string2keyrule( xRow->getString(3) ) ) );
pKey->setPropertyValue_NoBroadcast_public(
- st.DELETE_RULE, makeAny( string2keyrule( xRow->getString(4) ) ) );
+ st.DELETE_RULE, Any( string2keyrule( xRow->getString(4) ) ) );
pKey->setPropertyValue_NoBroadcast_public(
st.PRIVATE_COLUMNS,
- makeAny(
+ Any(
convertMappedIntArray2StringArray(
mainMap,
string2intarray( xRow->getString( 7 ) ) ) ) );
if( css::sdbcx::KeyType::FOREIGN == keyType )
{
- OUStringBuffer buf( 128 );
- buf.append( xRow->getString( 6 ) ).append( "." ).append( xRow->getString( 5 ) );
+ OUString buf = xRow->getString( 6 ) + "." + xRow->getString( 5 );
pKey->setPropertyValue_NoBroadcast_public(
- st.REFERENCED_TABLE, makeAny( buf.makeStringAndClear() ) );
+ st.REFERENCED_TABLE, Any( buf ) );
Int2StringMap foreignMap;
fillAttnum2attnameMap( foreignMap, m_origin, xRow->getString(6), xRow->getString(5));
pKey->setPropertyValue_NoBroadcast_public(
st.PRIVATE_FOREIGN_COLUMNS,
- makeAny(
+ Any(
convertMappedIntArray2StringArray(
foreignMap,
string2intarray( xRow->getString(8) ) ) ) );
@@ -189,7 +190,7 @@ void Keys::refresh()
{
map[ xRow->getString( 1 ) ] = keyIndex;
- m_values.push_back( makeAny( prop ) );
+ m_values.push_back( Any( Reference< css::beans::XPropertySet >(pKey) ) );
++keyIndex;
}
}
@@ -226,7 +227,7 @@ void Keys::appendByDescriptor(
void Keys::dropByIndex( sal_Int32 index )
{
osl::MutexGuard guard( m_xMutex->GetMutex() );
- if( index < 0 || index >= static_cast<sal_Int32>(m_values.size()) )
+ if( index < 0 || o3tl::make_unsigned(index) >= m_values.size() )
{
throw css::lang::IndexOutOfBoundsException(
"TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1)
@@ -262,11 +263,10 @@ Reference< css::container::XIndexAccess > Keys::create(
const OUString & schemaName,
const OUString & tableName)
{
- Keys *pKeys = new Keys( refMutex, origin, pSettings, schemaName, tableName );
- Reference< css::container::XIndexAccess > ret = pKeys;
+ rtl::Reference<Keys> pKeys = new Keys( refMutex, origin, pSettings, schemaName, tableName );
pKeys->refresh();
- return ret;
+ return pKeys;
}
KeyDescriptors::KeyDescriptors(
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.hxx b/connectivity/source/drivers/postgresql/pq_xkeys.hxx
index aedd46b578da..ef6376d4d780 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEYS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XKEYS_HXX
+#pragma once
#include "pq_xcontainer.hxx"
@@ -59,8 +58,8 @@ private:
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- const OUString &schemaName,
- const OUString &tableName);
+ OUString schemaName,
+ OUString tableName);
virtual ~Keys() override;
@@ -98,6 +97,5 @@ public: // XDataDescriptorFactory
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xtable.cxx b/connectivity/source/drivers/postgresql/pq_xtable.cxx
index 82b66a316a3f..de8196f9fecd 100644
--- a/connectivity/source/drivers/postgresql/pq_xtable.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtable.cxx
@@ -34,6 +34,7 @@
*
************************************************************************/
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -59,7 +60,6 @@ using com::sun::star::uno::Reference;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::Type;
using com::sun::star::beans::XPropertySet;
@@ -78,13 +78,12 @@ Table::Table( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
refMutex,
connection,
pSettings,
- * getStatics().refl.table.pProps ),
- m_pColumns( nullptr )
+ * getStatics().refl.table.pProps )
{}
Reference< XPropertySet > Table::createDataDescriptor( )
{
- TableDescriptor * pTable = new TableDescriptor(
+ rtl::Reference<TableDescriptor> pTable = new TableDescriptor(
m_xMutex, m_conn, m_pSettings );
pTable->copyValuesFrom( this );
@@ -168,7 +167,7 @@ void Table::rename( const OUString& newName )
if( Xrename.is() )
{
Xrename->rename( newName );
- setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, makeAny(newSchemaName) );
+ setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, Any(newSchemaName) );
}
}
else
@@ -185,14 +184,13 @@ void Table::rename( const OUString& newName )
bufferQuoteIdentifier( buf, newSchemaName, m_pSettings );
Reference< XStatement > statement = m_conn->createStatement();
statement->executeUpdate( buf.makeStringAndClear() );
- setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, makeAny(newSchemaName) );
+ setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, Any(newSchemaName) );
disposeNoThrow( statement );
schema = newSchemaName;
}
catch( css::sdbc::SQLException &e )
{
- OUString buf( e.Message + "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" );
- e.Message = buf;
+ e.Message += "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)";
throw;
}
@@ -209,7 +207,7 @@ void Table::rename( const OUString& newName )
disposeNoThrow( statement );
}
}
- setPropertyValue_NoBroadcast_public( st.NAME, makeAny(newTableName) );
+ setPropertyValue_NoBroadcast_public( st.NAME, Any(newTableName) );
// inform the container of the name change !
if( m_pSettings->tables.is() )
{
@@ -381,7 +379,7 @@ Any TableDescriptor::queryInterface( const Type & reqType )
Reference< XPropertySet > TableDescriptor::createDataDescriptor( )
{
- TableDescriptor * pTable = new TableDescriptor(
+ rtl::Reference<TableDescriptor> pTable = new TableDescriptor(
m_xMutex, m_conn, m_pSettings );
// TODO: deep copies
diff --git a/connectivity/source/drivers/postgresql/pq_xtable.hxx b/connectivity/source/drivers/postgresql/pq_xtable.hxx
index 69e9d6435c8a..178bc9d04888 100644
--- a/connectivity/source/drivers/postgresql/pq_xtable.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xtable.hxx
@@ -34,28 +34,20 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLE_HXX
+#pragma once
-#include <cppuhelper/component.hxx>
-#include <cppuhelper/propshlp.hxx>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
#include <com/sun/star/sdbcx/XRename.hpp>
#include <com/sun/star/sdbcx/XAlterTable.hpp>
-#include <com/sun/star/container/XNamed.hpp>
#include "pq_xbase.hxx"
+#include "pq_xcolumns.hxx"
namespace pq_sdbc_driver
{
-class Columns;
-
class Table : public ReflectionBase,
public css::sdbcx::XColumnsSupplier,
public css::sdbcx::XIndexesSupplier,
@@ -66,7 +58,7 @@ class Table : public ReflectionBase,
css::uno::Reference< css::container::XNameAccess > m_columns;
css::uno::Reference< css::container::XIndexAccess > m_keys;
css::uno::Reference< css::container::XNameAccess > m_indexes;
- Columns *m_pColumns;
+ rtl::Reference<Columns> m_pColumns;
public:
Table( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
@@ -74,8 +66,8 @@ public:
ConnectionSettings *pSettings);
// XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -123,7 +115,7 @@ class TableDescriptor
public css::sdbcx::XIndexesSupplier,
public css::sdbcx::XKeysSupplier
{
- css::uno::Reference< css::container::XNameAccess > m_columns;
+ rtl::Reference<ColumnDescriptors> m_columns;
css::uno::Reference< css::container::XIndexAccess > m_keys;
css::uno::Reference< css::container::XNameAccess > m_indexes;
@@ -134,8 +126,8 @@ public:
ConnectionSettings *pSettings);
public: // XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -164,6 +156,4 @@ public: // XDataDescriptorFactory
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 83758208b203..6b5214bf9596 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -34,6 +34,7 @@
*
************************************************************************/
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -42,6 +43,7 @@
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <o3tl/safeint.hxx>
#include "pq_xtables.hxx"
#include "pq_xviews.hxx"
@@ -54,7 +56,6 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
@@ -103,23 +104,22 @@ void Tables::refresh()
{
// if creating all these tables turns out to have too bad performance, we might
// instead offer a factory interface
- Table * pTable =
+ rtl::Reference<Table> pTable =
new Table( m_xMutex, m_origin, m_pSettings );
- Reference< css::beans::XPropertySet > prop = pTable;
OUString name = xRow->getString( TABLE_INDEX_NAME+1);
OUString schema = xRow->getString( TABLE_INDEX_SCHEMA+1);
pTable->setPropertyValue_NoBroadcast_public(
- st.CATALOG_NAME , makeAny(xRow->getString( TABLE_INDEX_CATALOG+1) ) );
- pTable->setPropertyValue_NoBroadcast_public( st.NAME , makeAny( name ) );
- pTable->setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME , makeAny( schema ));
+ st.CATALOG_NAME , Any(xRow->getString( TABLE_INDEX_CATALOG+1) ) );
+ pTable->setPropertyValue_NoBroadcast_public( st.NAME , Any( name ) );
+ pTable->setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME , Any( schema ));
pTable->setPropertyValue_NoBroadcast_public(
- st.TYPE , makeAny( xRow->getString( TABLE_INDEX_TYPE+1) ) );
+ st.TYPE , Any( xRow->getString( TABLE_INDEX_TYPE+1) ) );
pTable->setPropertyValue_NoBroadcast_public(
- st.DESCRIPTION , makeAny( xRow->getString( TABLE_INDEX_REMARKS+1) ) );
+ st.DESCRIPTION , Any( xRow->getString( TABLE_INDEX_REMARKS+1) ) );
pTable->setPropertyValue_NoBroadcast_public(
st.PRIVILEGES ,
- makeAny( sal_Int32( css::sdbcx::Privilege::SELECT |
+ Any( sal_Int32( css::sdbcx::Privilege::SELECT |
css::sdbcx::Privilege::INSERT |
css::sdbcx::Privilege::UPDATE |
css::sdbcx::Privilege::DELETE |
@@ -130,7 +130,7 @@ void Tables::refresh()
css::sdbcx::Privilege::DROP ) ) );
{
- m_values.push_back( makeAny( prop ) );
+ m_values.push_back( Any( Reference< css::beans::XPropertySet >(pTable) ) );
map[ schema + "." + name ] = tableIndex;
++tableIndex;
}
@@ -310,7 +310,7 @@ void Tables::appendByDescriptor(
void Tables::dropByIndex( sal_Int32 index )
{
osl::MutexGuard guard( m_xMutex->GetMutex() );
- if( index < 0 || index >= static_cast<sal_Int32>(m_values.size()) )
+ if( index < 0 || o3tl::make_unsigned(index) >= m_values.size() )
{
throw css::lang::IndexOutOfBoundsException(
"TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1)
@@ -355,13 +355,12 @@ Reference< css::container::XNameAccess > Tables::create(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- Tables **ppTables)
+ rtl::Reference<Tables> *ppTables)
{
*ppTables = new Tables( refMutex, origin, pSettings );
- Reference< css::container::XNameAccess > ret = *ppTables;
(*ppTables)->refresh();
- return ret;
+ return *ppTables;
}
};
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.hxx b/connectivity/source/drivers/postgresql/pq_xtables.hxx
index 33eab3a5b8c4..9222db82c77f 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.hxx
@@ -34,14 +34,19 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLES_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
#include "pq_xcontainer.hxx"
namespace pq_sdbc_driver
{
+struct ConnectionSettings;
+
class Tables : public Container
{
@@ -50,7 +55,7 @@ public: // instances Tables 'exception safe'
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- Tables ** ppTables);
+ rtl::Reference<Tables> * ppTables);
protected:
Tables(
@@ -82,6 +87,5 @@ protected:
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xuser.cxx b/connectivity/source/drivers/postgresql/pq_xuser.cxx
index bc06c541064e..2165c7e3d528 100644
--- a/connectivity/source/drivers/postgresql/pq_xuser.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xuser.cxx
@@ -35,6 +35,7 @@
************************************************************************/
#include <sal/log.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -73,7 +74,7 @@ User::User( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
Reference< XPropertySet > User::createDataDescriptor( )
{
- UserDescriptor * pUser = new UserDescriptor( m_xMutex, m_conn, m_pSettings );
+ rtl::Reference<UserDescriptor> pUser = new UserDescriptor( m_xMutex, m_conn, m_pSettings );
pUser->copyValuesFrom( this );
return Reference< XPropertySet > ( pUser );
@@ -133,13 +134,13 @@ sal_Int32 User::getGrantablePrivileges( const OUString&, sal_Int32 )
void User::grantPrivileges( const OUString&, sal_Int32, sal_Int32 )
{
- throw css::sdbc::SQLException("pq_driver: privilege change not implemented yet",
+ throw css::sdbc::SQLException(u"pq_driver: privilege change not implemented yet"_ustr,
*this, OUString(), 1, Any() );
}
void User::revokePrivileges( const OUString&, sal_Int32, sal_Int32 )
{
- throw css::sdbc::SQLException("pq_driver: privilege change not implemented yet",
+ throw css::sdbc::SQLException(u"pq_driver: privilege change not implemented yet"_ustr,
*this, OUString(), 1, Any() );
}
@@ -159,7 +160,7 @@ UserDescriptor::UserDescriptor(
Reference< XPropertySet > UserDescriptor::createDataDescriptor( )
{
- UserDescriptor * pUser = new UserDescriptor( m_xMutex, m_conn, m_pSettings );
+ rtl::Reference<UserDescriptor> pUser = new UserDescriptor( m_xMutex, m_conn, m_pSettings );
pUser->copyValuesFrom( this );
return Reference< XPropertySet > ( pUser );
diff --git a/connectivity/source/drivers/postgresql/pq_xuser.hxx b/connectivity/source/drivers/postgresql/pq_xuser.hxx
index 950cd998b0d5..702787a67496 100644
--- a/connectivity/source/drivers/postgresql/pq_xuser.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xuser.hxx
@@ -34,14 +34,8 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XUSER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XUSER_HXX
+#pragma once
-#include <cppuhelper/component.hxx>
-#include <cppuhelper/propshlp.hxx>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <com/sun/star/sdbcx/XUser.hpp>
#include "pq_xbase.hxx"
@@ -59,8 +53,8 @@ public:
ConnectionSettings *pSettings);
// XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -96,6 +90,4 @@ public: // XDataDescriptorFactory
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xusers.cxx b/connectivity/source/drivers/postgresql/pq_xusers.cxx
index a6fe3489fa7f..5a80ee8727ab 100644
--- a/connectivity/source/drivers/postgresql/pq_xusers.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xusers.cxx
@@ -34,12 +34,14 @@
*
************************************************************************/
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <o3tl/safeint.hxx>
#include "pq_xusers.hxx"
#include "pq_xuser.hxx"
@@ -50,7 +52,7 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
-using com::sun::star::uno::makeAny;
+using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
@@ -81,7 +83,7 @@ void Users::refresh()
Reference< XStatement > stmt = m_origin->createStatement();
- Reference< XResultSet > rs = stmt->executeQuery( "SELECT usename FROM pg_shadow" );
+ Reference< XResultSet > rs = stmt->executeQuery( u"SELECT usename FROM pg_shadow"_ustr );
Reference< XRow > xRow( rs , UNO_QUERY );
@@ -91,16 +93,15 @@ void Users::refresh()
sal_Int32 tableIndex = 0;
while( rs->next() )
{
- User * pUser =
+ rtl::Reference<User> pUser =
new User( m_xMutex, m_origin, m_pSettings );
- Reference< css::beans::XPropertySet > prop = pUser;
OUString name = xRow->getString( 1);
pUser->setPropertyValue_NoBroadcast_public(
- st.NAME , makeAny(xRow->getString( TABLE_INDEX_CATALOG+1) ) );
+ st.NAME , Any(xRow->getString( TABLE_INDEX_CATALOG+1) ) );
{
- m_values.push_back( makeAny( prop ) );
+ m_values.push_back( Any( Reference< css::beans::XPropertySet >(pUser) ) );
map[ name ] = tableIndex;
++tableIndex;
}
@@ -150,7 +151,7 @@ void Users::dropByIndex( sal_Int32 index )
{
osl::MutexGuard guard( m_xMutex->GetMutex() );
- if( index < 0 || index >= static_cast<sal_Int32>(m_values.size()) )
+ if( index < 0 || o3tl::make_unsigned(index) >= m_values.size() )
{
throw css::lang::IndexOutOfBoundsException(
"USERS: Index out of range (allowed 0 to "
@@ -185,11 +186,10 @@ Reference< css::container::XNameAccess > Users::create(
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings )
{
- Users *pUsers = new Users( refMutex, origin, pSettings );
- Reference< css::container::XNameAccess > ret = pUsers;
+ rtl::Reference<Users> pUsers = new Users( refMutex, origin, pSettings );
pUsers->refresh();
- return ret;
+ return pUsers;
}
void Users::disposing()
diff --git a/connectivity/source/drivers/postgresql/pq_xusers.hxx b/connectivity/source/drivers/postgresql/pq_xusers.hxx
index 359b97dd11cf..f95ec174915f 100644
--- a/connectivity/source/drivers/postgresql/pq_xusers.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xusers.hxx
@@ -34,8 +34,7 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XUSERS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XUSERS_HXX
+#pragma once
#include "pq_xcontainer.hxx"
@@ -79,6 +78,5 @@ private:
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xview.cxx b/connectivity/source/drivers/postgresql/pq_xview.cxx
index 1b00b9b5d326..c2e936e9a314 100644
--- a/connectivity/source/drivers/postgresql/pq_xview.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xview.cxx
@@ -34,6 +34,7 @@
*
************************************************************************/
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -51,7 +52,6 @@ using osl::MutexGuard;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
using com::sun::star::uno::Type;
using com::sun::star::beans::XPropertySet;
@@ -76,7 +76,7 @@ View::View( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
Reference< XPropertySet > View::createDataDescriptor( )
{
- ViewDescriptor * pView = new ViewDescriptor(
+ rtl::Reference<ViewDescriptor> pView = new ViewDescriptor(
m_xMutex, m_conn, m_pSettings );
pView->copyValuesFrom( this );
@@ -120,14 +120,13 @@ void View::rename( const OUString& newName )
bufferQuoteIdentifier( buf, newSchemaName, m_pSettings );
Reference< XStatement > statement = m_conn->createStatement();
statement->executeUpdate( buf.makeStringAndClear() );
- setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, makeAny(newSchemaName) );
+ setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, Any(newSchemaName) );
disposeNoThrow( statement );
schema = newSchemaName;
}
catch( css::sdbc::SQLException &e )
{
- OUString buf( e.Message + "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" );
- e.Message = buf;
+ e.Message += "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)";
throw;
}
@@ -141,7 +140,7 @@ void View::rename( const OUString& newName )
bufferQuoteIdentifier( buf, newTableName, m_pSettings );
Reference< XStatement > statement = m_conn->createStatement();
statement->executeUpdate( buf.makeStringAndClear() );
- setPropertyValue_NoBroadcast_public( st.NAME, makeAny(newTableName) );
+ setPropertyValue_NoBroadcast_public( st.NAME, Any(newTableName) );
}
// inform the container of the name change !
@@ -205,7 +204,7 @@ ViewDescriptor::ViewDescriptor(
Reference< XPropertySet > ViewDescriptor::createDataDescriptor( )
{
- ViewDescriptor * pView = new ViewDescriptor(
+ rtl::Reference<ViewDescriptor> pView = new ViewDescriptor(
m_xMutex, m_conn, m_pSettings );
pView->copyValuesFrom( this );
diff --git a/connectivity/source/drivers/postgresql/pq_xview.hxx b/connectivity/source/drivers/postgresql/pq_xview.hxx
index d5c86981f6f4..f68b5535a8d7 100644
--- a/connectivity/source/drivers/postgresql/pq_xview.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xview.hxx
@@ -34,16 +34,9 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XVIEW_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XVIEW_HXX
+#pragma once
-#include <cppuhelper/component.hxx>
-#include <cppuhelper/propshlp.hxx>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#include <com/sun/star/sdbcx/XRename.hpp>
-#include <com/sun/star/container/XNamed.hpp>
#include "pq_xbase.hxx"
@@ -58,8 +51,8 @@ public:
ConnectionSettings *pSettings);
// XInterface
- virtual void SAL_CALL acquire() throw() override { ReflectionBase::acquire(); }
- virtual void SAL_CALL release() throw() override { ReflectionBase::release(); }
+ virtual void SAL_CALL acquire() noexcept override { ReflectionBase::acquire(); }
+ virtual void SAL_CALL release() noexcept override { ReflectionBase::release(); }
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & reqType ) override;
@@ -96,6 +89,4 @@ public:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index ac684a16c124..9d0d875510ad 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -34,12 +34,14 @@
*
************************************************************************/
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <o3tl/safeint.hxx>
#include "pq_xviews.hxx"
#include "pq_xview.hxx"
@@ -51,7 +53,7 @@ using osl::MutexGuard;
using com::sun::star::beans::XPropertySet;
-using com::sun::star::uno::makeAny;
+using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Reference;
@@ -83,7 +85,7 @@ void Views::refresh()
Reference< XStatement > stmt = m_origin->createStatement();
- Reference< XResultSet > rs = stmt->executeQuery("SELECT "
+ Reference< XResultSet > rs = stmt->executeQuery(u"SELECT "
"DISTINCT ON( pg_namespace.nspname, relname) " // needed because of duplicates
"pg_namespace.nspname," // 1
"relname," // 2
@@ -91,7 +93,7 @@ void Views::refresh()
"FROM pg_namespace, pg_class, pg_rewrite "
"WHERE pg_namespace.oid = relnamespace "
"AND pg_class.oid = ev_class "
- "AND relkind=\'v\'" );
+ "AND relkind=\'v\'"_ustr );
Reference< XRow > xRow( rs , UNO_QUERY );
@@ -106,15 +108,14 @@ void Views::refresh()
table = xRow->getString( 2 );
command = xRow->getString( 3 );
- View *pView = new View (m_xMutex, m_origin, m_pSettings );
- Reference< css::beans::XPropertySet > prop = pView;
+ rtl::Reference<View> pView = new View (m_xMutex, m_origin, m_pSettings );
- pView->setPropertyValue_NoBroadcast_public(st.NAME , makeAny(table) );
- pView->setPropertyValue_NoBroadcast_public(st.SCHEMA_NAME, makeAny(schema) );
- pView->setPropertyValue_NoBroadcast_public(st.COMMAND, makeAny(command) );
+ pView->setPropertyValue_NoBroadcast_public(st.NAME , Any(table) );
+ pView->setPropertyValue_NoBroadcast_public(st.SCHEMA_NAME, Any(schema) );
+ pView->setPropertyValue_NoBroadcast_public(st.COMMAND, Any(command) );
{
- m_values.push_back( makeAny( prop ) );
+ m_values.push_back( Any( Reference< css::beans::XPropertySet >(pView) ) );
map[ schema + "." + table ] = viewIndex;
++viewIndex;
}
@@ -148,7 +149,7 @@ void Views::appendByDescriptor(
buf.append( "CREATE VIEW ");
bufferQuoteQualifiedIdentifier( buf, schema, name, m_pSettings );
- buf.append(" AS " ).append( command );
+ buf.append(" AS " + command );
stmt->executeUpdate( buf.makeStringAndClear() );
@@ -174,7 +175,7 @@ void Views::dropByName( const OUString& elementName )
void Views::dropByIndex( sal_Int32 index )
{
osl::MutexGuard guard( m_xMutex->GetMutex() );
- if( index < 0 || index >= static_cast<sal_Int32>(m_values.size()) )
+ if( index < 0 || o3tl::make_unsigned(index) >= m_values.size() )
{
throw css::lang::IndexOutOfBoundsException(
"VIEWS: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1)
@@ -204,13 +205,12 @@ Reference< css::container::XNameAccess > Views::create(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- Views **ppViews)
+ rtl::Reference<Views> *ppViews)
{
*ppViews = new Views( refMutex, origin, pSettings );
- Reference< css::container::XNameAccess > ret = *ppViews;
(*ppViews)->refresh();
- return ret;
+ return *ppViews;
}
};
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.hxx b/connectivity/source/drivers/postgresql/pq_xviews.hxx
index 5ce5b879bd0e..04137b6868a1 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.hxx
@@ -34,14 +34,19 @@
*
************************************************************************/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XVIEWS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XVIEWS_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
#include "pq_xcontainer.hxx"
namespace pq_sdbc_driver
{
+struct ConnectionSettings;
+
class Views : public Container
{
@@ -50,7 +55,7 @@ public: // instances Views 'exception safe'
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings *pSettings,
- Views **ppViews );
+ rtl::Reference<Views> *ppViews );
protected:
Views(
@@ -79,6 +84,5 @@ protected:
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WCatalog.cxx b/connectivity/source/drivers/writer/WCatalog.cxx
index 8671af7bd5d9..b0e326d96d6f 100644
--- a/connectivity/source/drivers/writer/WCatalog.cxx
+++ b/connectivity/source/drivers/writer/WCatalog.cxx
@@ -41,7 +41,8 @@ void OWriterCatalog::refreshTables()
::std::vector<OUString> aVector;
uno::Sequence<OUString> aTypes;
OWriterConnection::ODocHolder aDocHolder(static_cast<OWriterConnection*>(m_pConnection));
- uno::Reference<sdbc::XResultSet> xResult = m_xMetaData->getTables(uno::Any(), "%", "%", aTypes);
+ uno::Reference<sdbc::XResultSet> xResult
+ = m_xMetaData->getTables(uno::Any(), u"%"_ustr, u"%"_ustr, aTypes);
if (xResult.is())
{
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx
index c4cc699e4ad2..0f23b315beca 100644
--- a/connectivity/source/drivers/writer/WConnection.cxx
+++ b/connectivity/source/drivers/writer/WConnection.cxx
@@ -32,7 +32,7 @@
#include <unotools/pathoptions.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -42,7 +42,6 @@ namespace connectivity::writer
{
OWriterConnection::OWriterConnection(ODriver* _pDriver)
: OConnection(_pDriver)
- , m_nDocCount(0)
{
}
@@ -55,9 +54,9 @@ void OWriterConnection::construct(const OUString& rURL,
sal_Int32 nLen = rURL.indexOf(':');
nLen = rURL.indexOf(':', nLen + 1);
- OUString aDSN(rURL.copy(nLen + 1));
- m_aFileName = aDSN;
+ m_aFileName = rURL.copy(nLen + 1); // DSN
+
INetURLObject aURL;
aURL.SetSmartProtocol(INetProtocol::File);
{
@@ -97,18 +96,17 @@ uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc()
return m_xDoc;
}
// open read-only as long as updating isn't implemented
- uno::Sequence<beans::PropertyValue> aArgs(2);
- aArgs[0].Name = "Hidden";
- aArgs[0].Value <<= true;
- aArgs[1].Name = "ReadOnly";
- aArgs[1].Value <<= true;
+ uno::Sequence<beans::PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3);
+ auto pArgs = aArgs.getArray();
+ pArgs[0].Name = "Hidden";
+ pArgs[0].Value <<= true;
+ pArgs[1].Name = "ReadOnly";
+ pArgs[1].Value <<= true;
if (!m_sPassword.isEmpty())
{
- const sal_Int32 nPos = aArgs.getLength();
- aArgs.realloc(nPos + 1);
- aArgs[nPos].Name = "Password";
- aArgs[nPos].Value <<= m_sPassword;
+ pArgs[2].Name = "Password";
+ pArgs[2].Value <<= m_sPassword;
}
uno::Reference<frame::XDesktop2> xDesktop
@@ -117,7 +115,7 @@ uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc()
uno::Any aLoaderException;
try
{
- xComponent = xDesktop->loadComponentFromURL(m_aFileName, "_blank", 0, aArgs);
+ xComponent = xDesktop->loadComponentFromURL(m_aFileName, u"_blank"_ustr, 0, aArgs);
}
catch (const uno::Exception&)
{
@@ -179,8 +177,8 @@ void OWriterConnection::disposing()
// XServiceInfo
-IMPLEMENT_SERVICE_INFO(OWriterConnection, "com.sun.star.sdbc.drivers.writer.Connection",
- "com.sun.star.sdbc.Connection")
+IMPLEMENT_SERVICE_INFO(OWriterConnection, u"com.sun.star.sdbc.drivers.writer.Connection"_ustr,
+ u"com.sun.star.sdbc.Connection"_ustr)
uno::Reference<sdbc::XDatabaseMetaData> SAL_CALL OWriterConnection::getMetaData()
{
@@ -200,12 +198,11 @@ uno::Reference<sdbc::XDatabaseMetaData> SAL_CALL OWriterConnection::getMetaData(
css::uno::Reference<css::sdbcx::XTablesSupplier> OWriterConnection::createCatalog()
{
::osl::MutexGuard aGuard(m_aMutex);
- uno::Reference<css::sdbcx::XTablesSupplier> xTab = m_xCatalog;
+ rtl::Reference<connectivity::sdbcx::OCatalog> xTab = m_xCatalog;
if (!xTab.is())
{
- auto pCat = new OWriterCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
+ xTab = new OWriterCatalog(this);
+ m_xCatalog = xTab.get();
}
return xTab;
}
@@ -216,7 +213,7 @@ uno::Reference<sdbc::XStatement> SAL_CALL OWriterConnection::createStatement()
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
uno::Reference<sdbc::XStatement> xReturn = new component::OComponentStatement(this);
- m_aStatements.push_back(uno::WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -226,10 +223,10 @@ uno::Reference<sdbc::XPreparedStatement>
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- auto pStmt = new component::OComponentPreparedStatement(this);
- uno::Reference<sdbc::XPreparedStatement> xHoldAlive = pStmt;
+ rtl::Reference<component::OComponentPreparedStatement> pStmt
+ = new component::OComponentPreparedStatement(this);
pStmt->construct(sql);
- m_aStatements.push_back(uno::WeakReferenceHelper(*pStmt));
+ m_aStatements.emplace_back(*pStmt);
return pStmt;
}
@@ -239,8 +236,7 @@ uno::Reference<sdbc::XPreparedStatement>
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException("XConnection::prepareCall", *this);
- return nullptr;
+ ::dbtools::throwFeatureNotImplementedSQLException(u"XConnection::prepareCall"_ustr, *this);
}
} // namespace
diff --git a/connectivity/source/drivers/writer/WDatabaseMetaData.cxx b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
index 2e55a46d2c6d..29a6ab9379e2 100644
--- a/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
@@ -47,13 +47,13 @@ uno::Reference<sdbc::XResultSet> SAL_CALL OWriterDatabaseMetaData::getTables(
{
::osl::MutexGuard aGuard(m_aMutex);
- auto pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
- uno::Reference<sdbc::XResultSet> xRef = pResult;
+ rtl::Reference<ODatabaseMetaDataResultSet> pResult
+ = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
// check if ORowSetValue type is given
// when no types are given then we have to return all tables e.g. TABLE
- OUString aTable("TABLE");
+ OUString aTable(u"TABLE"_ustr);
bool bTableFound = true;
sal_Int32 nLength = types.getLength();
@@ -73,7 +73,7 @@ uno::Reference<sdbc::XResultSet> SAL_CALL OWriterDatabaseMetaData::getTables(
}
}
if (!bTableFound)
- return xRef;
+ return pResult;
// get the table names from the document
@@ -90,21 +90,22 @@ uno::Reference<sdbc::XResultSet> SAL_CALL OWriterDatabaseMetaData::getTables(
sal_Int32 nTableCount = aTableNames.getLength();
for (sal_Int32 nTable = 0; nTable < nTableCount; nTable++)
{
- OUString aName = aTableNames[nTable];
- if (match(tableNamePattern, aName, '\0'))
+ const OUString& rName = aTableNames[nTable];
+ if (match(tableNamePattern, rName, '\0'))
{
- ODatabaseMetaDataResultSet::ORow aRow{ nullptr, nullptr, nullptr };
- aRow.reserve(6);
- aRow.push_back(new ORowSetValueDecorator(aName));
- aRow.push_back(new ORowSetValueDecorator(aTable));
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ ODatabaseMetaDataResultSet::ORow aRow{ nullptr,
+ nullptr,
+ nullptr,
+ new ORowSetValueDecorator(rName),
+ new ORowSetValueDecorator(aTable),
+ ODatabaseMetaDataResultSet::getEmptyValue() };
aRows.push_back(aRow);
}
}
- pResult->setRows(aRows);
+ pResult->setRows(std::move(aRows));
- return xRef;
+ return pResult;
}
} // namespace
diff --git a/connectivity/source/drivers/writer/WDriver.cxx b/connectivity/source/drivers/writer/WDriver.cxx
index 9bd3bc76c1e8..daa94aa43f9c 100644
--- a/connectivity/source/drivers/writer/WDriver.cxx
+++ b/connectivity/source/drivers/writer/WDriver.cxx
@@ -31,24 +31,21 @@ namespace connectivity::writer
{
OUString SAL_CALL ODriver::getImplementationName()
{
- return "com.sun.star.comp.sdbc.writer.ODriver";
+ return u"com.sun.star.comp.sdbc.writer.ODriver"_ustr;
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
connectivity_writer_ODriver(css::uno::XComponentContext* context,
css::uno::Sequence<css::uno::Any> const& /*rArguments*/)
{
- rtl::Reference<ODriver> ret;
try
{
- ret = new ODriver(context);
+ return acquire(new ODriver(context));
}
catch (...)
{
}
- if (ret)
- ret->acquire();
- return static_cast<cppu::OWeakObject*>(ret.get());
+ return nullptr;
}
uno::Reference<sdbc::XConnection>
@@ -61,12 +58,11 @@ uno::Reference<sdbc::XConnection>
if (!acceptsURL(url))
return nullptr;
- auto pCon = new OWriterConnection(this);
+ rtl::Reference<OWriterConnection> pCon = new OWriterConnection(this);
pCon->construct(url, info);
- uno::Reference<sdbc::XConnection> xCon = pCon;
- m_xConnections.push_back(uno::WeakReferenceHelper(*pCon));
+ m_xConnections.push_back(pCon.get());
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL ODriver::acceptsURL(const OUString& url)
@@ -83,7 +79,7 @@ ODriver::getPropertyInfo(const OUString& url, const uno::Sequence<beans::Propert
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
::dbtools::throwGenericSQLException(sMessage, *this);
}
- return uno::Sequence<sdbc::DriverPropertyInfo>();
+ return {};
}
} // namespace
diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx
index 7236df2476dd..2f0f44855d86 100644
--- a/connectivity/source/drivers/writer/WTable.cxx
+++ b/connectivity/source/drivers/writer/WTable.cxx
@@ -30,8 +30,6 @@
#include <writer/WConnection.hxx>
#include <connectivity/sdbcx/VColumn.hxx>
#include <sal/log.hxx>
-#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
namespace com::sun::star::text
{
@@ -159,12 +157,11 @@ void OWriterTable::fillColumns()
aFind = connectivity::find(m_aColumns->begin(), m_aColumns->end(), aAlias, aCase);
}
- auto pColumn = new sdbcx::OColumn(
+ rtl::Reference<sdbcx::OColumn> pColumn = new sdbcx::OColumn(
aAlias, aTypeName, OUString(), OUString(), sdbc::ColumnValue::NULLABLE, nPrecision,
nDecimals, eType, false, false, bCurrency, bStoresMixedCaseQuotedIdentifiers,
m_CatalogName, getSchema(), getName());
- uno::Reference<XPropertySet> xCol = pColumn;
- m_aColumns->push_back(xCol);
+ m_aColumns->push_back(pColumn);
}
}
@@ -173,9 +170,6 @@ OWriterTable::OWriterTable(sdbcx::OCollection* _pTables, OWriterConnection* _pCo
: OWriterTable_BASE(_pTables, _pConnection, Name, Type, OUString() /*Description*/,
OUString() /*SchemaName*/, OUString() /*CatalogName*/)
, m_pWriterConnection(_pConnection)
- , m_nStartCol(0)
- , m_nDataCols(0)
- , m_bHasHeaders(false)
{
}
@@ -212,19 +206,6 @@ void SAL_CALL OWriterTable::disposing()
m_pWriterConnection = nullptr;
}
-uno::Sequence<sal_Int8> OWriterTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-sal_Int64 OWriterTable::getSomething(const uno::Sequence<sal_Int8>& rId)
-{
- return (isUnoTunnelId<OWriterTable>(rId)) ? reinterpret_cast<sal_Int64>(this)
- : OWriterTable_BASE::getSomething(rId);
-}
-
bool OWriterTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData)
{
// read the bookmark
diff --git a/connectivity/source/drivers/writer/WTables.cxx b/connectivity/source/drivers/writer/WTables.cxx
index 15dc9e0c1941..0d98471217f6 100644
--- a/connectivity/source/drivers/writer/WTables.cxx
+++ b/connectivity/source/drivers/writer/WTables.cxx
@@ -29,15 +29,15 @@ using namespace ::com::sun::star;
namespace connectivity::writer
{
-sdbcx::ObjectType OWriterTables::createObject(const OUString& rName)
+css::uno::Reference<css::beans::XPropertySet> OWriterTables::createObject(const OUString& rName)
{
- auto pTable = new OWriterTable(this,
- static_cast<OWriterConnection*>(
- static_cast<file::OFileCatalog&>(m_rParent).getConnection()),
- rName, "TABLE");
- sdbcx::ObjectType xRet = pTable;
+ rtl::Reference<OWriterTable> pTable
+ = new OWriterTable(this,
+ static_cast<OWriterConnection*>(
+ static_cast<file::OFileCatalog&>(m_rParent).getConnection()),
+ rName, u"TABLE"_ustr);
pTable->construct();
- return xRet;
+ return pTable;
}
} // namespace
diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
index f8327e308e65..6dcd7a199daf 100644
--- a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
@@ -32,16 +32,17 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
#include <comphelper/proparrhlp.hxx>
-#include <comphelper/propertycontainer.hxx>
+#include <comphelper/propertycontainer2.hxx>
#include <connectivity/FValue.hxx>
#include <connectivity/dbtoolsdllapi.hxx>
+#include <comphelper/compbase.hxx>
namespace connectivity
{
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet,
+ class ODatabaseMetaDataResultSetMetaData;
+
+ typedef ::comphelper::WeakComponentImplHelper< css::sdbc::XResultSet,
css::sdbc::XRow,
css::sdbc::XResultSetMetaDataSupplier,
css::util::XCancellable,
@@ -54,11 +55,10 @@ namespace connectivity
// typedef ORefVector<ORowSetValue> ORow;
// typedef ORefVector<ORow> ORows;
- class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataResultSet :
- public cppu::BaseMutex,
- public ODatabaseMetaDataResultSet_BASE,
- public ::comphelper::OPropertyContainer,
- public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
+ class SAL_DLLPUBLIC_RTTI ODatabaseMetaDataResultSet :
+ public ODatabaseMetaDataResultSet_BASE,
+ public ::comphelper::OPropertyContainer2,
+ public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
{
public:
@@ -107,8 +107,7 @@ namespace connectivity
private:
ORowSetValue m_aEmptyValue;
- css::uno::WeakReferenceHelper m_aStatement;
- css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData;
+ rtl::Reference< ODatabaseMetaDataResultSetMetaData> m_xMetaData;
sal_Int32 m_nColPos;
sal_Int32 m_nFetchSize;
@@ -118,8 +117,9 @@ namespace connectivity
void construct();
/// @throws css::sdbc::SQLException
- void checkIndex(sal_Int32 columnIndex );
+ void checkIndex(std::unique_lock<std::mutex>& rGuard, sal_Int32 columnIndex );
void setType(MetaDataResultSetType _eType);
+ css::uno::Reference< css::sdbc::XResultSetMetaData > getMetaData( std::unique_lock<std::mutex>& );
protected:
ORows m_aRows;
@@ -130,22 +130,26 @@ namespace connectivity
virtual const ORowSetValue& getValue(sal_Int32 columnIndex);
// OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+ OOO_DLLPUBLIC_DBTOOLS virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
// OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+ OOO_DLLPUBLIC_DBTOOLS virtual ::cppu::IPropertyArrayHelper & getInfoHelper() override;
+
+ bool next(std::unique_lock<std::mutex>& );
+ bool isBeforeFirst(std::unique_lock<std::mutex>& );
+ bool isAfterLast(std::unique_lock<std::mutex>& );
virtual ~ODatabaseMetaDataResultSet() override;
public:
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ OOO_DLLPUBLIC_DBTOOLS virtual void SAL_CALL acquire() noexcept override;
+ OOO_DLLPUBLIC_DBTOOLS virtual void SAL_CALL release() noexcept override;
/// default construction
ODatabaseMetaDataResultSet();
/// construction of a pre-defined result set type
- ODatabaseMetaDataResultSet( MetaDataResultSetType _eType );
+ OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataResultSet( MetaDataResultSetType _eType );
- void setRows(const ORows& _rRows);
+ OOO_DLLPUBLIC_DBTOOLS void setRows(ORows&& _rRows);
// XServiceInfo
@@ -153,14 +157,14 @@ namespace connectivity
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;
+ // ::comphelper::WeakComponentImplHelper
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
// XInterface
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ OOO_DLLPUBLIC_DBTOOLS 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;
+ OOO_DLLPUBLIC_DBTOOLS 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;
@@ -238,31 +242,31 @@ namespace connectivity
// some methods to get already defined ORowSetValues
// this increase the reuse of ORowSetValues
/// return an empty ORowSetValueDecorator
- static ORowSetValueDecoratorRef const & getEmptyValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getEmptyValue();
/// return an ORowSetValueDecorator with 0 as value
- static ORowSetValueDecoratorRef const & get0Value();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & get0Value();
/// return an ORowSetValueDecorator with 1 as value
- static ORowSetValueDecoratorRef const & get1Value();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & get1Value();
/// return an ORowSetValueDecorator with ColumnSearch::BASIC as value
- static ORowSetValueDecoratorRef const & getBasicValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getBasicValue();
/// return an ORowSetValueDecorator with string SELECT as value
- static ORowSetValueDecoratorRef const & getSelectValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getSelectValue();
/// return an ORowSetValueDecorator with string INSERT as value
- static ORowSetValueDecoratorRef const & getInsertValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getInsertValue();
/// return an ORowSetValueDecorator with string DELETE as value
- static ORowSetValueDecoratorRef const & getDeleteValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getDeleteValue();
/// return an ORowSetValueDecorator with string UPDATE as value
- static ORowSetValueDecoratorRef const & getUpdateValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getUpdateValue();
/// return an ORowSetValueDecorator with string CREATE as value
- static ORowSetValueDecoratorRef const & getCreateValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getCreateValue();
/// return an ORowSetValueDecorator with string READ as value
- static ORowSetValueDecoratorRef const & getReadValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getReadValue();
/// return an ORowSetValueDecorator with string ALTER as value
- static ORowSetValueDecoratorRef const & getAlterValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getAlterValue();
/// return an ORowSetValueDecorator with string DROP as value
- static ORowSetValueDecoratorRef const & getDropValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getDropValue();
/// return an ORowSetValueDecorator with string ' as value
- static ORowSetValueDecoratorRef const & getQuoteValue();
+ OOO_DLLPUBLIC_DBTOOLS static ORowSetValueDecoratorRef const & getQuoteValue();
};
}
diff --git a/connectivity/source/inc/OColumn.hxx b/connectivity/source/inc/OColumn.hxx
index a60f44e2bb8b..2131b3e15254 100644
--- a/connectivity/source/inc/OColumn.hxx
+++ b/connectivity/source/inc/OColumn.hxx
@@ -17,12 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_OCOLUMN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_OCOLUMN_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <connectivity/dbtoolsdllapi.hxx>
+#include <utility>
namespace connectivity
{
@@ -65,14 +65,14 @@ namespace connectivity
, m_DefinitelyWritable(false)
{}
- OColumn(const OUString &_aTableName,
+ OColumn(OUString _aTableName,
const OUString &_aColumnName,
sal_Int32 _aNullable,
sal_Int32 _aColumnDisplaySize,
sal_Int32 _aPrecision,
sal_Int32 _aScale,
sal_Int32 _aColumnType)
- : m_TableName(_aTableName),
+ : m_TableName(std::move(_aTableName)),
m_ColumnName(_aColumnName),
m_ColumnLabel(),
@@ -116,6 +116,4 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_OCOLUMN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/OTypeInfo.hxx b/connectivity/source/inc/OTypeInfo.hxx
index 772a46223c88..4e9cbdf05e6a 100644
--- a/connectivity/source/inc/OTypeInfo.hxx
+++ b/connectivity/source/inc/OTypeInfo.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_OTYPEINFO_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_OTYPEINFO_HXX
+#pragma once
#include <com/sun/star/sdbc/DataType.hpp>
@@ -48,6 +47,4 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_OTYPEINFO_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ParameterSubstitution.hxx b/connectivity/source/inc/ParameterSubstitution.hxx
index e0a540332ff3..a76bd09398fa 100644
--- a/connectivity/source/inc/ParameterSubstitution.hxx
+++ b/connectivity/source/inc/ParameterSubstitution.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_PARAMETERSUBSTITUTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_PARAMETERSUBSTITUTION_HXX
+#pragma once
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -42,7 +41,7 @@ namespace connectivity
ParameterSubstitution( const ParameterSubstitution& ) = delete;
ParameterSubstitution& operator=( const ParameterSubstitution& ) = delete;
public:
- ParameterSubstitution(const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
+ ParameterSubstitution(css::uno::Reference< css::uno::XComponentContext > _rContext );
private:
// XServiceInfo
@@ -61,6 +60,4 @@ namespace connectivity
} // connectivity
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/RowFunctionParser.hxx b/connectivity/source/inc/RowFunctionParser.hxx
index 28ed97689410..059544e51f2d 100644
--- a/connectivity/source/inc/RowFunctionParser.hxx
+++ b/connectivity/source/inc/RowFunctionParser.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ROWFUNCTIONPARSER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ROWFUNCTIONPARSER_HXX
+#pragma once
#include <sal/config.h>
#include "FDatabaseMetaDataResultSet.hxx"
@@ -107,6 +106,4 @@ private:
} // namespace connectivity
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ROWFUNCTIONPARSER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/TConnection.hxx b/connectivity/source/inc/TConnection.hxx
index 85e6e4fac546..d68371315fd1 100644
--- a/connectivity/source/inc/TConnection.hxx
+++ b/connectivity/source/inc/TConnection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_TCONNECTION_HXX
+#pragma once
#include <rtl/textenc.h>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -62,7 +61,7 @@ namespace connectivity
rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; }
const OUString& getURL() const { return m_sURL; }
void setURL(const OUString& _rsUrl) { m_sURL = _rsUrl; }
- void throwGenericSQLException(const char* pErrorResourceId, const css::uno::Reference< css::uno::XInterface>& _xContext);
+ [[noreturn]] void throwGenericSQLException(TranslateId pErrorResourceId, const css::uno::Reference< css::uno::XInterface>& _xContext);
const SharedResources& getResources() const { return m_aResources;}
void setConnectionInfo(const css::uno::Sequence< css::beans::PropertyValue >& _aInfo) { m_aConnectionInfo = _aInfo; }
@@ -74,10 +73,9 @@ namespace connectivity
//XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TCONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/TDatabaseMetaDataBase.hxx b/connectivity/source/inc/TDatabaseMetaDataBase.hxx
index a13adf215167..6fb37adea881 100644
--- a/connectivity/source/inc/TDatabaseMetaDataBase.hxx
+++ b/connectivity/source/inc/TDatabaseMetaDataBase.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TDATABASEMETADATABASE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_TDATABASEMETADATABASE_HXX
+#pragma once
#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
#include <cppuhelper/implbase.hxx>
@@ -28,108 +27,110 @@
#include <functional>
#include <connectivity/dbtoolsdllapi.hxx>
+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;
- css::uno::Reference< css::lang::XEventListener> 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TDATABASEMETADATABASE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/TKeyValue.hxx b/connectivity/source/inc/TKeyValue.hxx
index abf61a4c7429..49d41e0144f2 100644
--- a/connectivity/source/inc/TKeyValue.hxx
+++ b/connectivity/source/inc/TKeyValue.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TKEYVALUE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_TKEYVALUE_HXX
+#pragma once
#include <connectivity/FValue.hxx>
#include <connectivity/dbtoolsdllapi.hxx>
@@ -45,18 +44,16 @@ namespace connectivity
OUString getKeyString(std::vector<ORowSetValueDecoratorRef>::size_type i) const
{
OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
- return m_aKeys[i]->getValue();
+ return m_aKeys[i]->getValue().getString();
}
double getKeyDouble(std::vector<ORowSetValueDecoratorRef>::size_type i) const
{
OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue");
- return m_aKeys[i]->getValue();
+ return m_aKeys[i]->getValue().getDouble();
}
sal_Int32 getValue() const { return m_nValue; }
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TKEYVALUE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/TPrivilegesResultSet.hxx b/connectivity/source/inc/TPrivilegesResultSet.hxx
index d8f31194dc16..8c4070fce97a 100644
--- a/connectivity/source/inc/TPrivilegesResultSet.hxx
+++ b/connectivity/source/inc/TPrivilegesResultSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TPRIVILEGESRESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_TPRIVILEGESRESULTSET_HXX
+#pragma once
#include "FDatabaseMetaDataResultSet.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -37,12 +36,11 @@ namespace connectivity
OResultSetPrivileges(const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _rxMeta
,const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern);
- // ::cppu::OComponentHelper
- virtual void SAL_CALL disposing() override;
+ // ::comphelper::WeakComponentImplHelper
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
// XResultSet
virtual sal_Bool SAL_CALL next( ) override;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TPRIVILEGESRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/TResultSetHelper.hxx b/connectivity/source/inc/TResultSetHelper.hxx
index e6c0efd9c97f..cedea102725a 100644
--- a/connectivity/source/inc/TResultSetHelper.hxx
+++ b/connectivity/source/inc/TResultSetHelper.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TRESULTSETHELPER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_TRESULTSETHELPER_HXX
+#pragma once
#include <sal/types.h>
#include <connectivity/dbtoolsdllapi.hxx>
@@ -49,6 +48,4 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TRESULTSETHELPER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/TSkipDeletedSet.hxx b/connectivity/source/inc/TSkipDeletedSet.hxx
index 3935264696ed..efe142af548c 100644
--- a/connectivity/source/inc/TSkipDeletedSet.hxx
+++ b/connectivity/source/inc/TSkipDeletedSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TSKIPDELETEDSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_TSKIPDELETEDSET_HXX
+#pragma once
#include "TResultSetHelper.hxx"
#include <vector>
@@ -77,6 +76,5 @@ namespace connectivity
void SetDeletedVisible(bool _bDeletedVisible) { m_bDeletedVisible = _bDeletedVisible; }
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TSKIPDELETEDSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/TSortIndex.hxx b/connectivity/source/inc/TSortIndex.hxx
index c0354316efd9..ad23e2b48ba7 100644
--- a/connectivity/source/inc/TSortIndex.hxx
+++ b/connectivity/source/inc/TSortIndex.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TSORTINDEX_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_TSORTINDEX_HXX
+#pragma once
#include <connectivity/dbtoolsdllapi.hxx>
#include "TKeyValue.hxx"
@@ -38,7 +37,6 @@ namespace connectivity
};
class OKeySet;
- class OKeyValue; // simple class which holds a sal_Int32 and a std::vector<ORowSetValueDecoratorRef>
/**
The class OSortIndex can be used to implement a sorted index.
@@ -58,8 +56,8 @@ namespace connectivity
public:
- OSortIndex( const std::vector<OKeyType>& _aKeyType,
- const std::vector<TAscendingOrder>& _aAscending);
+ OSortIndex( std::vector<OKeyType>&& _aKeyType,
+ std::vector<TAscendingOrder>&& _aAscending);
OSortIndex(OSortIndex const &) = delete; // MSVC2015 workaround
OSortIndex& operator=(OSortIndex const &) = delete; // MSVC2015 workaround
@@ -107,6 +105,5 @@ namespace connectivity
void setFrozen() { m_bFrozen = true; }
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TSORTINDEX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ACallableStatement.hxx b/connectivity/source/inc/ado/ACallableStatement.hxx
index 3114242558ac..707b57ebb315 100644
--- a/connectivity/source/inc/ado/ACallableStatement.hxx
+++ b/connectivity/source/inc/ado/ACallableStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACALLABLESTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACALLABLESTATEMENT_HXX
+#pragma once
#include <ado/APreparedStatement.hxx>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -28,51 +27,50 @@
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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ };
}
-#endif // _CONNECTIVITY_OCallableStatement_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ACatalog.hxx b/connectivity/source/inc/ado/ACatalog.hxx
index 9afe9e41cfb9..326b803f7f51 100644
--- a/connectivity/source/inc/ado/ACatalog.hxx
+++ b/connectivity/source/inc/ado/ACatalog.hxx
@@ -16,36 +16,34 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACATALOG_HXX
+#pragma once
#include <sdbcx/VCatalog.hxx>
#include <ado/Awrapadox.hxx>
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; }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACATALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AColumn.hxx b/connectivity/source/inc/ado/AColumn.hxx
index 84344ece755e..151238a5f10d 100644
--- a/connectivity/source/inc/ado/AColumn.hxx
+++ b/connectivity/source/inc/ado/AColumn.hxx
@@ -17,41 +17,36 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMN_HXX
+#pragma once
#include <connectivity/sdbcx/VColumn.hxx>
#include <ado/Awrapadox.hxx>
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;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AColumns.hxx b/connectivity/source/inc/ado/AColumns.hxx
index f9773ba48460..4ff9ad041376 100644
--- a/connectivity/source/inc/ado/AColumns.hxx
+++ b/connectivity/source/inc/ado/AColumns.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMNS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -27,32 +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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
+ {
+ }
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx
index 29f552946a89..2d29fbe64a12 100644
--- a/connectivity/source/inc/ado/AConnection.hxx
+++ b/connectivity/source/inc/ado/AConnection.hxx
@@ -16,120 +16,116 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACONNECTION_HXX
+#pragma once
#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <map>
+#include <string_view>
#include <connectivity/CommonTools.hxx>
+#include <unotools/weakref.hxx>
#include <OTypeInfo.hxx>
#include <TConnection.hxx>
#include <ado/Awrapado.hxx>
+#include <ado/ACatalog.hxx>
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;
- class OCatalog;
- 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.
- css::uno::WeakReference< css::sdbcx::XTablesSupplier> m_xCatalog;
- ODriver* m_pDriver;
- private:
- WpADOConnection* m_pAdoConnection;
- OCatalog* m_pCatalog;
- 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(const OUString& 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_pAdoConnection; }
- void setCatalog(const css::uno::WeakReference< css::sdbcx::XTablesSupplier>& _xCat) { m_xCatalog = _xCat; }
- void setCatalog(OCatalog* _pCatalog) { m_pCatalog = _pCatalog; }
-
- const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo;}
- OCatalog* getAdoCatalog() const
- {
- if ( m_xCatalog.get().is() )
- return m_pCatalog;
- return nullptr;
- }
-
- 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ACONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ADatabaseMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaData.hxx
index af59ab2429e1..2cecedda93fe 100644
--- a/connectivity/source/inc/ado/ADatabaseMetaData.hxx
+++ b/connectivity/source/inc/ado/ADatabaseMetaData.hxx
@@ -17,208 +17,205 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATA_HXX
+#pragma once
#include <TDatabaseMetaDataBase.hxx>
#include <map>
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_pADOConnection;
- 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;
};
-}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATA_HXX
+ 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;
+ };
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx
index a13ae359a5cc..3c3e1dd30f34 100644
--- a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -36,192 +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_aStatement;
- 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ }
+
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx
index 59750edfd400..9d14454b6469 100644
--- a/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx
+++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <cppuhelper/implbase.hxx>
@@ -30,75 +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 > () throw()
- { 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;
+ };
}
-#endif // _CONNECTIVITY_ADO_ADATABASEMETARESULTSETMETADATA_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ADriver.hxx b/connectivity/source/inc/ado/ADriver.hxx
index a428ed1636ca..7aacd59c95cb 100644
--- a/connectivity/source/inc/ado/ADriver.hxx
+++ b/connectivity/source/inc/ado/ADriver.hxx
@@ -17,66 +17,68 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADRIVER_HXX
+#pragma once
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/compbase.hxx>
+#include <unotools/weakref.hxx>
#include <connectivity/CommonTools.hxx>
namespace com::sun::star::uno { class XComponentContext; }
namespace connectivity::ado
{
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver,
- css::sdbcx::XDataDefinitionSupplier,
- css::lang::XServiceInfo
- > ODriver_BASE;
- class ODriver : public ODriver_BASE
- {
- ::osl::Mutex m_aMutex;
-
- connectivity::OWeakRefArray 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADRIVER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AGroup.hxx b/connectivity/source/inc/ado/AGroup.hxx
index 73b526006647..a5cdef4b2025 100644
--- a/connectivity/source/inc/ado/AGroup.hxx
+++ b/connectivity/source/inc/ado/AGroup.hxx
@@ -17,48 +17,42 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUP_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUP_HXX
+#pragma once
#include <sdbcx/VGroup.hxx>
#include <ado/Awrapadox.hxx>
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);
-
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
- // 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; }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUP_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AGroups.hxx b/connectivity/source/inc/ado/AGroups.hxx
index 91c38dc64b1b..e3d7e2555b8a 100644
--- a/connectivity/source/inc/ado/AGroups.hxx
+++ b/connectivity/source/inc/ado/AGroups.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUPS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUPS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <ado/Awrapadox.hxx>
@@ -26,29 +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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
+ {
+ }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AGROUPS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AIndex.hxx b/connectivity/source/inc/ado/AIndex.hxx
index 41a839619b78..d6e7c65a0215 100644
--- a/connectivity/source/inc/ado/AIndex.hxx
+++ b/connectivity/source/inc/ado/AIndex.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEX_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEX_HXX
+#pragma once
#include <sdbcx/VIndex.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -26,26 +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);
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ 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;}
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AIndexes.hxx b/connectivity/source/inc/ado/AIndexes.hxx
index 065c8a0b1843..525c6052a8c1 100644
--- a/connectivity/source/inc/ado/AIndexes.hxx
+++ b/connectivity/source/inc/ado/AIndexes.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEXES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEXES_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -25,32 +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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
- {
- }
- };
+ }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AINDEXES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AKey.hxx b/connectivity/source/inc/ado/AKey.hxx
index ffb1eebe4216..f4fe154c96d0 100644
--- a/connectivity/source/inc/ado/AKey.hxx
+++ b/connectivity/source/inc/ado/AKey.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEY_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEY_HXX
+#pragma once
#include <sdbcx/VKey.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -26,36 +25,31 @@
namespace connectivity::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);
-
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
- 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);
- };
+ 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);
+
+ 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEY_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AKeys.hxx b/connectivity/source/inc/ado/AKeys.hxx
index 6de3d5a2055a..4514c3bc7c70 100644
--- a/connectivity/source/inc/ado/AKeys.hxx
+++ b/connectivity/source/inc/ado/AKeys.hxx
@@ -17,40 +17,37 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEYS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEYS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <ado/Awrapadox.hxx>
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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
+ {
+ }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AKEYS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/APreparedStatement.hxx b/connectivity/source/inc/ado/APreparedStatement.hxx
index 214f277c16bf..8227252b685c 100644
--- a/connectivity/source/inc/ado/APreparedStatement.hxx
+++ b/connectivity/source/inc/ado/APreparedStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_APREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_APREPAREDSTATEMENT_HXX
+#pragma once
#include <ado/AStatement.hxx>
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
@@ -35,13 +34,12 @@ namespace connectivity
class OSQLParseNode;
namespace ado
{
+ using OPreparedStatement_BASE
+ = cppu::ImplInheritanceHelper<OStatement_Base, css::sdbc::XPreparedStatement,
+ css::sdbc::XParameters, css::sdbc::XResultSetMetaDataSupplier,
+ css::lang::XServiceInfo>;
- class OPreparedStatement : public OStatement_Base,
- public css::sdbc::XPreparedStatement,
- public css::sdbc::XParameters,
- public css::sdbc::XResultSetMetaDataSupplier,
- public css::lang::XServiceInfo
-
+ class OPreparedStatement : public OPreparedStatement_BASE
{
/// @throws css::sdbc::SQLException
/// @throws css::uno::RuntimeException
@@ -63,12 +61,6 @@ namespace connectivity
// a Constructor, that is needed for when Returning the Object is needed:
OPreparedStatement( OConnection* _pConnection, const OUString& sql);
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() 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;
-
// XPreparedStatement
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery( ) override;
using OStatement_Base::executeQuery;
@@ -110,6 +102,5 @@ namespace connectivity
};
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_APREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AResultSet.hxx b/connectivity/source/inc/ado/AResultSet.hxx
index 101835f26019..64f83f06ed93 100644
--- a/connectivity/source/inc/ado/AResultSet.hxx
+++ b/connectivity/source/inc/ado/AResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSET_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -39,198 +38,197 @@
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;
- ADO_LONGPTR 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AResultSetMetaData.hxx b/connectivity/source/inc/ado/AResultSetMetaData.hxx
index 6389efc04a70..762593233f22 100644
--- a/connectivity/source/inc/ado/AResultSetMetaData.hxx
+++ b/connectivity/source/inc/ado/AResultSetMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSETMETADATA_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <cppuhelper/implbase.hxx>
@@ -31,51 +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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ARESULTSETMETADATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AStatement.hxx b/connectivity/source/inc/ado/AStatement.hxx
index a85992d01f03..00e37b66d3b5 100644
--- a/connectivity/source/inc/ado/AStatement.hxx
+++ b/connectivity/source/inc/ado/AStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ASTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ASTATEMENT_HXX
+#pragma once
#include <com/sun/star/sdbc/XStatement.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
@@ -30,6 +29,7 @@
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <comphelper/proparrhlp.hxx>
+#include <unotools/weakref.hxx>
#include <ado/AConnection.hxx>
#include <string_view>
#include <vector>
@@ -38,182 +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;
-
- css::uno::WeakReference< css::sdbc::XResultSet> 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.
- ADO_LONGPTR 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() throw() override;
- virtual void SAL_CALL release() throw() 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ASTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ATable.hxx b/connectivity/source/inc/ado/ATable.hxx
index dd0949dd2c3d..83f21d4f78fe 100644
--- a/connectivity/source/inc/ado/ATable.hxx
+++ b/connectivity/source/inc/ado/ATable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLE_HXX
+#pragma once
#include <connectivity/sdbcx/VTable.hxx>
#include <ado/Awrapadox.hxx>
@@ -26,49 +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;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ 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; }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/ATables.hxx b/connectivity/source/inc/ado/ATables.hxx
index 2ca881051ff6..2f37340133a3 100644
--- a/connectivity/source/inc/ado/ATables.hxx
+++ b/connectivity/source/inc/ado/ATables.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLES_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <ado/Awrapadox.hxx>
@@ -25,30 +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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ATABLES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AUser.hxx b/connectivity/source/inc/ado/AUser.hxx
index 1368ed46d922..c0c661904776 100644
--- a/connectivity/source/inc/ado/AUser.hxx
+++ b/connectivity/source/inc/ado/AUser.hxx
@@ -17,72 +17,67 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSER_HXX
+#pragma once
#include <sdbcx/VUser.hxx>
#include <ado/Awrapadox.hxx>
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);
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
- // 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;}
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AUsers.hxx b/connectivity/source/inc/ado/AUsers.hxx
index 17979351ef0a..b88776206321 100644
--- a/connectivity/source/inc/ado/AUsers.hxx
+++ b/connectivity/source/inc/ado/AUsers.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSERS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSERS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <ado/Awrapadox.hxx>
@@ -27,30 +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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual void impl_refresh() override;
- virtual sdbcx::ObjectType 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)
- {
- }
- };
+ }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AUSERS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AView.hxx b/connectivity/source/inc/ado/AView.hxx
index 8aabc1053ba8..320140df4a68 100644
--- a/connectivity/source/inc/ado/AView.hxx
+++ b/connectivity/source/inc/ado/AView.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEW_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEW_HXX
+#pragma once
#include <connectivity/sdbcx/VView.hxx>
#include <ado/Awrapadox.hxx>
@@ -26,29 +25,23 @@
namespace connectivity::ado
{
- typedef sdbcx::OView OView_ADO;
+ typedef sdbcx::OView OView_ADO;
- class OAdoView : public OView_ADO
- {
- WpADOView m_aView;
+ 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);
+ protected:
+ // OPropertySetHelper
+ virtual void SAL_CALL getFastPropertyValue(
+ css::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const override;
+ public:
+ OAdoView(bool _bCase, ADOView* _pView=nullptr);
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
- WpADOView getImpl() const { return m_aView;}
- };
+ WpADOView getImpl() const { return m_aView;}
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/AViews.hxx b/connectivity/source/inc/ado/AViews.hxx
index be90d1463f08..5d3e322f4a89 100644
--- a/connectivity/source/inc/ado/AViews.hxx
+++ b/connectivity/source/inc/ado/AViews.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEWS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEWS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <ado/Awrapadox.hxx>
@@ -28,26 +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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
- {
- }
- };
+ }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AVIEWS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx
index d44287d7440c..72929c37db73 100644
--- a/connectivity/source/inc/ado/Aolevariant.hxx
+++ b/connectivity/source/inc/ado/Aolevariant.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX
+#pragma once
#include <sal/types.h>
#include <rtl/ustring.hxx>
@@ -34,114 +33,91 @@ namespace com::sun::star::util
namespace connectivity::ado
{
- class OLEString
+ 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))
{
- BSTR m_sStr;
- public:
- OLEString();
- OLEString(const BSTR& _sBStr);
- OLEString(std::u16string_view _sBStr);
- OLEString(const OLEString& _rRh)
- {
- OLEString::operator=(_rRh);
- }
- ~OLEString();
- OLEString& operator=(std::u16string_view _rSrc);
- OLEString& operator=(const BSTR& _rSrc);
- OLEString& operator=(const OLEString& _rSrc);
- OUString asOUString() const;
- BSTR asBSTR() const;
- BSTR* getAddress();
- sal_Int32 length() const;
- };
-
- 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))
- {
- }
- ~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);
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/Aolewrap.hxx b/connectivity/source/inc/ado/Aolewrap.hxx
index 3fb6b0713040..6069d319c471 100644
--- a/connectivity/source/inc/ado/Aolewrap.hxx
+++ b/connectivity/source/inc/ado/Aolewrap.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEWRAP_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEWRAP_HXX
+#pragma once
#include <osl/diagnose.h>
#include <osl/thread.h>
+#include <systools/win32/comtools.hxx>
+
#include <map>
#include <vector>
@@ -32,193 +33,142 @@ namespace rtl
}
namespace connectivity::ado
{
- class WpBase
- {
- protected:
- IDispatch* pIUnknown;
-
- void setIDispatch(IDispatch* _pIUnknown);
- public:
- WpBase();
- WpBase(IDispatch* pInt);
- //inline
- WpBase& operator=(const WpBase& rhs);
- WpBase& operator=(IDispatch* rhs);
- WpBase(const WpBase& aWrapper);
- virtual ~WpBase();
- void clear();
+ // 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;
- bool IsValid() const;
- operator IDispatch*();
+ public:
+ WpOLEBase(T* pInt = nullptr) : pInterface(pInt){}
- };
-
- // Template class WpOLEBase<class T>
- // ==================================
- //
- // Objects of this class contain a pointer to an interface of the type T.
- // The ctors and operator= make sure, that AddRef() and Release() are being
- // called adhering to COM conventions.
- // An object can also hold no pointer (null pointer), calling IsValid() then
- // returns false.
- //
- // In order to do efficient pass-by-value, this class (as all derived classes)
- // is a thin wrapper class, avoiding virtual methods and inlining.
-
- template<class T> class WpOLEBase : public WpBase
+ WpOLEBase(const WpOLEBase<T>& aWrapper)
+ : pInterface( aWrapper.pInterface )
{
- protected:
- T* pInterface;
-
- public:
- WpOLEBase(T* pInt = nullptr) : WpBase(pInt),pInterface(pInt){}
-
-
- //inline
- WpOLEBase<T>& operator=(const WpOLEBase<T>& rhs)
- {
- WpBase::operator=(rhs);
- pInterface = rhs.pInterface;
- return *this;
- };
-
- WpOLEBase<T>& operator=(T* rhs)
- {
- WpBase::operator=(rhs);
- pInterface = rhs.pInterface;
- return *this;
- }
-
- WpOLEBase(const WpOLEBase<T>& aWrapper)
- : WpBase( aWrapper )
- , pInterface( aWrapper.pInterface )
- {
- }
+ }
- operator T*() const { return pInterface; }
- void setWithOutAddRef(T* _pInterface)
- {
- pInterface = _pInterface;
- WpBase::setIDispatch(_pInterface);
- }
+ //inline
+ WpOLEBase<T>& operator=(const WpOLEBase<T>& rhs)
+ {
+ pInterface = rhs.pInterface;
+ return *this;
};
-
- // Template class WpOLECollection<class Ts, class T, 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 T (actually: with the interface T, e.g. DAOField)
- // via get_Item (here GetItem).
- //
- // This wrapper class does not expose an interface T, however,
- // it exposes an object of the class WrapT. This must allow a construction
- // by T, preferably it is derived from WpOLEBase<T>.
-
- template<class Ts, class T, 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(Ts* pInt=nullptr):WpOLEBase<Ts>(pInt){}
- 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
- {
- sal_Int32 nCount = 0;
- return pInterface ? (SUCCEEDED(pInterface->get_Count(&nCount)) ? nCount : sal_Int32(0)) : sal_Int32(0);
- }
+ 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!");
- T* pT = NULL;
- WrapT aRet(NULL);
- if(SUCCEEDED(pInterface->get_Item(OLEVariant(index), &pT)))
- aRet.setWithOutAddRef(pT);
- return aRet;
- }
+ 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
- {
- T* pT = NULL;
- WrapT aRet(NULL);
- if(SUCCEEDED(pInterface->get_Item(index, &pT)))
- aRet.setWithOutAddRef(pT);
- 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(NULL);
- T* pT = NULL;
- if (FAILED(pInterface->get_Item(OLEVariant(sStr), &pT)))
- {
#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
- }
- else
- aRet.setWithOutAddRef(pT);
- 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 T, class WrapT> class WpOLEAppendCollection:
- public WpOLECollection<Ts,T,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(Ts* pInt=nullptr):WpOLECollection<Ts,T,WrapT>(pInt){}
- WpOLEAppendCollection(const WpOLEAppendCollection& rhs) : WpOLECollection<Ts, T, 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(static_cast<T*>(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)));
+ };
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEWRAP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx
index 4e52d13847cb..a8b4b382a4fa 100644
--- a/connectivity/source/inc/ado/Awrapado.hxx
+++ b/connectivity/source/inc/ado/Awrapado.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX
+#pragma once
#include <sal/config.h>
@@ -35,344 +34,339 @@
namespace connectivity::ado
{
- class WpADOConnection;
- class WpADOCommand;
- class WpADORecordset;
- class WpADOField;
- class WpADOParameter;
- class WpADOError;
- class WpADOProperty;
-
- typedef WpOLEAppendCollection< ADOFields, ADOField, WpADOField> WpADOFields;
- typedef WpOLECollection< ADOProperties, ADOProperty, WpADOProperty> WpADOProperties;
-
-
- class WpADOConnection : public WpOLEBase<ADOConnection>
- {
- friend class WpADOCommand;
- public:
-
- WpADOConnection(ADOConnection* pInt) : WpOLEBase<ADOConnection>(pInt){}
-
- 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,
- const OUString& 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,
- const OUString& procedureNamePattern );
- ADORecordset* getProcedureColumns( const css::uno::Any& catalog,
- const OUString& schemaPattern,
- const OUString& procedureNamePattern,
- const OUString& columnNamePattern );
- ADORecordset* getTables( const css::uno::Any& catalog,
- const OUString& schemaPattern,
- const OUString& tableNamePattern,
- const css::uno::Sequence< OUString >& types );
- ADORecordset* getColumns( const css::uno::Any& catalog,
- const OUString& schemaPattern,
- const OUString& 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(){}
- // Ctors, operator=
- // They only call the superclass
- WpADOCommand(ADOCommand* pInt) : WpOLEBase<ADOCommand>(pInt){}
-
- WpADOCommand(const WpADOCommand& rhs) : WpOLEBase<ADOCommand>(rhs) {}
-
- WpADOCommand& operator=(const WpADOCommand& rhs)
- {
- WpOLEBase<ADOCommand>::operator=(rhs); return *this;}
-
-
- bool putref_ActiveConnection( WpADOConnection *pCon);
-
- 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(ADOError* pInt):WpOLEBase<ADOError>(pInt){}
-
- 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(ADOField* pInt=nullptr):WpOLEBase<ADOField>(pInt){}
- 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>
+ 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
- WpADOProperty(ADOProperty* pInt=nullptr):WpOLEBase<ADOProperty>(pInt){}
- 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>
+ 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:
- // Ctors, operator=
- // They only call the superclass
- WpADORecordset(ADORecordset* pInt=nullptr):WpOLEBase<ADORecordset>(pInt){}
- 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_Param 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(ADO_LONGPTR &_nRet) const;
- bool get_MaxRecords(ADO_LONGPTR &_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(ADOParameter* pInt):WpOLEBase<ADOParameter>(pInt){}
- 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);
- };
+ 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/Awrapadox.hxx b/connectivity/source/inc/ado/Awrapadox.hxx
index 6bda5b4878d8..ba91422a1d09 100644
--- a/connectivity/source/inc/ado/Awrapadox.hxx
+++ b/connectivity/source/inc/ado/Awrapadox.hxx
@@ -89,7 +89,7 @@ namespace connectivity::ado
class WpADOGroup : public WpOLEBase<ADOGroup>
{
public:
- WpADOGroup(ADOGroup* pInt=nullptr) : WpOLEBase<ADOGroup>(pInt){}
+ WpADOGroup() = default;
WpADOGroup(const WpADOGroup& rhs) : WpOLEBase<ADOGroup>(rhs) {}
WpADOGroup& operator=(const WpADOGroup& rhs)
@@ -113,7 +113,7 @@ namespace connectivity::ado
class WpADOUser : public WpOLEBase<_ADOUser>
{
public:
- WpADOUser(_ADOUser* pInt=nullptr) : WpOLEBase<_ADOUser>(pInt){}
+ WpADOUser() = default;
WpADOUser(const WpADOUser& rhs) : WpOLEBase<_ADOUser>(rhs) {}
WpADOUser& operator=(const WpADOUser& rhs)
diff --git a/connectivity/source/inc/ado/WrapCatalog.hxx b/connectivity/source/inc/ado/WrapCatalog.hxx
index 34834236b7dc..edfd846bbedc 100644
--- a/connectivity/source/inc/ado/WrapCatalog.hxx
+++ b/connectivity/source/inc/ado/WrapCatalog.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCATALOG_HXX
+#pragma once
#include <sal/config.h>
@@ -27,27 +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();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCATALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/WrapColumn.hxx b/connectivity/source/inc/ado/WrapColumn.hxx
index 096dcd326154..e5c277a92555 100644
--- a/connectivity/source/inc/ado/WrapColumn.hxx
+++ b/connectivity/source/inc/ado/WrapColumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCOLUMN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCOLUMN_HXX
+#pragma once
#include <sal/config.h>
@@ -29,37 +28,35 @@
namespace connectivity::ado
{
- class WpADOColumn : public WpOLEBase<_ADOColumn>
- {
- public:
- WpADOColumn(_ADOColumn* pInt=nullptr) : WpOLEBase<_ADOColumn>(pInt){}
- 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPCOLUMN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/WrapIndex.hxx b/connectivity/source/inc/ado/WrapIndex.hxx
index f4318c45873f..1644007424ce 100644
--- a/connectivity/source/inc/ado/WrapIndex.hxx
+++ b/connectivity/source/inc/ado/WrapIndex.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPINDEX_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPINDEX_HXX
+#pragma once
#include <sal/config.h>
@@ -27,29 +26,27 @@
namespace connectivity::ado
{
- class WpADOIndex : public WpOLEBase<_ADOIndex>
- {
- public:
- WpADOIndex(_ADOIndex* pInt=nullptr) : WpOLEBase<_ADOIndex>(pInt){}
- 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPINDEX_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/WrapKey.hxx b/connectivity/source/inc/ado/WrapKey.hxx
index 49969c41bb61..682da4fdffa8 100644
--- a/connectivity/source/inc/ado/WrapKey.hxx
+++ b/connectivity/source/inc/ado/WrapKey.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPKEY_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPKEY_HXX
+#pragma once
#include <sal/config.h>
@@ -27,31 +26,29 @@
namespace connectivity::ado
{
- class WpADOKey : public WpOLEBase<ADOKey>
- {
- public:
- WpADOKey(ADOKey* pInt=nullptr) : WpOLEBase<ADOKey>(pInt){}
- 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPKEY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/WrapTable.hxx b/connectivity/source/inc/ado/WrapTable.hxx
index 4119bfb58e3b..0519db42a435 100644
--- a/connectivity/source/inc/ado/WrapTable.hxx
+++ b/connectivity/source/inc/ado/WrapTable.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTABLE_HXX
+#pragma once
#include <sal/config.h>
@@ -27,34 +26,32 @@
namespace connectivity::ado
{
- class WpADOCatalog;
+ class WpADOCatalog;
- class WpADOTable : public WpOLEBase<_ADOTable>
- {
- public:
- WpADOTable(_ADOTable* pInt=nullptr) : WpOLEBase<_ADOTable>(pInt){}
- 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, _ADOTable, WpADOTable> WpADOTables;
+ typedef WpOLEAppendCollection<ADOTables, WpADOTable> WpADOTables;
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTABLE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/WrapTypeDefs.hxx b/connectivity/source/inc/ado/WrapTypeDefs.hxx
index 991d0018e5d8..a5bd3dea02b6 100644
--- a/connectivity/source/inc/ado/WrapTypeDefs.hxx
+++ b/connectivity/source/inc/ado/WrapTypeDefs.hxx
@@ -16,29 +16,26 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTYPEDEFS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTYPEDEFS_HXX
+#pragma once
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, _ADOTable, WpADOTable> WpADOTables;
- typedef WpOLEAppendCollection<ADOKeys, ADOKey, WpADOKey> WpADOKeys;
- typedef WpOLEAppendCollection<ADOIndexes, _ADOIndex, WpADOIndex> WpADOIndexes;
- typedef WpOLEAppendCollection<ADOColumns, _ADOColumn, WpADOColumn> WpADOColumns;
- typedef WpOLEAppendCollection<ADOGroups, ADOGroup, WpADOGroup> WpADOGroups;
- typedef WpOLEAppendCollection<ADOViews, ADOView, WpADOView> WpADOViews;
- typedef WpOLEAppendCollection<ADOUsers, _ADOUser, 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;
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_WRAPTYPEDEFS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx
index 5394aac3e4a0..41a5f1c18370 100644
--- a/connectivity/source/inc/ado/adoimp.hxx
+++ b/connectivity/source/inc/ado/adoimp.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADOIMP_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADOIMP_HXX
+#pragma once
#include <com/sun/star/sdbc/SQLException.hpp>
@@ -28,63 +27,61 @@ struct ADOConnection;
namespace connectivity::ado
{
- class WpADOField;
- class OLEString;
- class ADOS
- {
- public:
- // Also here: Free BSTR with SysFreeString()!
- static OLEString& 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);
+ };
}
@@ -96,10 +93,8 @@ namespace connectivity::ado
if(aProp.IsValid()) \
aVar = aProp.GetValue(); \
else \
- ADOS::ThrowException(*m_pADOConnection,*this);
+ ADOS::ThrowException(m_rADOConnection,*this);
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADOIMP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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..69f7b404f8d2 100644
--- a/connectivity/source/inc/calc/CConnection.hxx
+++ b/connectivity/source/inc/calc/CConnection.hxx
@@ -30,119 +30,117 @@ namespace com::sun::star {
namespace sheet { class XSpreadsheetDocument; }
}
-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 disposing(const css::lang::EventObject& rEvent) override
- {
- const bool bShutDown = (rEvent.Source == m_xDesktop);
- if (bShutDown)
- stop();
- }
- };
+ virtual void SAL_CALL notifyTermination(const css::lang::EventObject& /*rEvent*/) override
+ {
+ stop();
+ }
- rtl::Reference<CloseVetoButTerminateListener> m_xCloseVetoButTerminateListener;
+ virtual void SAL_CALL disposing() override
+ {
+ stop();
+ cppu::WeakComponentImplHelperBase::disposing();
+ }
- public:
- OCalcConnection(ODriver* _pDriver);
- virtual ~OCalcConnection() override;
+ virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override
+ {
+ const bool bShutDown = (rEvent.Source == m_xDesktop);
+ if (bShutDown)
+ stop();
+ }
+ };
+
+ 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 a8f49b661bc4..17dcab61b2f7 100644
--- a/connectivity/source/inc/calc/CTable.hxx
+++ b/connectivity/source/inc/calc/CTable.hxx
@@ -32,44 +32,40 @@ namespace com::sun::star::util {
namespace connectivity::calc
- {
- 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;
+{
+ typedef component::OComponentTable OCalcTable_BASE;
+ class OCalcConnection;
- void fillColumns();
+ 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;
- 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()
- );
+ void fillColumns();
- virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override;
+ 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 void SAL_CALL disposing() override;
+ virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ 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 0b88592a2e6a..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 sdbcx::ObjectType 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 627372e14282..5c20a3626a74 100644
--- a/connectivity/source/inc/component/CColumns.hxx
+++ b/connectivity/source/inc/component/CColumns.hxx
@@ -17,29 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CCOLUMNS_HXX
+#pragma once
#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 sdbcx::ObjectType 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)
+ {}
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CCOLUMNS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/component/CDatabaseMetaData.hxx b/connectivity/source/inc/component/CDatabaseMetaData.hxx
index 3f1d9ba7fd71..e46614e54356 100644
--- a/connectivity/source/inc/component/CDatabaseMetaData.hxx
+++ b/connectivity/source/inc/component/CDatabaseMetaData.hxx
@@ -17,34 +17,31 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CDATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CDATABASEMETADATA_HXX
+#pragma once
#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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CDATABASEMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/component/CPreparedStatement.hxx b/connectivity/source/inc/component/CPreparedStatement.hxx
index cd104abd68cd..157abfd79846 100644
--- a/connectivity/source/inc/component/CPreparedStatement.hxx
+++ b/connectivity/source/inc/component/CPreparedStatement.hxx
@@ -17,26 +17,22 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
+#pragma once
#include <file/FPreparedStatement.hxx>
namespace connectivity::component
+{
+ /// 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 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();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/component/CResultSet.hxx b/connectivity/source/inc/component/CResultSet.hxx
index 4fc46dfe7417..8758ba063bd2 100644
--- a/connectivity/source/inc/component/CResultSet.hxx
+++ b/connectivity/source/inc/component/CResultSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CRESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CRESULTSET_HXX
+#pragma once
#include <file/FResultSet.hxx>
#include <com/sun/star/sdbcx/XRowLocate.hpp>
@@ -25,58 +24,56 @@
#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() throw() override;
- virtual void SAL_CALL release() throw() 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; }
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CRESULTSET_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/component/CStatement.hxx b/connectivity/source/inc/component/CStatement.hxx
index dd6bea02d0e1..df88aac4756b 100644
--- a/connectivity/source/inc/component/CStatement.hxx
+++ b/connectivity/source/inc/component/CStatement.hxx
@@ -17,26 +17,22 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
+#pragma once
#include <file/FStatement.hxx>
namespace connectivity::component
+{
+ /// 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 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();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/component/CTable.hxx b/connectivity/source/inc/component/CTable.hxx
index d4713b1f82f7..47362de5db3d 100644
--- a/connectivity/source/inc/component/CTable.hxx
+++ b/connectivity/source/inc/component/CTable.hxx
@@ -17,53 +17,42 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CTABLE_HXX
+#pragma once
#include <file/FTable.hxx>
-namespace com::sun::star::sheet {
- class XSpreadsheet;
-}
-
-namespace com::sun::star::util {
- class XNumberFormats;
-}
-
namespace connectivity::component
- {
- 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;
+{
+ typedef file::OFileTable OComponentTable_BASE;
- 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 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;
- };
+ /// 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 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 css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CTABLE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DCatalog.hxx b/connectivity/source/inc/dbase/DCatalog.hxx
index 553f7c2aa78b..9004080aedf6 100644
--- a/connectivity/source/inc/dbase/DCatalog.hxx
+++ b/connectivity/source/inc/dbase/DCatalog.hxx
@@ -17,24 +17,22 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCATALOG_HXX
+#pragma once
#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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCATALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DColumns.hxx b/connectivity/source/inc/dbase/DColumns.hxx
index bb84e11fa102..5237ef67b5a7 100644
--- a/connectivity/source/inc/dbase/DColumns.hxx
+++ b/connectivity/source/inc/dbase/DColumns.hxx
@@ -17,30 +17,27 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCOLUMNS_HXX
+#pragma once
#include <file/FColumns.hxx>
namespace connectivity::dbase
+{
+ class ODbaseColumns : public file::OColumns
{
- class ODbaseColumns : public file::OColumns
- {
- protected:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
+ {}
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DConnection.hxx b/connectivity/source/inc/dbase/DConnection.hxx
index fb68d921f60e..26a51efb8e8b 100644
--- a/connectivity/source/inc/dbase/DConnection.hxx
+++ b/connectivity/source/inc/dbase/DConnection.hxx
@@ -17,32 +17,30 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCONNECTION_HXX
+#pragma once
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DCONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx
index 7ec7545903ea..05a7fd8c8614 100644
--- a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx
+++ b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx
@@ -17,43 +17,41 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DDATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DDATABASEMETADATA_HXX
+#pragma once
#include <file/FDatabaseMetaData.hxx>
namespace connectivity::dbase
- {
-
- //************ 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;
+ //************ Class: java.sql.DatabaseMetaDataDate
- 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DDATABASEMETADATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DDriver.hxx b/connectivity/source/inc/dbase/DDriver.hxx
index 99ee297361cd..e832d8ad91eb 100644
--- a/connectivity/source/inc/dbase/DDriver.hxx
+++ b/connectivity/source/inc/dbase/DDriver.hxx
@@ -17,32 +17,30 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DDRIVER_HXX
+#pragma once
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <connectivity/CommonTools.hxx>
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DDRIVER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx
index 3d9e4b7dc923..ca5a7b7e8986 100644
--- a/connectivity/source/inc/dbase/DIndex.hxx
+++ b/connectivity/source/inc/dbase/DIndex.hxx
@@ -17,126 +17,118 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEX_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEX_HXX
+#pragma once
#include <sdbcx/VIndex.hxx>
#include <dbase/DTable.hxx>
#include <dbase/dindexnode.hxx>
-#define dBASE_III_GROUP "dBase III"
+inline constexpr OString dBASE_III_GROUP = "dBase III"_ostr;
namespace connectivity::dbase
+{
+ class OIndexIterator;
+
+ 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, 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(const char* 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;
-
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
- 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, 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
- void ReadHeader(SvStream & rStream, ODbaseIndex::NDXHeader & rHeader);
-}
+ 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;}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEX_HXX
+ 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);
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DIndexColumns.hxx b/connectivity/source/inc/dbase/DIndexColumns.hxx
index bf373d3dc633..0d97cea113f6 100644
--- a/connectivity/source/inc/dbase/DIndexColumns.hxx
+++ b/connectivity/source/inc/dbase/DIndexColumns.hxx
@@ -17,35 +17,33 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXCOLUMNS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <dbase/DIndex.hxx>
#include <dbase/DTable.hxx>
namespace connectivity::dbase
+{
+ class ODbaseIndexColumns : public sdbcx::OCollection
{
- class ODbaseIndexColumns : public sdbcx::OCollection
- {
- ODbaseIndex* m_pIndex;
- protected:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
+ {}
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXCOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DIndexIter.hxx b/connectivity/source/inc/dbase/DIndexIter.hxx
index 0b9323f6b342..353f1081b9db 100644
--- a/connectivity/source/inc/dbase/DIndexIter.hxx
+++ b/connectivity/source/inc/dbase/DIndexIter.hxx
@@ -17,53 +17,51 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXITER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXITER_HXX
+#pragma once
#include <file/fcode.hxx>
#include <dbase/DIndex.hxx>
#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();
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXITER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DIndexes.hxx b/connectivity/source/inc/dbase/DIndexes.hxx
index 76962b2320c4..2f0ca38900e0 100644
--- a/connectivity/source/inc/dbase/DIndexes.hxx
+++ b/connectivity/source/inc/dbase/DIndexes.hxx
@@ -17,36 +17,32 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXES_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <dbase/DTable.hxx>
namespace connectivity::dbase
- {
- class ODbaseTable;
-
- typedef sdbcx::OCollection ODbaseIndexes_BASE;
+{
+ typedef sdbcx::OCollection ODbaseIndexes_BASE;
- class ODbaseIndexes : public ODbaseIndexes_BASE
- {
- ODbaseTable* m_pTable;
- protected:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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)
- {}
-
- };
+ 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)
+ {}
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DPreparedStatement.hxx b/connectivity/source/inc/dbase/DPreparedStatement.hxx
index 7ffa1bfa091e..144da091fc64 100644
--- a/connectivity/source/inc/dbase/DPreparedStatement.hxx
+++ b/connectivity/source/inc/dbase/DPreparedStatement.hxx
@@ -17,25 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DPREPAREDSTATEMENT_HXX
+#pragma once
#include <file/FPreparedStatement.hxx>
namespace connectivity::dbase
+{
+ class ODbasePreparedStatement : public file::OPreparedStatement
{
- class OConnection;
- class ODbasePreparedStatement : public file::OPreparedStatement
- {
- protected:
- virtual 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();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DPREPAREDSTATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DResultSet.hxx b/connectivity/source/inc/dbase/DResultSet.hxx
index 1668a340b32a..4dfbc3317c2c 100644
--- a/connectivity/source/inc/dbase/DResultSet.hxx
+++ b/connectivity/source/inc/dbase/DResultSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DRESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DRESULTSET_HXX
+#pragma once
#include <file/FResultSet.hxx>
#include <com/sun/star/sdbcx/XRowLocate.hpp>
@@ -25,56 +24,55 @@
#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() throw() override;
- virtual void SAL_CALL release() throw() 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;
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DStatement.hxx b/connectivity/source/inc/dbase/DStatement.hxx
index defcf1c769a6..c142a4d6fd78 100644
--- a/connectivity/source/inc/dbase/DStatement.hxx
+++ b/connectivity/source/inc/dbase/DStatement.hxx
@@ -17,25 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DSTATEMENT_HXX
+#pragma once
#include <file/FStatement.hxx>
namespace connectivity::dbase
+{
+ class ODbaseStatement : public file::OStatement
{
- class OConnection;
- class ODbaseStatement : public file::OStatement
- {
- protected:
- virtual 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();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DSTATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx
index 872b4d3d8c1b..ea7d8e8a6626 100644
--- a/connectivity/source/inc/dbase/DTable.hxx
+++ b/connectivity/source/inc/dbase/DTable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DTABLE_HXX
+#pragma once
#include <file/FTable.hxx>
#include <connectivity/CommonTools.hxx>
@@ -26,171 +25,167 @@
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 { return m_aHeader.type > dBaseIV;}
- 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(const char* 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;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
- // 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(const OUString& _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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DTABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DTables.hxx b/connectivity/source/inc/dbase/DTables.hxx
index b22721d798d2..f364a3d9dd83 100644
--- a/connectivity/source/inc/dbase/DTables.hxx
+++ b/connectivity/source/inc/dbase/DTables.hxx
@@ -17,32 +17,30 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DTABLES_HXX
+#pragma once
#include <file/FTables.hxx>
namespace connectivity::dbase
- {
- typedef file::OTables ODbaseTables_BASE;
+{
+ typedef file::OTables ODbaseTables_BASE;
- class ODbaseTables : public ODbaseTables_BASE
- {
- protected:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DTABLES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx
index 2b001de056f6..181c6ff74322 100644
--- a/connectivity/source/inc/dbase/dindexnode.hxx
+++ b/connectivity/source/inc/dbase/dindexnode.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXNODE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXNODE_HXX
+#pragma once
#include <file/fcode.hxx>
#include <connectivity/FValue.hxx>
@@ -29,282 +28,280 @@
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(const ORowSetValue& rVal, 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(ONDXPagePtr aCh);
- void SetParent(ONDXPagePtr aPa);
-
- 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(ONDXPagePtr aPa = ONDXPagePtr())
- {
- aParent = aPa;
- }
-
- inline void ONDXPage::SetChild(ONDXPagePtr aCh = ONDXPagePtr())
- {
- aChild = aCh;
- 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(ONDXPagePtr aCh = 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(ONDXPagePtr aCh, ONDXPage* pParent)
- {
- aChild = aCh;
- 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);
+ }
+
+}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_DBASE_DINDEXNODE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FCatalog.hxx b/connectivity/source/inc/file/FCatalog.hxx
index 89d1ac353136..84d3a36226e3 100644
--- a/connectivity/source/inc/file/FCatalog.hxx
+++ b/connectivity/source/inc/file/FCatalog.hxx
@@ -17,46 +17,44 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCATALOG_HXX
+#pragma once
#include <sdbcx/VCatalog.hxx>
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCATALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FColumns.hxx b/connectivity/source/inc/file/FColumns.hxx
index 76bff286f301..3e45c265af7d 100644
--- a/connectivity/source/inc/file/FColumns.hxx
+++ b/connectivity/source/inc/file/FColumns.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOLUMNS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -26,24 +25,23 @@
#include <file/filedllapi.hxx>
namespace connectivity::file
+{
+ class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OColumns : public sdbcx::OCollection
{
- class OOO_DLLPUBLIC_FILE OColumns : public sdbcx::OCollection
- {
- protected:
- OFileTable* m_pTable;
+ protected:
+ OFileTable* m_pTable;
- virtual sdbcx::ObjectType 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)
+ {}
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx
index 9fbe65dfee47..8a90e43ef4e3 100644
--- a/connectivity/source/inc/file/FConnection.hxx
+++ b/connectivity/source/inc/file/FConnection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCONNECTION_HXX
+#pragma once
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -27,107 +26,108 @@
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#include <TConnection.hxx>
#include <file/filedllapi.hxx>
+#include <unotools/weakref.hxx>
+
+namespace connectivity::sdbcx { class OCatalog; }
namespace connectivity::file
- {
- class ODatabaseMetaData;
- class OFileDriver;
+{
+ 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
-
- css::uno::WeakReference< css::sdbcx::XTablesSupplier> 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 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; }
+ };
+
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FDatabaseMetaData.hxx b/connectivity/source/inc/file/FDatabaseMetaData.hxx
index 238bfe81b2c3..0dcce0f0cb34 100644
--- a/connectivity/source/inc/file/FDatabaseMetaData.hxx
+++ b/connectivity/source/inc/file/FDatabaseMetaData.hxx
@@ -17,172 +17,170 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATABASEMETADATA_HXX
+#pragma once
#include <TDatabaseMetaDataBase.hxx>
#include <file/FConnection.hxx>
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATABASEMETADATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FDateFunctions.hxx b/connectivity/source/inc/file/FDateFunctions.hxx
index 155588438fe2..8451eb0fbf7f 100644
--- a/connectivity/source/inc/file/FDateFunctions.hxx
+++ b/connectivity/source/inc/file/FDateFunctions.hxx
@@ -17,215 +17,212 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATEFUNCTIONS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATEFUNCTIONS_HXX
+#pragma once
#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:
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATEFUNCTIONS_HXX
+ > 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;
+ };
+
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FDriver.hxx b/connectivity/source/inc/file/FDriver.hxx
index 109d0940c7b3..0452b0ab17c8 100644
--- a/connectivity/source/inc/file/FDriver.hxx
+++ b/connectivity/source/inc/file/FDriver.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDRIVER_HXX
+#pragma once
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -26,49 +25,51 @@
#include <cppuhelper/compbase.hxx>
#include <connectivity/CommonTools.hxx>
#include <file/filedllapi.hxx>
+#include <unotools/weakref.hxx>
namespace connectivity::file
- {
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver,
- css::lang::XServiceInfo,
- css::sdbcx::XDataDefinitionSupplier> ODriver_BASE;
+{
+ class OConnection;
+
+ 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;
- connectivity::OWeakRefArray m_xConnections; // vector containing a list
- // of all the Connection objects
- // for this Driver
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- public:
- OFileDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ 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; }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDRIVER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FNumericFunctions.hxx b/connectivity/source/inc/file/FNumericFunctions.hxx
index 3dea7ab98111..8ed560903685 100644
--- a/connectivity/source/inc/file/FNumericFunctions.hxx
+++ b/connectivity/source/inc/file/FNumericFunctions.hxx
@@ -17,349 +17,346 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FNUMERICFUNCTIONS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FNUMERICFUNCTIONS_HXX
+#pragma once
#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:
+
+ > 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:
- */
- 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 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;
+ };
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FNUMERICFUNCTIONS_HXX
+ /** 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;
+ };
+
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FPreparedStatement.hxx b/connectivity/source/inc/file/FPreparedStatement.hxx
index d8e86a3f49cf..822278eb02d2 100644
--- a/connectivity/source/inc/file/FPreparedStatement.hxx
+++ b/connectivity/source/inc/file/FPreparedStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FPREPAREDSTATEMENT_HXX
+#pragma once
#include <file/filedllapi.hxx>
#include <file/FStatement.hxx>
@@ -29,95 +28,97 @@
#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 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;
- css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData;
-
- ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns
-
- // factory method for resultset's
- virtual 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
- };
+ {
+ 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();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FPREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx
index e6c85e0c5cf3..155f64475162 100644
--- a/connectivity/source/inc/file/FResultSet.hxx
+++ b/connectivity/source/inc/file/FResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FRESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FRESULTSET_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -41,266 +40,263 @@
#include <TSortIndex.hxx>
#include <TSkipDeletedSet.hxx>
#include <com/sun/star/lang/XEventListener.hpp>
+#include <o3tl/safeint.hxx>
+#include "FResultSetMetaData.hxx"
namespace connectivity::file
+{
+ 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>
{
- 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,
- css::lang::XUnoTunnel> OResultSet_BASE;
-
- class 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;
- css::uno::Reference< css::sdbc::XResultSetMetaData> 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
- //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(const std::vector<sal_Int32>& _aColumnMapping) { m_aColMapping = _aColumnMapping; }
- void setSqlAnalyzer(OSQLAnalyzer* _pSQLAnalyzer) { m_pSQLAnalyzer = _pSQLAnalyzer; }
-
- void setOrderByColumns(const std::vector<sal_Int32>& _aColumnOrderBy) { m_aOrderbyColumnNumber = _aColumnOrderBy; }
- void setOrderByAscending(const std::vector<TAscendingOrder>& _aOrderbyAsc) { m_aOrderbyAscending = _aOrderbyAsc; }
- void setMetaData(const css::uno::Reference< css::sdbc::XResultSetMetaData>& _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) && (column < static_cast<sal_Int32>(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;
+ }
}
-#endif // _CONNECTIVITY_FILE_ORESULTSET_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FResultSetMetaData.hxx b/connectivity/source/inc/file/FResultSetMetaData.hxx
index ed55d269b82c..a99507803a7f 100644
--- a/connectivity/source/inc/file/FResultSetMetaData.hxx
+++ b/connectivity/source/inc/file/FResultSetMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FRESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FRESULTSETMETADATA_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <cppuhelper/implbase.hxx>
@@ -26,54 +25,53 @@
#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(const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,const 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FRESULTSETMETADATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FStatement.hxx b/connectivity/source/inc/file/FStatement.hxx
index 93063d460794..393d587e2a39 100644
--- a/connectivity/source/inc/file/FStatement.hxx
+++ b/connectivity/source/inc/file/FStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTATEMENT_HXX
+#pragma once
#include <com/sun/star/sdbc/XStatement.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
@@ -37,162 +36,162 @@
#include <comphelper/propertycontainer.hxx>
#include <file/fanalyzer.hxx>
#include <TSortIndex.hxx>
+#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;
- css::uno::WeakReference< css::sdbc::XResultSet> 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 anylizeSQL();
- 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 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() throw() 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() throw() 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 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() throw() override;
- virtual void SAL_CALL release() throw() 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 ;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FStringFunctions.hxx b/connectivity/source/inc/file/FStringFunctions.hxx
index 70dabe3e1d92..a4f622293dc0 100644
--- a/connectivity/source/inc/file/FStringFunctions.hxx
+++ b/connectivity/source/inc/file/FStringFunctions.hxx
@@ -17,256 +17,253 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTRINGFUNCTIONS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTRINGFUNCTIONS_HXX
+#pragma once
#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:
- */
- 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 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'
+
+ */
+ 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;
+ };
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTRINGFUNCTIONS_HXX
+ /** 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;
+ };
+
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx
index 2d3622fd7d78..3c2e0887964e 100644
--- a/connectivity/source/inc/file/FTable.hxx
+++ b/connectivity/source/inc/file/FTable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLE_HXX
+#pragma once
#include <connectivity/sdbcx/VTable.hxx>
#include <file/FConnection.hxx>
@@ -28,78 +27,73 @@
#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(); }
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
-
- 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/FTables.hxx b/connectivity/source/inc/file/FTables.hxx
index 0041c65e3ab6..01c198b0cdac 100644
--- a/connectivity/source/inc/file/FTables.hxx
+++ b/connectivity/source/inc/file/FTables.hxx
@@ -17,30 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLES_HXX
+#pragma once
#include <file/filedllapi.hxx>
#include <connectivity/sdbcx/VCollection.hxx>
#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 sdbcx::ObjectType 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/fanalyzer.hxx b/connectivity/source/inc/file/fanalyzer.hxx
index 6375c71108d3..9d4e12ccffa3 100644
--- a/connectivity/source/inc/file/fanalyzer.hxx
+++ b/connectivity/source/inc/file/fanalyzer.hxx
@@ -17,56 +17,54 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
+#pragma once
#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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx
index 6a6feb412844..541377c7dd5f 100644
--- a/connectivity/source/inc/file/fcode.hxx
+++ b/connectivity/source/inc/file/fcode.hxx
@@ -17,15 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCODE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCODE_HXX
+#pragma once
+#include <config_options.h>
#include <connectivity/sqliterator.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
#include <connectivity/FValue.hxx>
#include <file/filedllapi.hxx>
#include <stack>
+#include <utility>
namespace connectivity
{
@@ -36,7 +37,7 @@ namespace connectivity
class OOperand;
typedef std::stack<OOperand*> OCodeStack;
- class OOO_DLLPUBLIC_FILE OCode
+ class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OCode
{
public:
//virtual dtor to allow this to be the root of the class hierarchy
@@ -97,7 +98,7 @@ namespace connectivity
class OOperandParam : public OOperandRow
{
public:
- OOperandParam(connectivity::OSQLParseNode const * pNode, sal_Int32 _nPos);
+ OOperandParam(sal_Int32 _nPos);
};
// Value operands
@@ -108,9 +109,9 @@ namespace connectivity
protected:
OOperandValue(){}
- OOperandValue(const ORowSetValue& _rVar, sal_Int32 eDbType)
+ OOperandValue(ORowSetValue _aVar, sal_Int32 eDbType)
: OOperand(eDbType)
- , m_aValue(_rVar)
+ , m_aValue(std::move(_aVar))
{}
OOperandValue(sal_Int32 eDbType) :OOperand(eDbType){}
@@ -244,7 +245,7 @@ namespace connectivity
virtual bool operate(const OOperand*, const OOperand*) const override;
};
- class OOO_DLLPUBLIC_FILE OOp_COMPARE : public OBoolOperator
+ class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OOp_COMPARE : public OBoolOperator
{
sal_Int32 aPredicateType;
@@ -328,6 +329,4 @@ namespace connectivity
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCODE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx
index f43b05374b60..5088a5556dcd 100644
--- a/connectivity/source/inc/file/fcomp.hxx
+++ b/connectivity/source/inc/file/fcomp.hxx
@@ -16,18 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOMP_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOMP_HXX
+#pragma once
#include <file/fcode.hxx>
+#include <utility>
namespace connectivity
{
class OSQLParseNode;
namespace file
{
- class OCode;
- class OOperand;
class OSQLAnalyzer;
typedef std::vector<std::unique_ptr<OCode>> OCodeList;
@@ -87,7 +85,7 @@ namespace connectivity
::rtl::Reference<OPredicateCompiler> m_rCompiler;
public:
- OPredicateInterpreter(const ::rtl::Reference<OPredicateCompiler>& rComp) : m_rCompiler(rComp){}
+ OPredicateInterpreter(::rtl::Reference<OPredicateCompiler> xComp) : m_rCompiler(std::move(xComp)){}
virtual ~OPredicateInterpreter() override;
bool evaluate(OCodeList& rCodeList);
@@ -107,6 +105,5 @@ namespace connectivity
};
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOMP_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/filedllapi.hxx b/connectivity/source/inc/file/filedllapi.hxx
index 7bc8ed0ce0e7..e32f5f17cb05 100644
--- a/connectivity/source/inc/file/filedllapi.hxx
+++ b/connectivity/source/inc/file/filedllapi.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FILEDLLAPI_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FILEDLLAPI_HXX
+#pragma once
#include <sal/config.h>
@@ -30,6 +29,4 @@
#define OOO_DLLPUBLIC_FILE SAL_DLLPUBLIC_IMPORT
#endif
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/file/quotedstring.hxx b/connectivity/source/inc/file/quotedstring.hxx
index 8d80d15f0319..7c6becc37feb 100644
--- a/connectivity/source/inc/file/quotedstring.hxx
+++ b/connectivity/source/inc/file/quotedstring.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_QUOTEDSTRING_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_QUOTEDSTRING_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <file/filedllapi.hxx>
@@ -44,6 +43,4 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_QUOTEDSTRING_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/ECatalog.hxx b/connectivity/source/inc/flat/ECatalog.hxx
index 2998f26defef..8c7ba7b1ee13 100644
--- a/connectivity/source/inc/flat/ECatalog.hxx
+++ b/connectivity/source/inc/flat/ECatalog.hxx
@@ -17,24 +17,22 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECATALOG_HXX
+#pragma once
#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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECATALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EColumns.hxx b/connectivity/source/inc/flat/EColumns.hxx
index 88cf069bfa85..9a4b9d3df672 100644
--- a/connectivity/source/inc/flat/EColumns.hxx
+++ b/connectivity/source/inc/flat/EColumns.hxx
@@ -17,27 +17,25 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECOLUMNS_HXX
+#pragma once
#include <file/FColumns.hxx>
namespace connectivity::flat
+{
+ class OFlatColumns : public file::OColumns
{
- class OFlatColumns : public file::OColumns
- {
- protected:
- virtual sdbcx::ObjectType 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)
+ {}
- };
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EConnection.hxx b/connectivity/source/inc/flat/EConnection.hxx
index d6d179362684..cc57b9e0f5eb 100644
--- a/connectivity/source/inc/flat/EConnection.hxx
+++ b/connectivity/source/inc/flat/EConnection.hxx
@@ -17,48 +17,46 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECONNECTION_HXX
+#pragma once
#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;
+ };
}
-#endif // _CONNECTIVITY_FLAT_DCONNECTION_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EDatabaseMetaData.hxx b/connectivity/source/inc/flat/EDatabaseMetaData.hxx
index 73793a71d1f9..e187892a7b89 100644
--- a/connectivity/source/inc/flat/EDatabaseMetaData.hxx
+++ b/connectivity/source/inc/flat/EDatabaseMetaData.hxx
@@ -17,30 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDATABASEMETADATA_HXX
+#pragma once
#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);
+ 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;
- };
+ 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;
+ };
}
-#endif // _CONNECTIVITY_FLAT_ODATABASEMETADATA_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EDriver.hxx b/connectivity/source/inc/flat/EDriver.hxx
index b64b52c5e35d..d46046716683 100644
--- a/connectivity/source/inc/flat/EDriver.hxx
+++ b/connectivity/source/inc/flat/EDriver.hxx
@@ -17,31 +17,29 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDRIVER_HXX
+#pragma once
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <connectivity/CommonTools.hxx>
#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;
+ };
}
-#endif //_CONNECTIVITY_FLAT_DDRIVER_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EPreparedStatement.hxx b/connectivity/source/inc/flat/EPreparedStatement.hxx
index 216051d168a9..02e78124476e 100644
--- a/connectivity/source/inc/flat/EPreparedStatement.hxx
+++ b/connectivity/source/inc/flat/EPreparedStatement.hxx
@@ -17,25 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EPREPAREDSTATEMENT_HXX
+#pragma once
#include <file/FPreparedStatement.hxx>
namespace connectivity::flat
+{
+ class OFlatPreparedStatement : public file::OPreparedStatement
{
- class OConnection;
- class OFlatPreparedStatement : public file::OPreparedStatement
- {
- protected:
- virtual 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();
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EPREPAREDSTATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EResultSet.hxx b/connectivity/source/inc/flat/EResultSet.hxx
index 3f38dfc054e1..ca2a5ab61349 100644
--- a/connectivity/source/inc/flat/EResultSet.hxx
+++ b/connectivity/source/inc/flat/EResultSet.hxx
@@ -17,56 +17,54 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ERESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ERESULTSET_HXX
+#pragma once
#include <file/FResultSet.hxx>
#include <com/sun/star/sdbcx/XRowLocate.hpp>
#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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ };
}
-#endif //_CONNECTIVITY_FLAT_DRESULTSET_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EStatement.hxx b/connectivity/source/inc/flat/EStatement.hxx
index add447e5dabc..fe1761d95c3a 100644
--- a/connectivity/source/inc/flat/EStatement.hxx
+++ b/connectivity/source/inc/flat/EStatement.hxx
@@ -17,25 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ESTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ESTATEMENT_HXX
+#pragma once
#include <file/FStatement.hxx>
namespace connectivity::flat
+{
+ class OFlatStatement : public file::OStatement
{
- class OConnection;
- class OFlatStatement : public file::OStatement
- {
- protected:
- virtual 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();
+ };
}
-#endif //_CONNECTIVITY_FLAT_DSTATEMENT_HXX_
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
index eeec70199f6e..3d82e0e31cd7 100644
--- a/connectivity/source/inc/flat/ETable.hxx
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
+#pragma once
#include <file/FTable.hxx>
#include <flat/EConnection.hxx>
@@ -28,79 +27,73 @@
#include <com/sun/star/util/XNumberFormatter.hpp>
namespace connectivity::flat
- {
- typedef file::OFileTable OFlatTable_BASE;
- class OFlatConnection;
+{
+ typedef file::OFileTable OFlatTable_BASE;
- 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;
-
- 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()
- );
+ return pConnection;
+ }
+ public:
+ virtual void refreshColumns() override;
- void construct() override; // can throw any exception
+ 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()
+ );
- 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;
+ void construct() override; // can throw any exception
- 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 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;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/ETables.hxx b/connectivity/source/inc/flat/ETables.hxx
index 4a00c5133eaf..6d198a9b021c 100644
--- a/connectivity/source/inc/flat/ETables.hxx
+++ b/connectivity/source/inc/flat/ETables.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLES_HXX
+#pragma once
#include <file/FTables.hxx>
@@ -29,7 +28,7 @@ namespace connectivity::flat
class OFlatTables : public OFlatTables_BASE
{
protected:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createObject(const OUString& _rName) override;
public:
OFlatTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::std::vector< OUString> &_rVector) : OFlatTables_BASE(_rMetaData,_rParent,_rMutex,_rVector)
@@ -37,6 +36,5 @@ namespace connectivity::flat
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HCatalog.hxx b/connectivity/source/inc/hsqldb/HCatalog.hxx
index b7cce48fee9e..efd397e3da43 100644
--- a/connectivity/source/inc/hsqldb/HCatalog.hxx
+++ b/connectivity/source/inc/hsqldb/HCatalog.hxx
@@ -16,47 +16,45 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCATALOG_HXX
+#pragma once
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCATALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HColumns.hxx b/connectivity/source/inc/hsqldb/HColumns.hxx
index 111a0c3aa81c..2dd8881d04d1 100644
--- a/connectivity/source/inc/hsqldb/HColumns.hxx
+++ b/connectivity/source/inc/hsqldb/HColumns.hxx
@@ -16,43 +16,41 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCOLUMNS_HXX
+#pragma once
#include <connectivity/TColumnsHelper.hxx>
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HConnection.hxx b/connectivity/source/inc/hsqldb/HConnection.hxx
index 78bcfe26eaf1..29763b433ccf 100644
--- a/connectivity/source/inc/hsqldb/HConnection.hxx
+++ b/connectivity/source/inc/hsqldb/HConnection.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
+#pragma once
#include <connectivity/ConnectionWrapper.hxx>
#include <com/sun/star/util/XFlushable.hpp>
@@ -30,115 +29,111 @@
#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::WeakComponentImplHelper< 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 cppu::BaseMutex
- ,public OHsqlConnection_BASE
- ,public OConnectionWrapper
- ,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();
- DECLARE_XTYPEPROVIDER()
- DECLARE_XINTERFACE( )
-
- // 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();
+ }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx
index 9727d38cb3b0..7b4735517fd5 100644
--- a/connectivity/source/inc/hsqldb/HDriver.hxx
+++ b/connectivity/source/inc/hsqldb/HDriver.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HDRIVER_HXX
+#pragma once
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
@@ -28,99 +27,102 @@
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <connectivity/CommonTools.hxx>
+#include <unotools/weakref.hxx>
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
{
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver
- , css::sdbcx::XDataDefinitionSupplier
- , css::lang::XServiceInfo
- , css::sdbcx::XCreateCatalog
- , css::embed::XTransactionListener
- > ODriverDelegator_BASE;
+ css::uno::WeakReference<css::sdbc::XConnection> xOrigConn;
+ OUString sKey;
+ css::uno::WeakReference<css::sdbc::XConnection> xConn;
+ unotools::WeakReference<OHCatalog> xCatalog;
+ };
- typedef std::pair< css::uno::WeakReferenceHelper,css::uno::WeakReferenceHelper> TWeakRefPair;
- typedef std::pair< OUString ,TWeakRefPair > TWeakConnectionPair;
- typedef std::pair< css::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair;
- typedef std::vector< TWeakPair > TWeakPairVector;
+ /** 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
- {
- TWeakPairVector 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 TWeakPairVector::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
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HDRIVER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HStorageAccess.hxx b/connectivity/source/inc/hsqldb/HStorageAccess.hxx
index feab18e412c6..3644ccb48be8 100644
--- a/connectivity/source/inc/hsqldb/HStorageAccess.hxx
+++ b/connectivity/source/inc/hsqldb/HStorageAccess.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEACCESS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEACCESS_HXX
+#pragma once
#include <sal/config.h>
@@ -31,16 +30,9 @@
#pragma clang diagnostic pop
#endif
-namespace connectivity::hsqldb
-{
- class DataLogFile;
-}
-
jint read_from_storage_stream( JNIEnv * env, jstring name, jstring key );
jint read_from_storage_stream_into_buffer( JNIEnv * env, jstring name, jstring key, jbyteArray buffer, jint off, jint len );
void write_to_storage_stream_from_buffer( JNIEnv* env, jstring name, jstring key, jbyteArray buffer, jint off, jint len );
void write_to_storage_stream( JNIEnv* env, jstring name, jstring key, jint v );
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEACCESS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx
index 15aecc02cfe4..f0ec7d87e264 100644
--- a/connectivity/source/inc/hsqldb/HStorageMap.hxx
+++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
+#pragma once
#include <sal/config.h>
@@ -43,58 +42,56 @@
#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(const OUString& _sURL,const OUString& _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
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx
index ff947cbf484c..4b29ea0b5a7f 100644
--- a/connectivity/source/inc/hsqldb/HTable.hxx
+++ b/connectivity/source/inc/hsqldb/HTable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
+#pragma once
#include <sal/config.h>
@@ -28,90 +27,86 @@
#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;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
- 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);
+
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HTables.hxx b/connectivity/source/inc/hsqldb/HTables.hxx
index fea00f37f095..cd255f08ed71 100644
--- a/connectivity/source/inc/hsqldb/HTables.hxx
+++ b/connectivity/source/inc/hsqldb/HTables.hxx
@@ -16,39 +16,38 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLES_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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 sdbcx::ObjectType& _xObject) 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, true, _rMutex, _rVector)
- ,m_xMetaData(_rMetaData)
- {}
+ 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HTools.hxx b/connectivity/source/inc/hsqldb/HTools.hxx
index be30e8e281ee..a847b2d9a589 100644
--- a/connectivity/source/inc/hsqldb/HTools.hxx
+++ b/connectivity/source/inc/hsqldb/HTools.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTOOLS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTOOLS_HXX
+#pragma once
#include <rtl/ustrbuf.hxx>
@@ -37,8 +36,8 @@ namespace connectivity::hsqldb
have the short form (TABLE_CAT instead of TABLE_CATALOG, and so on)
*/
static void appendTableFilterCrit(
- OUStringBuffer& _inout_rBuffer, const OUString& _rCatalog,
- const OUString& _rSchema, const OUString& _rName,
+ OUStringBuffer& _inout_rBuffer, std::u16string_view _rCatalog,
+ std::u16string_view _rSchema, std::u16string_view _rName,
bool _bShortForm
);
};
@@ -47,6 +46,4 @@ namespace connectivity::hsqldb
} // namespace connectivity::hsqldb
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTOOLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HUser.hxx b/connectivity/source/inc/hsqldb/HUser.hxx
index 935209b1a669..feb3daf284c6 100644
--- a/connectivity/source/inc/hsqldb/HUser.hxx
+++ b/connectivity/source/inc/hsqldb/HUser.hxx
@@ -17,59 +17,57 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSER_HXX
+#pragma once
#include <sdbcx/VUser.hxx>
#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( const css::uno::Reference< css::sdbc::XConnection >& _xConnection);
- OHSQLUser( const 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HUsers.hxx b/connectivity/source/inc/hsqldb/HUsers.hxx
index 392b3412a39b..2bddc4da776f 100644
--- a/connectivity/source/inc/hsqldb/HUsers.hxx
+++ b/connectivity/source/inc/hsqldb/HUsers.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSERS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSERS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -35,21 +34,19 @@ namespace connectivity
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
connectivity::sdbcx::IRefreshableUsers* m_pParent;
public:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ 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 sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) 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( ::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const ::std::vector< OUString> &_rVector,
- const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ css::uno::Reference< css::sdbc::XConnection > _xConnection,
connectivity::sdbcx::IRefreshableUsers* _pParent);
};
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSERS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HView.hxx b/connectivity/source/inc/hsqldb/HView.hxx
index 3e158c753d1b..62e8e5f4568a 100644
--- a/connectivity/source/inc/hsqldb/HView.hxx
+++ b/connectivity/source/inc/hsqldb/HView.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEW_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEW_HXX
+#pragma once
#include <connectivity/sdbcx/VView.hxx>
@@ -86,6 +85,4 @@ namespace connectivity::hsqldb
} // namespace connectivity::hsqldb
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HViews.hxx b/connectivity/source/inc/hsqldb/HViews.hxx
index 05357324969c..e1f035dbcf8b 100644
--- a/connectivity/source/inc/hsqldb/HViews.hxx
+++ b/connectivity/source/inc/hsqldb/HViews.hxx
@@ -16,38 +16,36 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEWS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEWS_HXX
+#pragma once
#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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEWS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/ContextClassLoader.hxx b/connectivity/source/inc/java/ContextClassLoader.hxx
index dea3fb58b50a..e7079239aa05 100644
--- a/connectivity/source/inc/java/ContextClassLoader.hxx
+++ b/connectivity/source/inc/java/ContextClassLoader.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_CONTEXTCLASSLOADER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_CONTEXTCLASSLOADER_HXX
+#pragma once
#include <java/GlobalRef.hxx>
@@ -77,6 +76,4 @@ namespace connectivity::jdbc
} // namespace connectivity::jdbc
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_CONTEXTCLASSLOADER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/GlobalRef.hxx b/connectivity/source/inc/java/GlobalRef.hxx
index 80888cb48810..1a97bfb33a45 100644
--- a/connectivity/source/inc/java/GlobalRef.hxx
+++ b/connectivity/source/inc/java/GlobalRef.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_GLOBALREF_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_GLOBALREF_HXX
+#pragma once
#include <java/LocalRef.hxx>
#include <java/lang/Object.hxx>
@@ -100,6 +99,4 @@ namespace connectivity::jdbc
} // namespace connectivity::jdbc
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_GLOBALREF_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/LocalRef.hxx b/connectivity/source/inc/java/LocalRef.hxx
index dc9531507ee2..ad40737f8620 100644
--- a/connectivity/source/inc/java/LocalRef.hxx
+++ b/connectivity/source/inc/java/LocalRef.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LOCALREF_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LOCALREF_HXX
+#pragma once
#if defined __clang__
#pragma clang diagnostic push
@@ -93,6 +92,4 @@ namespace connectivity::jdbc
} // namespace connectivity::jdbc
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LOCALREF_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/io/InputStream.hxx b/connectivity/source/inc/java/io/InputStream.hxx
index c05309e87c1b..4a0b5788f19b 100644
--- a/connectivity/source/inc/java/io/InputStream.hxx
+++ b/connectivity/source/inc/java/io/InputStream.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_IO_INPUTSTREAM_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_IO_INPUTSTREAM_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <cppuhelper/implbase.hxx>
@@ -48,6 +47,5 @@ namespace connectivity
virtual void SAL_CALL closeInput( ) override;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_IO_INPUTSTREAM_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/io/Reader.hxx b/connectivity/source/inc/java/io/Reader.hxx
index 7a2cf0524483..8386eda449e3 100644
--- a/connectivity/source/inc/java/io/Reader.hxx
+++ b/connectivity/source/inc/java/io/Reader.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_IO_READER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_IO_READER_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <cppuhelper/implbase.hxx>
@@ -49,6 +48,5 @@ namespace connectivity
virtual void SAL_CALL closeInput( ) override;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_IO_READER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx
index 27a7e06685c2..536ba5de316b 100644
--- a/connectivity/source/inc/java/lang/Boolean.hxx
+++ b/connectivity/source/inc/java/lang/Boolean.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_BOOLEAN_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_BOOLEAN_HXX
+#pragma once
#include <java/lang/Object.hxx>
@@ -40,7 +39,5 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_BOOLEAN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/lang/Class.hxx b/connectivity/source/inc/java/lang/Class.hxx
index bdf8e2742472..bcd5628c1d87 100644
--- a/connectivity/source/inc/java/lang/Class.hxx
+++ b/connectivity/source/inc/java/lang/Class.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_CLASS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_CLASS_HXX
+#pragma once
//************ Class: java.lang.Class
@@ -47,6 +46,4 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_CLASS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/lang/Exception.hxx b/connectivity/source/inc/java/lang/Exception.hxx
index 5e11e7890be7..28b2d56dc90a 100644
--- a/connectivity/source/inc/java/lang/Exception.hxx
+++ b/connectivity/source/inc/java/lang/Exception.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_EXCEPTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_EXCEPTION_HXX
+#pragma once
#include <java/lang/Throwable.hxx>
@@ -39,6 +38,5 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_EXCEPTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx
index ba9414008163..63d7af3f5976 100644
--- a/connectivity/source/inc/java/lang/Object.hxx
+++ b/connectivity/source/inc/java/lang/Object.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_OBJECT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_OBJECT_HXX
+#pragma once
#include <com/sun/star/uno/XComponentContext.hpp>
#include <jvmaccess/virtualmachine.hxx>
@@ -143,7 +142,6 @@ namespace connectivity
};
}
-#endif //_CONNECTIVITY_JAVA_LANG_OBJECT_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/lang/String.hxx b/connectivity/source/inc/java/lang/String.hxx
index 25ba03d0da4c..2783b6eeb9bf 100644
--- a/connectivity/source/inc/java/lang/String.hxx
+++ b/connectivity/source/inc/java/lang/String.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_STRING_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_STRING_HXX
+#pragma once
#include <java/lang/Object.hxx>
@@ -41,6 +40,4 @@ namespace connectivity
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_STRING_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/lang/Throwable.hxx b/connectivity/source/inc/java/lang/Throwable.hxx
index d24395286116..65cfc24fe73d 100644
--- a/connectivity/source/inc/java/lang/Throwable.hxx
+++ b/connectivity/source/inc/java/lang/Throwable.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_THROWABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_THROWABLE_HXX
+#pragma once
#include <java/lang/Object.hxx>
@@ -46,6 +45,5 @@ namespace connectivity
static jclass st_getMyClass();
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_LANG_THROWABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/math/BigDecimal.hxx b/connectivity/source/inc/java/math/BigDecimal.hxx
index e345aeed250d..f4fb684b87ac 100644
--- a/connectivity/source/inc/java/math/BigDecimal.hxx
+++ b/connectivity/source/inc/java/math/BigDecimal.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_MATH_BIGDECIMAL_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_MATH_BIGDECIMAL_HXX
+#pragma once
#include <java/lang/Object.hxx>
@@ -38,7 +37,5 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_MATH_BIGDECIMAL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/Array.hxx b/connectivity/source/inc/java/sql/Array.hxx
index 8677daa47763..93cce6938661 100644
--- a/connectivity/source/inc/java/sql/Array.hxx
+++ b/connectivity/source/inc/java/sql/Array.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_ARRAY_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_ARRAY_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <com/sun/star/sdbc/XArray.hpp>
@@ -51,6 +50,5 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_ARRAY_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/Blob.hxx b/connectivity/source/inc/java/sql/Blob.hxx
index 605853f60e6a..02ac0df13401 100644
--- a/connectivity/source/inc/java/sql/Blob.hxx
+++ b/connectivity/source/inc/java/sql/Blob.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_BLOB_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_BLOB_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <com/sun/star/sdbc/XBlob.hpp>
@@ -51,6 +50,5 @@ namespace connectivity
virtual sal_Int64 SAL_CALL positionOfBlob( const css::uno::Reference< css::sdbc::XBlob >& pattern, sal_Int64 start ) override;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_BLOB_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/CallableStatement.hxx b/connectivity/source/inc/java/sql/CallableStatement.hxx
index df9aa389c64f..7391837741ef 100644
--- a/connectivity/source/inc/java/sql/CallableStatement.hxx
+++ b/connectivity/source/inc/java/sql/CallableStatement.hxx
@@ -47,8 +47,8 @@ namespace connectivity
java_sql_CallableStatement( JNIEnv * pEnv, java_sql_Connection& _rCon, const OUString& sql );
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() 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;
diff --git a/connectivity/source/inc/java/sql/Clob.hxx b/connectivity/source/inc/java/sql/Clob.hxx
index ecea073fa1f2..67a69bb6db17 100644
--- a/connectivity/source/inc/java/sql/Clob.hxx
+++ b/connectivity/source/inc/java/sql/Clob.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CLOB_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CLOB_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <com/sun/star/sdbc/XClob.hpp>
@@ -51,6 +50,5 @@ namespace connectivity
virtual sal_Int64 SAL_CALL positionOfClob( const css::uno::Reference< css::sdbc::XClob >& pattern, sal_Int64 start ) override;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CLOB_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/Connection.hxx b/connectivity/source/inc/java/sql/Connection.hxx
index cc453e6e87ca..444d44df51e7 100644
--- a/connectivity/source/inc/java/sql/Connection.hxx
+++ b/connectivity/source/inc/java/sql/Connection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTION_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <TConnection.hxx>
@@ -132,6 +131,5 @@ namespace connectivity
virtual void SAL_CALL clearWarnings( ) override;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/ConnectionLog.hxx b/connectivity/source/inc/java/sql/ConnectionLog.hxx
index 780b7f27eb2c..cea19cdff0ac 100644
--- a/connectivity/source/inc/java/sql/ConnectionLog.hxx
+++ b/connectivity/source/inc/java/sql/ConnectionLog.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTIONLOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTIONLOG_HXX
+#pragma once
#include <com/sun/star/logging/LogLevel.hpp>
@@ -125,6 +124,4 @@ namespace connectivity::java::sql {
} // namespace connectivity::java::sql
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTIONLOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/DatabaseMetaData.hxx b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx
index d87cd6c21849..eb43f2537aef 100644
--- a/connectivity/source/inc/java/sql/DatabaseMetaData.hxx
+++ b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_DATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_DATABASEMETADATA_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <TDatabaseMetaDataBase.hxx>
@@ -213,6 +212,5 @@ namespace connectivity
const OUString* _pOptionalAdditionalString = nullptr);
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_DATABASEMETADATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/Driver.hxx b/connectivity/source/inc/java/sql/Driver.hxx
index 2fd49b252bdc..805df2ed12ee 100644
--- a/connectivity/source/inc/java/sql/Driver.hxx
+++ b/connectivity/source/inc/java/sql/Driver.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_DRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_DRIVER_HXX
+#pragma once
#include <com/sun/star/sdbc/XDriver.hpp>
#include <cppuhelper/implbase.hxx>
@@ -56,6 +55,5 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_DRIVER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/JStatement.hxx b/connectivity/source/inc/java/sql/JStatement.hxx
index 62cbe81547d2..89a091bd96a7 100644
--- a/connectivity/source/inc/java/sql/JStatement.hxx
+++ b/connectivity/source/inc/java/sql/JStatement.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_JSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_JSTATEMENT_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <com/sun/star/sdbc/XStatement.hpp>
@@ -163,8 +162,8 @@ namespace connectivity
// OComponentHelper
virtual void SAL_CALL disposing() override;
// XInterface
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() 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;
//XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -223,14 +222,13 @@ namespace connectivity
java_sql_Statement( JNIEnv * pEnv, java_sql_Connection& _rCon ) : OStatement_BASE2( pEnv, _rCon){};
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() 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;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_JSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/PreparedStatement.hxx b/connectivity/source/inc/java/sql/PreparedStatement.hxx
index 8920c88e9404..711fd2d00661 100644
--- a/connectivity/source/inc/java/sql/PreparedStatement.hxx
+++ b/connectivity/source/inc/java/sql/PreparedStatement.hxx
@@ -52,8 +52,8 @@ namespace connectivity
java_sql_PreparedStatement( JNIEnv * pEnv, java_sql_Connection& _rCon,const OUString& sql );
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() 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;
diff --git a/connectivity/source/inc/java/sql/Ref.hxx b/connectivity/source/inc/java/sql/Ref.hxx
index eb658925fd92..f127178b277d 100644
--- a/connectivity/source/inc/java/sql/Ref.hxx
+++ b/connectivity/source/inc/java/sql/Ref.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_REF_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_REF_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <com/sun/star/sdbc/XRef.hpp>
@@ -46,6 +45,5 @@ namespace connectivity
virtual OUString SAL_CALL getBaseTypeName( ) override;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_REF_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/ResultSet.hxx b/connectivity/source/inc/java/sql/ResultSet.hxx
index e5e0155ff3e9..2b4190ba956e 100644
--- a/connectivity/source/inc/java/sql/ResultSet.hxx
+++ b/connectivity/source/inc/java/sql/ResultSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_RESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_RESULTSET_HXX
+#pragma once
#include <java/lang/Object.hxx>
#include <com/sun/star/sdbc/XResultSet.hpp>
@@ -60,7 +59,7 @@ namespace connectivity
public ::cppu::OPropertySetHelper,
public ::comphelper::OPropertyArrayUsageHelper<java_sql_ResultSet>
{
- css::uno::Reference< css::uno::XInterface> m_xStatement;
+ rtl::Reference<java_sql_Statement_Base> m_xStatement;
java::sql::ConnectionLog m_aLogger;
java_sql_Connection* m_pConnection;
@@ -120,8 +119,8 @@ namespace connectivity
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() throw() override;
- virtual void SAL_CALL release() throw() 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
@@ -207,6 +206,5 @@ namespace connectivity
using ::cppu::OPropertySetHelper::getFastPropertyValue;
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_RESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/SQLException.hxx b/connectivity/source/inc/java/sql/SQLException.hxx
index 88a147faaebe..cff1aad4662d 100644
--- a/connectivity/source/inc/java/sql/SQLException.hxx
+++ b/connectivity/source/inc/java/sql/SQLException.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_SQLEXCEPTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_SQLEXCEPTION_HXX
+#pragma once
#include <java/lang/Exception.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
@@ -53,6 +52,5 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_SQLEXCEPTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/SQLWarning.hxx b/connectivity/source/inc/java/sql/SQLWarning.hxx
index 68a83f4635be..5fd8c979430d 100644
--- a/connectivity/source/inc/java/sql/SQLWarning.hxx
+++ b/connectivity/source/inc/java/sql/SQLWarning.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_SQLWARNING_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_SQLWARNING_HXX
+#pragma once
#include <java/sql/SQLException.hxx>
@@ -46,6 +45,5 @@ namespace connectivity
: java_sql_SQLException(_rW,_rContext) {}
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_SQLWARNING_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/sql/Timestamp.hxx b/connectivity/source/inc/java/sql/Timestamp.hxx
index 0d41d46d69c5..599dfb78e4dd 100644
--- a/connectivity/source/inc/java/sql/Timestamp.hxx
+++ b/connectivity/source/inc/java/sql/Timestamp.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_TIMESTAMP_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_TIMESTAMP_HXX
+#pragma once
#include <java/util/Date.hxx>
#include <com/sun/star/util/Date.hpp>
@@ -85,6 +84,5 @@ namespace connectivity
static jclass st_getMyClass();
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_TIMESTAMP_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/tools.hxx b/connectivity/source/inc/java/tools.hxx
index e17fa9c42ebb..44a35ecee3f9 100644
--- a/connectivity/source/inc/java/tools.hxx
+++ b/connectivity/source/inc/java/tools.hxx
@@ -17,8 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_TOOLS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_TOOLS_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Sequence.h>
@@ -60,6 +63,4 @@ namespace connectivity
jobject createCharArrayReader(const css::uno::Reference< css::io::XInputStream >& x,sal_Int32 length);
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_TOOLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/util/Date.hxx b/connectivity/source/inc/java/util/Date.hxx
index 9c2e8a3ee76a..fe552428675f 100644
--- a/connectivity/source/inc/java/util/Date.hxx
+++ b/connectivity/source/inc/java/util/Date.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_UTIL_DATE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_UTIL_DATE_HXX
+#pragma once
#include <java/lang/Object.hxx>
//#include <com/sun/star/util/Date.hpp>
@@ -42,6 +41,5 @@ namespace connectivity
java_util_Date( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){}
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_UTIL_DATE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/util/Property.hxx b/connectivity/source/inc/java/util/Property.hxx
index f7835e5f1d8d..628f951ba4d8 100644
--- a/connectivity/source/inc/java/util/Property.hxx
+++ b/connectivity/source/inc/java/util/Property.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_UTIL_PROPERTY_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_UTIL_PROPERTY_HXX
+#pragma once
#include <java/lang/Object.hxx>
@@ -36,6 +35,4 @@ namespace connectivity
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_UTIL_PROPERTY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YCatalog.hxx b/connectivity/source/inc/mysql/YCatalog.hxx
index df23bb3f07b6..f8d6156f480a 100644
--- a/connectivity/source/inc/mysql/YCatalog.hxx
+++ b/connectivity/source/inc/mysql/YCatalog.hxx
@@ -16,47 +16,45 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YCATALOG_HXX
+#pragma once
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YCATALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YColumns.hxx b/connectivity/source/inc/mysql/YColumns.hxx
index 00a68f1c3134..88102c2fb864 100644
--- a/connectivity/source/inc/mysql/YColumns.hxx
+++ b/connectivity/source/inc/mysql/YColumns.hxx
@@ -16,43 +16,41 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YCOLUMNS_HXX
+#pragma once
#include <connectivity/TColumnsHelper.hxx>
#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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YCOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YDriver.hxx b/connectivity/source/inc/mysql/YDriver.hxx
index 545e9dde05fa..a03906b8dcff 100644
--- a/connectivity/source/inc/mysql/YDriver.hxx
+++ b/connectivity/source/inc/mysql/YDriver.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YDRIVER_HXX
+#pragma once
#include <sal/config.h>
@@ -30,6 +29,7 @@
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <connectivity/CommonTools.hxx>
+#include <unotools/weakref.hxx>
namespace connectivity
@@ -40,14 +40,19 @@ namespace connectivity
namespace mysql
{
+ class OMySQLCatalog;
+
typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver
, css::sdbcx::XDataDefinitionSupplier
, css::lang::XServiceInfo
> ODriverDelegator_BASE;
- typedef std::pair< css::uno::WeakReferenceHelper,OMetaConnection*> TWeakConnectionPair;
- typedef std::pair< css::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair;
- typedef std::vector< TWeakPair > TWeakPairVector;
+ struct TConnectionInfo
+ {
+ css::uno::WeakReference<css::sdbc::XConnection> xConn;
+ unotools::WeakReference<OMySQLCatalog> xCatalog;
+ OMetaConnection* pMetaConn;
+ };
typedef std::map< OUString, css::uno::Reference< css::sdbc::XDriver > > TJDBCDrivers;
/** delegates all calls to the original driver and extend the existing one with the SDBCX layer.
@@ -57,7 +62,7 @@ namespace connectivity
,public ODriverDelegator_BASE
{
TJDBCDrivers m_aJdbcDrivers; // all jdbc drivers
- TWeakPairVector m_aConnections; // vector containing a list
+ std::vector<TConnectionInfo> m_aConnections; // vector containing a list
// of all the Connection objects
// for this Driver
css::uno::Reference< css::sdbc::XDriver > m_xODBCDriver;
@@ -73,7 +78,7 @@ namespace connectivity
@return
The driver which was currently selected.
*/
- css::uno::Reference< css::sdbc::XDriver > loadDriver( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info );
+ css::uno::Reference< css::sdbc::XDriver > loadDriver( std::u16string_view url, const css::uno::Sequence< css::beans::PropertyValue >& info );
public:
/** creates a new delegator for a mysql driver
@@ -104,6 +109,4 @@ namespace connectivity
} // namespace connectivity
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YDRIVER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YTable.hxx b/connectivity/source/inc/mysql/YTable.hxx
index 7df10ead2af3..7e01a085423f 100644
--- a/connectivity/source/inc/mysql/YTable.hxx
+++ b/connectivity/source/inc/mysql/YTable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLE_HXX
+#pragma once
#include <sal/config.h>
@@ -28,90 +27,86 @@
#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;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
- // 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx
index 5754c0085bad..8aaa5c8d80bb 100644
--- a/connectivity/source/inc/mysql/YTables.hxx
+++ b/connectivity/source/inc/mysql/YTables.hxx
@@ -16,49 +16,48 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLES_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <SQLStatementHelper.hxx>
#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;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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 sdbcx::ObjectType& _xObject) 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, true, _rMutex, _rVector)
- ,m_xMetaData(_rMetaData)
- {}
+ 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);
- /** convert the sql statement to fit MySQL notation
- @param _sSql in/out
- */
- static OUString adjustSQL(const OUString& _sSql);
+ /** 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;
- };
+ // ISQLStatementHelper
+ virtual void addComment(const css::uno::Reference< css::beans::XPropertySet >& descriptor,OUStringBuffer& _rOut) override;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YUser.hxx b/connectivity/source/inc/mysql/YUser.hxx
index bf4bce0dfc04..739cf6f75e0a 100644
--- a/connectivity/source/inc/mysql/YUser.hxx
+++ b/connectivity/source/inc/mysql/YUser.hxx
@@ -17,59 +17,57 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YUSER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YUSER_HXX
+#pragma once
#include <sdbcx/VUser.hxx>
#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( const css::uno::Reference< css::sdbc::XConnection >& _xConnection);
- OMySQLUser( const 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YUSER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YUsers.hxx b/connectivity/source/inc/mysql/YUsers.hxx
index 69695ca642b6..6bb552f7e25e 100644
--- a/connectivity/source/inc/mysql/YUsers.hxx
+++ b/connectivity/source/inc/mysql/YUsers.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YUSERS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YUSERS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -35,21 +34,19 @@ namespace connectivity
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
connectivity::sdbcx::IRefreshableUsers* m_pParent;
public:
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ 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 sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) 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( ::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const ::std::vector< OUString> &_rVector,
- const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ css::uno::Reference< css::sdbc::XConnection > _xConnection,
connectivity::sdbcx::IRefreshableUsers* _pParent);
};
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YUSERS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/mysql/YViews.hxx b/connectivity/source/inc/mysql/YViews.hxx
index d12744662322..551b1358dd2d 100644
--- a/connectivity/source/inc/mysql/YViews.hxx
+++ b/connectivity/source/inc/mysql/YViews.hxx
@@ -16,38 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YVIEWS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YVIEWS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#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 sdbcx::ObjectType createObject(const OUString& _rName) override;
- virtual void impl_refresh() override;
- virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
- virtual sdbcx::ObjectType 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(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)
- ,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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YVIEWS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx
index 5765aad01523..29a0a7ba83d5 100644
--- a/connectivity/source/inc/odbc/OBoundParam.hxx
+++ b/connectivity/source/inc/odbc/OBoundParam.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
+#pragma once
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
@@ -25,106 +24,105 @@
#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
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx
index 842ad47c1d10..6651c06d4123 100644
--- a/connectivity/source/inc/odbc/OConnection.hxx
+++ b/connectivity/source/inc/odbc/OConnection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
+#pragma once
#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -36,93 +35,93 @@
#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;
-
- typedef connectivity::OMetaConnection OConnection_BASE;
- typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
-
- class OOO_DLLPUBLIC_ODBCBASE 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:
- oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) 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);
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
index 177feb2dbddf..21a4ef0d39be 100644
--- a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
+++ b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
@@ -17,189 +17,187 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATA_HXX
+#pragma once
#include <odbc/OConnection.hxx>
#include <odbc/odbcbasedllapi.hxx>
#include <TDatabaseMetaDataBase.hxx>
namespace connectivity::odbc
- {
+{
- //************ Class: ODatabaseMetaData
+ //************ Class: ODatabaseMetaData
- class OOO_DLLPUBLIC_ODBCBASE 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
index 8f10f3c10ad4..c8c2faa72bbd 100644
--- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
+#pragma once
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/FetchDirection.hpp>
@@ -42,220 +41,215 @@
#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>
{
- /*
- ** 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 OOO_DLLPUBLIC_ODBCBASE 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
- css::uno::WeakReferenceHelper m_aStatement;
- css::uno::Reference< css::sdbc::XResultSetMetaData>
- 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 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);
-
-
- oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
- {
- return m_pConnection->getOdbcFunction(_nIndex);
- }
- // ::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() throw() override;
- virtual void SAL_CALL release() throw() 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,
- std::u16string_view 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,
- std::u16string_view table, std::u16string_view columnNamePattern );
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openColumns( const css::uno::Any& catalog, const OUString& schemaPattern,
- std::u16string_view tableNamePattern, std::u16string_view columnNamePattern );
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern,
- std::u16string_view procedureNamePattern,std::u16string_view columnNamePattern );
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openProcedures( const css::uno::Any& catalog, const OUString& schemaPattern,
- std::u16string_view procedureNamePattern);
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openVersionColumns(const css::uno::Any& catalog, const OUString& schema,
- std::u16string_view table);
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema,
- std::u16string_view 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,std::u16string_view table);
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openTablePrivileges(const css::uno::Any& catalog, const OUString& schemaPattern,
- std::u16string_view tableNamePattern);
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openSpecialColumns(bool _bRowVer,const css::uno::Any& catalog, const OUString& schema,
- std::u16string_view table,sal_Int32 scope, bool nullable );
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- void openIndexInfo( const css::uno::Any& catalog, const OUString& schema,
- std::u16string_view 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/ODriver.hxx b/connectivity/source/inc/odbc/ODriver.hxx
index 29262aea777e..bb6a4052ddae 100644
--- a/connectivity/source/inc/odbc/ODriver.hxx
+++ b/connectivity/source/inc/odbc/ODriver.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODRIVER_HXX
+#pragma once
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -28,52 +27,55 @@
#include <odbc/odbcbasedllapi.hxx>
#include <connectivity/CommonTools.hxx>
#include <osl/module.h>
+#include <odbc/OFunctions.hxx>
#include <odbc/OTools.hxx>
+#include <unotools/weakref.hxx>
namespace connectivity::odbc
- {
- typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo > ODriver_BASE;
+{
+ class OConnection;
+
+ 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;
- connectivity::OWeakRefArray 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;
- SQLHANDLE m_pDriverHandle;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
- virtual SQLHANDLE EnvironmentHandle(OUString &_rPath) = 0;
+ virtual SQLHANDLE EnvironmentHandle() = 0;
- public:
+ public:
- ODBCDriver(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+ ODBCDriver(css::uno::Reference< css::uno::XComponentContext > xContext);
- // only possibility to get the odbc functions
- virtual oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) 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; }
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODRIVER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OFunctions.hxx b/connectivity/source/inc/odbc/OFunctions.hxx
index 95787a1db4d2..87801632fbae 100644
--- a/connectivity/source/inc/odbc/OFunctions.hxx
+++ b/connectivity/source/inc/odbc/OFunctions.hxx
@@ -17,587 +17,450 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OFUNCTIONS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OFUNCTIONS_HXX
+#pragma once
+
+#include <sal/config.h>
#include <connectivity/odbc.hxx>
-#include <rtl/ustring.hxx>
-#include <osl/module.h>
+#include <odbc/OTools.hxx>
-namespace connectivity
+namespace connectivity::odbc
{
-
-// sal_Bool LoadFunctions(oslModule pODBCso, sal_Bool _bDS=sal_True);
-bool LoadLibrary_ODBC3(OUString &_rPath);
-// sal_Bool LoadLibrary_ADABAS(OUString &_rPath);
-
- // Connecting to a data source
- typedef SQLRETURN (SQL_API *T3SQLAllocHandle) (SQLSMALLINT HandleType,SQLHANDLE InputHandle,SQLHANDLE * OutputHandlePtr);
-
- #define N3SQLAllocHandle(a,b,c) (*reinterpret_cast<T3SQLAllocHandle>(getOdbcFunction(ODBC3SQLFunctionId::AllocHandle)))(a,b,c)
-
- typedef SQLRETURN (SQL_API *T3SQLConnect) (SQLHDBC ConnectionHandle,SQLCHAR *ServerName,SQLSMALLINT NameLength1,SQLCHAR *UserName,SQLSMALLINT NameLength2,SQLCHAR *Authentication,SQLSMALLINT NameLength3);
-
- #define N3SQLConnect(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLConnect>(getOdbcFunction(ODBC3SQLFunctionId::Connect)))(a,b,c,d,e,f,g)
-
- typedef SQLRETURN (SQL_API *T3SQLDriverConnect) ( SQLHDBC ConnectionHandle,
- HWND WindowHandle,
- SQLCHAR * InConnectionString,
- SQLSMALLINT StringLength1,
- SQLCHAR * OutConnectionString,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * StringLength2Ptr,
- SQLUSMALLINT DriverCompletion);
-
- #define N3SQLDriverConnect(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLDriverConnect>(getOdbcFunction(ODBC3SQLFunctionId::DriverConnect)))(a,b,c,d,e,f,g,h)
-
- typedef SQLRETURN (SQL_API *T3SQLBrowseConnect) ( SQLHDBC ConnectionHandle,
- SQLCHAR * InConnectionString,
- SQLSMALLINT StringLength1,
- SQLCHAR * OutConnectionString,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * StringLength2Ptr);
-
- #define N3SQLBrowseConnect(a,b,c,d,e,f) (*reinterpret_cast<T3SQLBrowseConnect>(getOdbcFunction(ODBC3SQLFunctionId::BrowseConnect)))(a,b,c,d,e,f)
-
+// All ODBC wrapper method signatures must match respective SQL* ODBC API functions exactly
+class Functions
+{
+public:
+ virtual bool has(ODBC3SQLFunctionId id) const = 0;
+
+ virtual SQLRETURN AllocHandle(SQLSMALLINT HandleType,
+ SQLHANDLE InputHandle,
+ SQLHANDLE* OutputHandlePtr) const = 0;
+ virtual SQLRETURN DriverConnect(SQLHDBC ConnectionHandle,
+ HWND WindowHandle,
+ SQLCHAR* InConnectionString,
+ SQLSMALLINT StringLength1,
+ SQLCHAR* OutConnectionString,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLength2Ptr,
+ SQLUSMALLINT DriverCompletion) const = 0;
+ virtual SQLRETURN DriverConnectW(SQLHDBC ConnectionHandle,
+ HWND WindowHandle,
+ SQLWCHAR* InConnectionString,
+ SQLSMALLINT StringLength1,
+ SQLWCHAR* OutConnectionString,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLength2Ptr,
+ SQLUSMALLINT DriverCompletion) const = 0;
// Obtaining information about a driver and data source
- typedef SQLRETURN (SQL_API *T3SQLDataSources) ( SQLHENV EnvironmentHandle,
- SQLUSMALLINT Direction,
- SQLCHAR * ServerName,
- SQLSMALLINT BufferLength1,
- SQLSMALLINT * NameLength1Ptr,
- SQLCHAR * Description,
- SQLSMALLINT BufferLength2,
- SQLSMALLINT * NameLength2Ptr);
-
- #define N3SQLDataSources(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLDataSources>(getOdbcFunction(ODBC3SQLFunctionId::DataSources)))(a,b,c,d,e,f,g,h)
-
- typedef SQLRETURN (SQL_API *T3SQLDrivers) ( SQLHENV EnvironmentHandle,
- SQLUSMALLINT Direction,
- SQLCHAR * DriverDescription,
- SQLSMALLINT BufferLength1,
- SQLSMALLINT * DescriptionLengthPtr,
- SQLCHAR * DriverAttributes,
- SQLSMALLINT BufferLength2,
- SQLSMALLINT * AttributesLengthPtr);
-
- #define N3SQLDrivers(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLDrivers>(getOdbcFunction(ODBC3SQLFunctionId::Drivers)))(a,b,c,d,e,f,g,h)
-
- typedef SQLRETURN (SQL_API *T3SQLGetInfo) ( SQLHDBC ConnectionHandle,
- SQLUSMALLINT InfoType,
- SQLPOINTER InfoValuePtr,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * StringLengthPtr);
-
- #define N3SQLGetInfo(a,b,c,d,e) (*reinterpret_cast<T3SQLGetInfo>(getOdbcFunction(ODBC3SQLFunctionId::GetInfo)))(a,b,c,d,e)
-
- typedef SQLRETURN (SQL_API *T3SQLGetFunctions) (SQLHDBC ConnectionHandle,
- SQLUSMALLINT FunctionId,
- SQLUSMALLINT * SupportedPtr);
-
- #define N3SQLGetFunctions(a,b,c) (*reinterpret_cast<T3SQLGetFunctions>(getOdbcFunction(ODBC3SQLFunctionId::GetFunctions)))(a,b,c)
-
- typedef SQLRETURN (SQL_API *T3SQLGetTypeInfo) ( SQLHSTMT StatementHandle,
- SQLSMALLINT DataType);
-
- #define N3SQLGetTypeInfo(a,b) (*reinterpret_cast<T3SQLGetTypeInfo>(getOdbcFunction(ODBC3SQLFunctionId::GetTypeInfo)))(a,b)
-
+ virtual SQLRETURN GetInfo(SQLHDBC ConnectionHandle,
+ SQLUSMALLINT InfoType,
+ SQLPOINTER InfoValuePtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLengthPtr) const = 0;
+ virtual SQLRETURN GetInfoW(SQLHDBC ConnectionHandle,
+ SQLUSMALLINT InfoType,
+ SQLPOINTER InfoValuePtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLengthPtr) const = 0;
+ virtual SQLRETURN GetFunctions(SQLHDBC ConnectionHandle,
+ SQLUSMALLINT FunctionId,
+ SQLUSMALLINT* SupportedPtr) const = 0;
+ virtual SQLRETURN GetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) const = 0;
// Setting and retrieving driver attributes
- typedef SQLRETURN (SQL_API *T3SQLSetConnectAttr)(SQLHDBC ConnectionHandle,
- SQLINTEGER Attribute,
- SQLPOINTER ValuePtr,
- SQLINTEGER StringLength);
-
- #define N3SQLSetConnectAttr(a,b,c,d) (*reinterpret_cast<T3SQLSetConnectAttr>(getOdbcFunction(ODBC3SQLFunctionId::SetConnectAttr)))(a,b,c,d)
-
- typedef SQLRETURN (SQL_API *T3SQLGetConnectAttr) (SQLHDBC ConnectionHandle,
- SQLINTEGER Attribute,
- SQLPOINTER ValuePtr,
- SQLINTEGER BufferLength,
- SQLINTEGER* StringLength);
-
- #define N3SQLGetConnectAttr(a,b,c,d,e) (*reinterpret_cast<T3SQLGetConnectAttr>(getOdbcFunction(ODBC3SQLFunctionId::GetConnectAttr)))(a,b,c,d,e)
-
-
- typedef SQLRETURN (SQL_API *T3SQLSetEnvAttr) ( SQLHENV EnvironmentHandle,
- SQLINTEGER Attribute,
- SQLPOINTER ValuePtr,
- SQLINTEGER StringLength);
-
- #define N3SQLSetEnvAttr(a,b,c,d) (*reinterpret_cast<T3SQLSetEnvAttr>(getOdbcFunction(ODBC3SQLFunctionId::SetEnvAttr)))(a,b,c,d)
-
- typedef SQLRETURN (SQL_API *T3SQLGetEnvAttr) ( SQLHENV EnvironmentHandle,
- SQLINTEGER Attribute,
- SQLPOINTER ValuePtr,
- SQLINTEGER BufferLength,
- SQLINTEGER* StringLength);
-
- #define N3SQLGetEnvAttr(a,b,c,d,e) (*reinterpret_cast<T3SQLGetEnvAttr>(getOdbcFunction(ODBC3SQLFunctionId::GetEnvAttr)))(a,b,c,d,e)
-
-
- typedef SQLRETURN (SQL_API *T3SQLSetStmtAttr) ( SQLHSTMT StatementHandle,
- SQLINTEGER Attribute,
- SQLPOINTER ValuePtr,
- SQLINTEGER StringLength);
-
- #define N3SQLSetStmtAttr(a,b,c,d) (*reinterpret_cast<T3SQLSetStmtAttr>(getOdbcFunction(ODBC3SQLFunctionId::SetStmtAttr)))(a,b,c,d)
-
- typedef SQLRETURN (SQL_API *T3SQLGetStmtAttr) ( SQLHSTMT StatementHandle,
- SQLINTEGER Attribute,
- SQLPOINTER ValuePtr,
- SQLINTEGER BufferLength,
- SQLINTEGER* StringLength);
-
- #define N3SQLGetStmtAttr(a,b,c,d,e) (*reinterpret_cast<T3SQLGetStmtAttr>(getOdbcFunction(ODBC3SQLFunctionId::GetStmtAttr)))(a,b,c,d,e)
-
+ virtual SQLRETURN SetConnectAttr(SQLHDBC ConnectionHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const = 0;
+ virtual SQLRETURN SetConnectAttrW(SQLHDBC ConnectionHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const = 0;
+ virtual SQLRETURN GetConnectAttr(SQLHDBC ConnectionHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLength) const = 0;
+ virtual SQLRETURN GetConnectAttrW(SQLHDBC ConnectionHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLength) const = 0;
+ virtual SQLRETURN SetEnvAttr(SQLHENV EnvironmentHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const = 0;
+ virtual SQLRETURN GetEnvAttr(SQLHENV EnvironmentHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLength) const = 0;
+ virtual SQLRETURN SetStmtAttr(SQLHSTMT StatementHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER StringLength) const = 0;
+ virtual SQLRETURN GetStmtAttr(SQLHSTMT StatementHandle,
+ SQLINTEGER Attribute,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLength) const = 0;
// Setting and retrieving descriptor fields
- /*typedef SQLRETURN (SQL_API *T3SQLSetDescField) (SQLHDESC DescriptorHandle,
- SQLSMALLINT RecNumber,
- SQLSMALLINT FieldIdentifier,
- SQLPOINTER ValuePtr,
- SQLINTEGER BufferLength);
-
- #define N3SQLSetDescField(a,b,c,d,e) (*reinterpret_cast<T3SQLSetDescField>(getOdbcFunction(ODBC3SQLFunctionId::SetDescField)))(a,b,c,d,e)
-
- typedef SQLRETURN (SQL_API *T3SQLGetDescField) ( SQLHDESC DescriptorHandle,
- SQLSMALLINT RecNumber,
- SQLSMALLINT FieldIdentifier,
- SQLPOINTER ValuePtr,
- SQLINTEGER BufferLength,
- SQLINTEGER * StringLengthPtr);
-
- #define N3SQLGetDescField(a,b,c,d,e,f) (*reinterpret_cast<T3SQLGetDescField>(getOdbcFunction(ODBC3SQLFunctionId::GetDescField)))(a,b,c,d,e,f)
-
-
- typedef SQLRETURN (SQL_API *T3SQLGetDescRec) ( SQLHDESC DescriptorHandle,
- SQLSMALLINT RecNumber,
- SQLCHAR * Name,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * StringLengthPtr,
- SQLSMALLINT * TypePtr,
- SQLSMALLINT * SubTypePtr,
- SQLLEN * LengthPtr,
- SQLSMALLINT * PrecisionPtr,
- SQLSMALLINT * ScalePtr,
- SQLSMALLINT * NullablePtr);
-
- #define N3SQLGetDescRec(a,b,c,d,e,f,g,h,i,j,k) (*reinterpret_cast<T3SQLGetDescRec>(getOdbcFunction(ODBC3SQLFunctionId::GetDescRec)))(a,b,c,d,e,f,g,h,i,j,k)
-
-
- typedef SQLRETURN (SQL_API *T3SQLSetDescRec) ( SQLHDESC DescriptorHandle,
- SQLSMALLINT RecNumber,
- SQLSMALLINT Type,
- SQLSMALLINT SubType,
- SQLLEN Length,
- SQLSMALLINT Precision,
- SQLSMALLINT Scale,
- SQLPOINTER DataPtr,
- SQLLEN * StringLengthPtr,
- SQLLEN * IndicatorPtr);
-
- #define N3SQLSetDescRec(a,b,c,d,e,f,g,h,i,j) (*reinterpret_cast<T3SQLSetDescRec>(getOdbcFunction(ODBC3SQLFunctionId::SetDescRec)))(a,b,c,d,e,f,g,h,i,j)
+ /*
+ virtual SQLRETURN SetDescField(SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT FieldIdentifier,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength) const = 0;
+ virtual SQLRETURN GetDescField(SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT FieldIdentifier,
+ SQLPOINTER ValuePtr,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* StringLengthPtr) const = 0;
+ virtual SQLRETURN GetDescRec(SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLCHAR* Name,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLengthPtr,
+ SQLSMALLINT* TypePtr,
+ SQLSMALLINT* SubTypePtr,
+ SQLLEN* LengthPtr,
+ SQLSMALLINT* PrecisionPtr,
+ SQLSMALLINT* ScalePtr,
+ SQLSMALLINT* NullablePtr) const = 0;
+ virtual SQLRETURN SetDescRec(SQLHDESC DescriptorHandle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT Type,
+ SQLSMALLINT SubType,
+ SQLLEN Length,
+ SQLSMALLINT Precision,
+ SQLSMALLINT Scale,
+ SQLPOINTER DataPtr,
+ SQLLEN* StringLengthPtr,
+ SQLLEN* IndicatorPtr) const = 0;
*/
-
// Preparing SQL requests
- typedef SQLRETURN (SQL_API *T3SQLPrepare) ( SQLHSTMT StatementHandle,
- SQLCHAR * StatementText,
- SQLINTEGER TextLength);
-
- #define N3SQLPrepare(a,b,c) (*reinterpret_cast<T3SQLPrepare>(getOdbcFunction(ODBC3SQLFunctionId::Prepare)))(a,b,c)
-
- typedef SQLRETURN (SQL_API *T3SQLBindParameter) (SQLHSTMT StatementHandle,
- SQLUSMALLINT ParameterNumber,
- SQLSMALLINT InputOutputType,
- SQLSMALLINT ValueType,
- SQLSMALLINT ParameterType,
- SQLULEN ColumnSize,
- SQLSMALLINT DecimalDigits,
- SQLPOINTER ParameterValuePtr,
- SQLLEN BufferLength,
- SQLLEN * StrLen_or_IndPtr);
-
- #define N3SQLBindParameter(a,b,c,d,e,f,g,h,i,j) (*reinterpret_cast<T3SQLBindParameter>(getOdbcFunction(ODBC3SQLFunctionId::BindParameter)))(a,b,c,d,e,f,g,h,i,j)
-
- /*typedef SQLRETURN (SQL_API *T3SQLGetCursorName) (SQLHSTMT StatementHandle,
- SQLCHAR * CursorName,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * NameLengthPtr);
-
- #define N3SQLGetCursorName(a,b,c,d) (*reinterpret_cast<T3SQLGetCursorName>(getOdbcFunction(ODBC3SQLFunctionId::GetCursorName)))(a,b,c,d)
+ virtual SQLRETURN Prepare(SQLHSTMT StatementHandle,
+ SQLCHAR* StatementText,
+ SQLINTEGER TextLength) const = 0;
+ virtual SQLRETURN PrepareW(SQLHSTMT StatementHandle,
+ SQLWCHAR* StatementText,
+ SQLINTEGER TextLength) const = 0;
+ virtual SQLRETURN BindParameter(SQLHSTMT StatementHandle,
+ SQLUSMALLINT ParameterNumber,
+ SQLSMALLINT InputOutputType,
+ SQLSMALLINT ValueType,
+ SQLSMALLINT ParameterType,
+ SQLULEN ColumnSize,
+ SQLSMALLINT DecimalDigits,
+ SQLPOINTER ParameterValuePtr,
+ SQLLEN BufferLength,
+ SQLLEN* StrLen_or_IndPtr) const = 0;
+ /*
+ virtual SQLRETURN GetCursorName(SQLHSTMT StatementHandle,
+ SQLCHAR* CursorName,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* NameLengthPtr) const = 0;
*/
-
- typedef SQLRETURN (SQL_API *T3SQLSetCursorName) (SQLHSTMT StatementHandle,
- SQLCHAR * CursorName,
- SQLSMALLINT NameLength);
-
- #define N3SQLSetCursorName(a,b,c) (*reinterpret_cast<T3SQLSetCursorName>(getOdbcFunction(ODBC3SQLFunctionId::SetCursorName)))(a,b,c)
-
+ virtual SQLRETURN SetCursorName(SQLHSTMT StatementHandle,
+ SQLCHAR* CursorName,
+ SQLSMALLINT NameLength) const = 0;
+ virtual SQLRETURN SetCursorNameW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CursorName,
+ SQLSMALLINT NameLength) const = 0;
// Submitting requests
- typedef SQLRETURN (SQL_API *T3SQLExecute) ( SQLHSTMT StatementHandle);
-
- #define N3SQLExecute(a) (*reinterpret_cast<T3SQLExecute>(getOdbcFunction(ODBC3SQLFunctionId::Execute)))(a)
-
- typedef SQLRETURN (SQL_API *T3SQLExecDirect) ( SQLHSTMT StatementHandle,
- SQLCHAR * StatementText,
- SQLINTEGER TextLength);
-
- #define N3SQLExecDirect(a,b,c) (*reinterpret_cast<T3SQLExecDirect>(getOdbcFunction(ODBC3SQLFunctionId::ExecDirect)))(a,b,c)
-
- typedef SQLRETURN (SQL_API *T3SQLDescribeParam) (SQLHSTMT StatementHandle,
- SQLUSMALLINT ParameterNumber,
- SQLSMALLINT * DataTypePtr,
- SQLULEN * ParameterSizePtr,
- SQLSMALLINT * DecimalDigitsPtr,
- SQLSMALLINT * NullablePtr);
-
- #define N3SQLDescribeParam(a,b,c,d,e,f) (*reinterpret_cast<T3SQLDescribeParam>(getOdbcFunction(ODBC3SQLFunctionId::DescribeParam)))(a,b,c,d,e,f)
-
- typedef SQLRETURN (SQL_API *T3SQLNumParams) ( SQLHSTMT StatementHandle,
- SQLSMALLINT * ParameterCountPtr);
-
- #define N3SQLNumParams(a,b) (*reinterpret_cast<T3SQLNumParams>(getOdbcFunction(ODBC3SQLFunctionId::NumParams)))(a,b)
-
- typedef SQLRETURN (SQL_API *T3SQLParamData) ( SQLHSTMT StatementHandle,
- SQLPOINTER * ValuePtrPtr);
-
- #define N3SQLParamData(a,b) (*reinterpret_cast<T3SQLParamData>(getOdbcFunction(ODBC3SQLFunctionId::ParamData)))(a,b)
-
- typedef SQLRETURN (SQL_API *T3SQLPutData) ( SQLHSTMT StatementHandle,
- SQLPOINTER DataPtr,
- SQLLEN StrLen_or_Ind);
-
- #define N3SQLPutData(a,b,c) (*reinterpret_cast<T3SQLPutData>(getOdbcFunction(ODBC3SQLFunctionId::PutData)))(a,b,c)
-
+ virtual SQLRETURN Execute(SQLHSTMT StatementHandle) const = 0;
+ virtual SQLRETURN ExecDirect(SQLHSTMT StatementHandle,
+ SQLCHAR* StatementText,
+ SQLINTEGER TextLength) const = 0;
+ virtual SQLRETURN ExecDirectW(SQLHSTMT StatementHandle,
+ SQLWCHAR* StatementText,
+ SQLINTEGER TextLength) const = 0;
+ virtual SQLRETURN DescribeParam(SQLHSTMT StatementHandle,
+ SQLUSMALLINT ParameterNumber,
+ SQLSMALLINT* DataTypePtr,
+ SQLULEN* ParameterSizePtr,
+ SQLSMALLINT* DecimalDigitsPtr,
+ SQLSMALLINT* NullablePtr) const = 0;
+ virtual SQLRETURN NumParams(SQLHSTMT StatementHandle, SQLSMALLINT* ParameterCountPtr) const = 0;
+ virtual SQLRETURN ParamData(SQLHSTMT StatementHandle, SQLPOINTER* ValuePtrPtr) const = 0;
+ virtual SQLRETURN PutData(SQLHSTMT StatementHandle,
+ SQLPOINTER DataPtr,
+ SQLLEN StrLen_or_Ind) const = 0;
// Retrieving results and information about results
- typedef SQLRETURN (SQL_API *T3SQLRowCount) ( SQLHSTMT StatementHandle,
- SQLLEN * RowCountPtr);
-
- #define N3SQLRowCount(a,b) (*reinterpret_cast<T3SQLRowCount>(getOdbcFunction(ODBC3SQLFunctionId::RowCount)))(a,b)
-
- typedef SQLRETURN (SQL_API *T3SQLNumResultCols) (SQLHSTMT StatementHandle,
- SQLSMALLINT * ColumnCountPtr);
-
- #define N3SQLNumResultCols(a,b) (*reinterpret_cast<T3SQLNumResultCols>(getOdbcFunction(ODBC3SQLFunctionId::NumResultCols)))(a,b)
-
- typedef SQLRETURN (SQL_API *T3SQLDescribeCol) ( SQLHSTMT StatementHandle,
- SQLUSMALLINT ColumnNumber,
- SQLCHAR * ColumnName,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * NameLengthPtr,
- SQLSMALLINT * DataTypePtr,
- SQLULEN * ColumnSizePtr,
- SQLSMALLINT * DecimalDigitsPtr,
- SQLSMALLINT * NullablePtr);
-
- #define N3SQLDescribeCol(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLDescribeCol>(getOdbcFunction(ODBC3SQLFunctionId::DescribeCol)))(a,b,c,d,e,f,g,h,i)
-
- typedef SQLRETURN (SQL_API *T3SQLColAttribute) (SQLHSTMT StatementHandle,
- SQLUSMALLINT ColumnNumber,
- SQLUSMALLINT FieldIdentifier,
- SQLPOINTER CharacterAttributePtr,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * StringLengthPtr,
- SQLLEN * NumericAttributePtr);
-
- #define N3SQLColAttribute(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLColAttribute>(getOdbcFunction(ODBC3SQLFunctionId::ColAttribute)))(a,b,c,d,e,f,g)
-
- typedef SQLRETURN (SQL_API *T3SQLBindCol) ( SQLHSTMT StatementHandle,
- SQLUSMALLINT ColumnNumber,
- SQLSMALLINT TargetType,
- SQLPOINTER TargetValuePtr,
- SQLLEN BufferLength,
- SQLLEN * StrLen_or_IndPtr);
-
- #define N3SQLBindCol(a,b,c,d,e,f) (*reinterpret_cast<T3SQLBindCol>(getOdbcFunction(ODBC3SQLFunctionId::BindCol)))(a,b,c,d,e,f)
-
- typedef SQLRETURN (SQL_API *T3SQLFetch) ( SQLHSTMT StatementHandle);
-
- #define N3SQLFetch(a) (*reinterpret_cast<T3SQLFetch>(getOdbcFunction(ODBC3SQLFunctionId::Fetch)))(a)
-
- typedef SQLRETURN (SQL_API *T3SQLFetchScroll) ( SQLHSTMT StatementHandle,
- SQLSMALLINT FetchOrientation,
- SQLLEN FetchOffset);
-
- #define N3SQLFetchScroll(a,b,c) (*reinterpret_cast<T3SQLFetchScroll>(getOdbcFunction(ODBC3SQLFunctionId::FetchScroll)))(a,b,c)
-
- typedef SQLRETURN (SQL_API *T3SQLGetData) ( SQLHSTMT StatementHandle,
- SQLUSMALLINT ColumnNumber,
- SQLSMALLINT TargetType,
- SQLPOINTER TargetValuePtr,
- SQLLEN BufferLength,
- SQLLEN * StrLen_or_IndPtr);
-
- #define N3SQLGetData(a,b,c,d,e,f) (*reinterpret_cast<T3SQLGetData>(getOdbcFunction(ODBC3SQLFunctionId::GetData)))(a,b,c,d,e,f)
-
- typedef SQLRETURN (SQL_API *T3SQLSetPos) ( SQLHSTMT StatementHandle,
- SQLSETPOSIROW RowNumber,
- SQLUSMALLINT Operation,
- SQLUSMALLINT LockType);
-
- #define N3SQLSetPos(a,b,c,d) (*reinterpret_cast<T3SQLSetPos>(getOdbcFunction(ODBC3SQLFunctionId::SetPos)))(a,b,c,d)
-
- typedef SQLRETURN (SQL_API *T3SQLBulkOperations) ( SQLHSTMT StatementHandle,
- SQLSMALLINT Operation);
-
- #define N3SQLBulkOperations(a,b) (*reinterpret_cast<T3SQLBulkOperations>(getOdbcFunction(ODBC3SQLFunctionId::BulkOperations)))(a,b)
-
- typedef SQLRETURN (SQL_API *T3SQLMoreResults) ( SQLHSTMT StatementHandle);
-
- #define N3SQLMoreResults(a) (*reinterpret_cast<T3SQLMoreResults>(getOdbcFunction(ODBC3SQLFunctionId::MoreResults)))(a)
-
- /*typedef SQLRETURN (SQL_API *T3SQLGetDiagField) (SQLSMALLINT HandleType,
- SQLHANDLE Handle,
- SQLSMALLINT RecNumber,
- SQLSMALLINT DiagIdentifier,
- SQLPOINTER DiagInfoPtr,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * StringLengthPtr);
-
- #define N3SQLGetDiagField(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLGetDiagField>(getOdbcFunction(ODBC3SQLFunctionId::GetDiagField)))(a,b,c,d,e,f,g)*/
-
- typedef SQLRETURN (SQL_API *T3SQLGetDiagRec) ( SQLSMALLINT HandleType,
- SQLHANDLE Handle,
- SQLSMALLINT RecNumber,
- SQLCHAR * Sqlstate,
- SQLINTEGER * NativeErrorPtr,
- SQLCHAR * MessageText,
- SQLSMALLINT BufferLength,
- SQLSMALLINT * TextLengthPtr);
-
-
- #define N3SQLGetDiagRec(a,b,c,d,e,f,g,h) (*reinterpret_cast<T3SQLGetDiagRec>(getOdbcFunction(ODBC3SQLFunctionId::GetDiagRec)))(a,b,c,d,e,f,g,h)
-
+ virtual SQLRETURN RowCount(SQLHSTMT StatementHandle, SQLLEN* RowCountPtr) const = 0;
+ virtual SQLRETURN NumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT* ColumnCountPtr) const = 0;
+ virtual SQLRETURN ColAttribute(SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLUSMALLINT FieldIdentifier,
+ SQLPOINTER CharacterAttributePtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLengthPtr,
+ SQLLEN* NumericAttributePtr) const = 0;
+ virtual SQLRETURN ColAttributeW(SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLUSMALLINT FieldIdentifier,
+ SQLPOINTER CharacterAttributePtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLengthPtr,
+ SQLLEN* NumericAttributePtr) const = 0;
+ virtual SQLRETURN BindCol(SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLSMALLINT TargetType,
+ SQLPOINTER TargetValuePtr,
+ SQLLEN BufferLength,
+ SQLLEN* StrLen_or_IndPtr) const = 0;
+ virtual SQLRETURN Fetch(SQLHSTMT StatementHandle) const = 0;
+ virtual SQLRETURN FetchScroll(SQLHSTMT StatementHandle,
+ SQLSMALLINT FetchOrientation,
+ SQLLEN FetchOffset) const = 0;
+ virtual SQLRETURN GetData(SQLHSTMT StatementHandle,
+ SQLUSMALLINT ColumnNumber,
+ SQLSMALLINT TargetType,
+ SQLPOINTER TargetValuePtr,
+ SQLLEN BufferLength,
+ SQLLEN* StrLen_or_IndPtr) const = 0;
+ virtual SQLRETURN SetPos(SQLHSTMT StatementHandle,
+ SQLSETPOSIROW RowNumber,
+ SQLUSMALLINT Operation,
+ SQLUSMALLINT LockType) const = 0;
+ virtual SQLRETURN BulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation) const = 0;
+ virtual SQLRETURN MoreResults(SQLHSTMT StatementHandle) const = 0;
+ /*
+ virtual SQLRETURN GetDiagField(SQLSMALLINT HandleType,
+ SQLHANDLE Handle,
+ SQLSMALLINT RecNumber,
+ SQLSMALLINT DiagIdentifier,
+ SQLPOINTER DiagInfoPtr,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* StringLengthPtr) const = 0;
+ */
+ virtual SQLRETURN GetDiagRec(SQLSMALLINT HandleType,
+ SQLHANDLE Handle,
+ SQLSMALLINT RecNumber,
+ SQLCHAR* Sqlstate,
+ SQLINTEGER* NativeErrorPtr,
+ SQLCHAR* MessageText,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* TextLengthPtr) const = 0;
+ virtual SQLRETURN GetDiagRecW(SQLSMALLINT HandleType,
+ SQLHANDLE Handle,
+ SQLSMALLINT RecNumber,
+ SQLWCHAR* Sqlstate,
+ SQLINTEGER* NativeErrorPtr,
+ SQLWCHAR* MessageText,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* TextLengthPtr) const = 0;
// Obtaining information about the data source's system tables (catalog functions)
- typedef SQLRETURN (SQL_API *T3SQLColumnPrivileges) (SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * TableName,
- SQLSMALLINT NameLength3,
- SQLCHAR * ColumnName,
- SQLSMALLINT NameLength4);
-
- #define N3SQLColumnPrivileges(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLColumnPrivileges>(getOdbcFunction(ODBC3SQLFunctionId::ColumnPrivileges)))(a,b,c,d,e,f,g,h,i)
-
- typedef SQLRETURN (SQL_API *T3SQLColumns) ( SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * TableName,
- SQLSMALLINT NameLength3,
- SQLCHAR * ColumnName,
- SQLSMALLINT NameLength4);
-
- #define N3SQLColumns(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLColumns>(getOdbcFunction(ODBC3SQLFunctionId::Columns)))(a,b,c,d,e,f,g,h,i)
-
- typedef SQLRETURN (SQL_API *T3SQLForeignKeys) ( SQLHSTMT StatementHandle,
- SQLCHAR * PKCatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * PKSchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * PKTableName,
- SQLSMALLINT NameLength3,
- SQLCHAR * FKCatalogName,
- SQLSMALLINT NameLength4,
- SQLCHAR * FKSchemaName,
- SQLSMALLINT NameLength5,
- SQLCHAR * FKTableName,
- SQLSMALLINT NameLength6);
-
- #define N3SQLForeignKeys(a,b,c,d,e,f,g,h,i,j,k,l,m) (*reinterpret_cast<T3SQLForeignKeys>(getOdbcFunction(ODBC3SQLFunctionId::ForeignKeys)))(a,b,c,d,e,f,g,h,i,j,k,l,m)
-
- typedef SQLRETURN (SQL_API *T3SQLPrimaryKeys) ( SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * TableName,
- SQLSMALLINT NameLength3);
-
- #define N3SQLPrimaryKeys(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLPrimaryKeys>(getOdbcFunction(ODBC3SQLFunctionId::PrimaryKeys)))(a,b,c,d,e,f,g)
-
- typedef SQLRETURN (SQL_API *T3SQLProcedureColumns) (SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * ProcName,
- SQLSMALLINT NameLength3,
- SQLCHAR * ColumnName,
- SQLSMALLINT NameLength4);
-
- #define N3SQLProcedureColumns(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLProcedureColumns>(getOdbcFunction(ODBC3SQLFunctionId::ProcedureColumns)))(a,b,c,d,e,f,g,h,i)
-
- typedef SQLRETURN (SQL_API *T3SQLProcedures) ( SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * ProcName,
- SQLSMALLINT NameLength3);
-
- #define N3SQLProcedures(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLProcedures>(getOdbcFunction(ODBC3SQLFunctionId::Procedures)))(a,b,c,d,e,f,g)
-
- typedef SQLRETURN (SQL_API *T3SQLSpecialColumns) (SQLHSTMT StatementHandle,
- SQLUSMALLINT IdentifierType,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * TableName,
- SQLSMALLINT NameLength3,
- SQLUSMALLINT Scope,
- SQLUSMALLINT Nullable);
-
- #define N3SQLSpecialColumns(a,b,c,d,e,f,g,h,i,j) (*reinterpret_cast<T3SQLSpecialColumns>(getOdbcFunction(ODBC3SQLFunctionId::SpecialColumns)))(a,b,c,d,e,f,g,h,i,j)
-
- typedef SQLRETURN (SQL_API *T3SQLStatistics) ( SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * TableName,
- SQLSMALLINT NameLength3,
- SQLUSMALLINT Unique,
- SQLUSMALLINT Reserved);
-
- #define N3SQLStatistics(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLStatistics>(getOdbcFunction(ODBC3SQLFunctionId::Statistics)))(a,b,c,d,e,f,g,h,i)
-
- typedef SQLRETURN (SQL_API *T3SQLTablePrivileges) (SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * TableName,
- SQLSMALLINT NameLength3);
-
- #define N3SQLTablePrivileges(a,b,c,d,e,f,g) (*reinterpret_cast<T3SQLTablePrivileges>(getOdbcFunction(ODBC3SQLFunctionId::TablePrivileges)))(a,b,c,d,e,f,g)
-
- typedef SQLRETURN (SQL_API *T3SQLTables) ( SQLHSTMT StatementHandle,
- SQLCHAR * CatalogName,
- SQLSMALLINT NameLength1,
- SQLCHAR * SchemaName,
- SQLSMALLINT NameLength2,
- SQLCHAR * TableName,
- SQLSMALLINT NameLength3,
- SQLCHAR * TableType,
- SQLSMALLINT NameLength4);
-
- #define N3SQLTables(a,b,c,d,e,f,g,h,i) (*reinterpret_cast<T3SQLTables>(getOdbcFunction(ODBC3SQLFunctionId::Tables)))(a,b,c,d,e,f,g,h,i)
-
+ virtual SQLRETURN ColumnPrivileges(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const = 0;
+ virtual SQLRETURN ColumnPrivilegesW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLWCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const = 0;
+ virtual SQLRETURN Columns(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const = 0;
+ virtual SQLRETURN ColumnsW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLWCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const = 0;
+ virtual SQLRETURN ForeignKeys(SQLHSTMT StatementHandle,
+ SQLCHAR* PKCatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* PKSchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* PKTableName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR* FKCatalogName,
+ SQLSMALLINT NameLength4,
+ SQLCHAR* FKSchemaName,
+ SQLSMALLINT NameLength5,
+ SQLCHAR* FKTableName,
+ SQLSMALLINT NameLength6) const = 0;
+ virtual SQLRETURN ForeignKeysW(SQLHSTMT StatementHandle,
+ SQLWCHAR* PKCatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* PKSchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* PKTableName,
+ SQLSMALLINT NameLength3,
+ SQLWCHAR* FKCatalogName,
+ SQLSMALLINT NameLength4,
+ SQLWCHAR* FKSchemaName,
+ SQLSMALLINT NameLength5,
+ SQLWCHAR* FKTableName,
+ SQLSMALLINT NameLength6) const = 0;
+ virtual SQLRETURN PrimaryKeys(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* TableName,
+ SQLSMALLINT NameLength3) const = 0;
+ virtual SQLRETURN PrimaryKeysW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3) const = 0;
+ virtual SQLRETURN ProcedureColumns(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* ProcName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const = 0;
+ virtual SQLRETURN ProcedureColumnsW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* ProcName,
+ SQLSMALLINT NameLength3,
+ SQLWCHAR* ColumnName,
+ SQLSMALLINT NameLength4) const = 0;
+ virtual SQLRETURN Procedures(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* ProcName,
+ SQLSMALLINT NameLength3) const = 0;
+ virtual SQLRETURN ProceduresW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* ProcName,
+ SQLSMALLINT NameLength3) const = 0;
+ virtual SQLRETURN SpecialColumns(SQLHSTMT StatementHandle,
+ SQLUSMALLINT IdentifierType,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLUSMALLINT Scope,
+ SQLUSMALLINT Nullable) const = 0;
+ virtual SQLRETURN SpecialColumnsW(SQLHSTMT StatementHandle,
+ SQLUSMALLINT IdentifierType,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLUSMALLINT Scope,
+ SQLUSMALLINT Nullable) const = 0;
+ virtual SQLRETURN Statistics(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLUSMALLINT Unique,
+ SQLUSMALLINT Reserved) const = 0;
+ virtual SQLRETURN StatisticsW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLUSMALLINT Unique,
+ SQLUSMALLINT Reserved) const = 0;
+ virtual SQLRETURN TablePrivileges(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* TableName,
+ SQLSMALLINT NameLength3) const = 0;
+ virtual SQLRETURN TablePrivilegesW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3) const = 0;
+ virtual SQLRETURN Tables(SQLHSTMT StatementHandle,
+ SQLCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLCHAR* TableType,
+ SQLSMALLINT NameLength4) const = 0;
+ virtual SQLRETURN TablesW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CatalogName,
+ SQLSMALLINT NameLength1,
+ SQLWCHAR* SchemaName,
+ SQLSMALLINT NameLength2,
+ SQLWCHAR* TableName,
+ SQLSMALLINT NameLength3,
+ SQLWCHAR* TableType,
+ SQLSMALLINT NameLength4) const = 0;
// Terminating a statement
- typedef SQLRETURN (SQL_API *T3SQLFreeStmt) ( SQLHSTMT StatementHandle,
- SQLUSMALLINT Option);
-
- #define N3SQLFreeStmt(a,b) (*reinterpret_cast<T3SQLFreeStmt>(getOdbcFunction(ODBC3SQLFunctionId::FreeStmt)))(a,b)
-
- typedef SQLRETURN (SQL_API *T3SQLCloseCursor) (SQLHSTMT StatementHandle);
-
- #define N3SQLCloseCursor(a) (*reinterpret_cast<T3SQLCloseCursor>(getOdbcFunction(ODBC3SQLFunctionId::CloseCursor)))(a)
-
- typedef SQLRETURN (SQL_API *T3SQLCancel) ( SQLHSTMT StatementHandle);
-
- #define N3SQLCancel(a) (*reinterpret_cast<T3SQLCancel>(getOdbcFunction(ODBC3SQLFunctionId::Cancel)))(a)
-
- typedef SQLRETURN (SQL_API *T3SQLEndTran) ( SQLSMALLINT HandleType,
- SQLHANDLE Handle,
- SQLSMALLINT CompletionType);
-
- #define N3SQLEndTran(a,b,c) (*reinterpret_cast<T3SQLEndTran>(getOdbcFunction(ODBC3SQLFunctionId::EndTran)))(a,b,c)
-
+ virtual SQLRETURN FreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) const = 0;
+ virtual SQLRETURN CloseCursor(SQLHSTMT StatementHandle) const = 0;
+ virtual SQLRETURN Cancel(SQLHSTMT StatementHandle) const = 0;
+ virtual SQLRETURN EndTran(SQLSMALLINT HandleType,
+ SQLHANDLE Handle,
+ SQLSMALLINT CompletionType) const = 0;
// Terminating a connection
- typedef SQLRETURN (SQL_API *T3SQLDisconnect) (SQLHDBC ConnectionHandle);
-
- #define N3SQLDisconnect(a) (*reinterpret_cast<T3SQLDisconnect>(getOdbcFunction(ODBC3SQLFunctionId::Disconnect)))(a)
-
- typedef SQLRETURN (SQL_API *T3SQLFreeHandle) (SQLSMALLINT HandleType,
- SQLHANDLE Handle);
-
- #define N3SQLFreeHandle(a,b) (*reinterpret_cast<T3SQLFreeHandle>(getOdbcFunction(ODBC3SQLFunctionId::FreeHandle)))(a,b)
-
- typedef SQLRETURN (SQL_API *T3SQLGetCursorName) ( SQLHSTMT StatementHandle,
- SQLCHAR * CursorName,
- SQLSMALLINT BufferLength,
- SQLSMALLINT* NameLength2);
-
- #define N3SQLGetCursorName(a,b,c,d) (*reinterpret_cast<T3SQLGetCursorName>(getOdbcFunction(ODBC3SQLFunctionId::GetCursorName)))(a,b,c,d)
-
- typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHSTMT ConnectionHandle,
- SQLCHAR * InStatementText,
- SQLINTEGER TextLength1,
- SQLCHAR * OutStatementText,
- SQLINTEGER BufferLength,
- SQLINTEGER * TextLength2Ptr);
-
- #define N3SQLNativeSql(a,b,c,d,e,f) (*reinterpret_cast<T3SQLNativeSql>(getOdbcFunction(ODBC3SQLFunctionId::NativeSql)))(a,b,c,d,e,f)
-
- // extern declaration of the function pointer
- extern T3SQLAllocHandle pODBC3SQLAllocHandle;
- extern T3SQLConnect pODBC3SQLConnect;
- extern T3SQLDriverConnect pODBC3SQLDriverConnect;
- extern T3SQLBrowseConnect pODBC3SQLBrowseConnect;
- extern T3SQLDataSources pODBC3SQLDataSources;
- extern T3SQLDrivers pODBC3SQLDrivers;
- extern T3SQLGetInfo pODBC3SQLGetInfo;
- extern T3SQLGetFunctions pODBC3SQLGetFunctions;
- extern T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
- extern T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
- extern T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
- extern T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
- extern T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
- extern T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
- extern T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
- //extern T3SQLSetDescField pODBC3SQLSetDescField;
- //extern T3SQLGetDescField pODBC3SQLGetDescField;
- //extern T3SQLGetDescRec pODBC3SQLGetDescRec;
- //extern T3SQLSetDescRec pODBC3SQLSetDescRec;
- extern T3SQLPrepare pODBC3SQLPrepare;
- extern T3SQLBindParameter pODBC3SQLBindParameter;
- //extern T3SQLGetCursorName pODBC3SQLGetCursorName;
- extern T3SQLSetCursorName pODBC3SQLSetCursorName;
- extern T3SQLExecute pODBC3SQLExecute;
- extern T3SQLExecDirect pODBC3SQLExecDirect;
- //extern T3SQLNativeSql pODBC3SQLNativeSql;
- extern T3SQLDescribeParam pODBC3SQLDescribeParam;
- extern T3SQLNumParams pODBC3SQLNumParams;
- extern T3SQLParamData pODBC3SQLParamData;
- extern T3SQLPutData pODBC3SQLPutData;
- extern T3SQLRowCount pODBC3SQLRowCount;
- extern T3SQLNumResultCols pODBC3SQLNumResultCols;
- extern T3SQLDescribeCol pODBC3SQLDescribeCol;
- extern T3SQLColAttribute pODBC3SQLColAttribute;
- extern T3SQLBindCol pODBC3SQLBindCol;
- extern T3SQLFetch pODBC3SQLFetch;
- extern T3SQLFetchScroll pODBC3SQLFetchScroll;
- extern T3SQLGetData pODBC3SQLGetData;
- extern T3SQLSetPos pODBC3SQLSetPos;
- extern T3SQLBulkOperations pODBC3SQLBulkOperations;
- extern T3SQLMoreResults pODBC3SQLMoreResults;
- //extern T3SQLGetDiagField pODBC3SQLGetDiagField;
- extern T3SQLGetDiagRec pODBC3SQLGetDiagRec;
- extern T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
- extern T3SQLColumns pODBC3SQLColumns;
- extern T3SQLForeignKeys pODBC3SQLForeignKeys;
- extern T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
- extern T3SQLProcedureColumns pODBC3SQLProcedureColumns;
- extern T3SQLProcedures pODBC3SQLProcedures;
- extern T3SQLSpecialColumns pODBC3SQLSpecialColumns;
- extern T3SQLStatistics pODBC3SQLStatistics;
- extern T3SQLTablePrivileges pODBC3SQLTablePrivileges;
- extern T3SQLTables pODBC3SQLTables;
- extern T3SQLFreeStmt pODBC3SQLFreeStmt;
- extern T3SQLCloseCursor pODBC3SQLCloseCursor;
- extern T3SQLCancel pODBC3SQLCancel;
- extern T3SQLEndTran pODBC3SQLEndTran;
- extern T3SQLDisconnect pODBC3SQLDisconnect;
- extern T3SQLFreeHandle pODBC3SQLFreeHandle;
- extern T3SQLGetCursorName pODBC3SQLGetCursorName;
- extern T3SQLNativeSql pODBC3SQLNativeSql;
+ virtual SQLRETURN Disconnect(SQLHDBC ConnectionHandle) const = 0;
+ virtual SQLRETURN FreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) const = 0;
+ virtual SQLRETURN GetCursorName(SQLHSTMT StatementHandle,
+ SQLCHAR* CursorName,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* NameLength2) const = 0;
+ virtual SQLRETURN GetCursorNameW(SQLHSTMT StatementHandle,
+ SQLWCHAR* CursorName,
+ SQLSMALLINT BufferLength,
+ SQLSMALLINT* NameLength2) const = 0;
+ virtual SQLRETURN NativeSql(SQLHDBC ConnectionHandle,
+ SQLCHAR* InStatementText,
+ SQLINTEGER TextLength1,
+ SQLCHAR* OutStatementText,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* TextLength2Ptr) const = 0;
+ virtual SQLRETURN NativeSqlW(SQLHDBC ConnectionHandle,
+ SQLWCHAR* InStatementText,
+ SQLINTEGER TextLength1,
+ SQLWCHAR* OutStatementText,
+ SQLINTEGER BufferLength,
+ SQLINTEGER* TextLength2Ptr) const = 0;
+};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OFUNCTIONS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx
index 288ce319acb9..a0dc078b6a07 100644
--- a/connectivity/source/inc/odbc/OPreparedStatement.hxx
+++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OPREPAREDSTATEMENT_HXX
+#pragma once
#include <odbc/odbcbasedllapi.hxx>
#include <odbc/OStatement.hxx>
@@ -30,122 +29,122 @@
#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 OBoundParam;
- typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement,
- css::sdbc::XParameters,
- css::sdbc::XPreparedBatchExecution,
- css::sdbc::XResultSetMetaDataSupplier,
- css::lang::XServiceInfo> OPreparedStatement_BASE;
-
- class OOO_DLLPUBLIC_ODBCBASE 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.
- css::uno::Reference< css::sdbc::XResultSetMetaData > 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 OResultSet* createResulSet() 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
-
- 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OPREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx
index bf82844df51f..46bb696fe601 100644
--- a/connectivity/source/inc/odbc/OResultSet.hxx
+++ b/connectivity/source/inc/odbc/OResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
+#pragma once
#include <com/sun/star/sdbc/FetchDirection.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
@@ -41,316 +40,311 @@
#include <connectivity/FValue.hxx>
#include <TSkipDeletedSet.hxx>
#include <memory>
+#include "OResultSetMetaData.hxx"
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::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;
- typedef std::pair<sal_Int64,sal_Int32> TVoidPtr;
- typedef std::allocator< TVoidPtr > TVoidAlloc;
- typedef std::vector<TVoidPtr> TVoidVector;
- /// 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 OOO_DLLPUBLIC_ODBCBASE 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;
- TVoidVector 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;
- css::uno::Reference< css::sdbc::XResultSetMetaData> 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);
- TVoidPtr allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex);
- 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();
- oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
- {
- return m_pStatement->getOdbcFunction(_nIndex);
- }
+ 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 css::uno::Reference< css::sdbc::XResultSetMetaData>& _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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OResultSetMetaData.hxx b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
index 6a1f089c4084..4fec8fde8477 100644
--- a/connectivity/source/inc/odbc/OResultSetMetaData.hxx
+++ b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <cppuhelper/implbase.hxx>
@@ -28,91 +27,87 @@
#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 OOO_DLLPUBLIC_ODBCBASE 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 ,const std::vector<sal_Int32> & _vMapping)
- :m_vMapping(_vMapping)
- ,m_aStatementHandle( _pStmt )
- ,m_pConnection(_pConnection)
- ,m_nColCount(_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);
- oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
- {
- return m_pConnection->getOdbcFunction(_nIndex);
- }
+ 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx
index 1b7b3a569434..d66065085743 100644
--- a/connectivity/source/inc/odbc/OStatement.hxx
+++ b/connectivity/source/inc/odbc/OStatement.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OSTATEMENT_HXX
+#pragma once
#include <com/sun/star/sdbc/XStatement.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
@@ -38,209 +37,206 @@
#include <string_view>
#include <vector>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#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 OOO_DLLPUBLIC_ODBCBASE OStatement_Base :
- public cppu::BaseMutex,
- public OStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
-
- {
- css::sdbc::SQLWarning m_aLastWarning;
- protected:
- css::uno::WeakReference< css::sdbc::XResultSet> 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(std::u16string_view _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
- css::uno::Reference<css::sdbc::XResultSet> getResultSet(bool checkCount);
- /**
- creates the driver specific resultset (factory)
- */
- virtual OResultSet* createResulSet();
-
- /// @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 >;
-
- oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
- {
- return m_pConnection->getOdbcFunction(_nIndex);
- }
- // OComponentHelper
- virtual void SAL_CALL disposing() override;
- // XInterface
- virtual void SAL_CALL release() throw() override;
- virtual void SAL_CALL acquire() throw() 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 OOO_DLLPUBLIC_ODBCBASE 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() throw() override;
- virtual void SAL_CALL release() throw() 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;
+ };
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/OTools.hxx b/connectivity/source/inc/odbc/OTools.hxx
index e3138fd716f5..c97ce4f4654a 100644
--- a/connectivity/source/inc/odbc/OTools.hxx
+++ b/connectivity/source/inc/odbc/OTools.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OTOOLS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OTOOLS_HXX
+#pragma once
#include <connectivity/odbc.hxx>
#include <odbc/odbcbasedllapi.hxx>
@@ -25,6 +24,8 @@
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTime.hpp>
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/thread.h>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -32,60 +33,79 @@
enum class ODBC3SQLFunctionId
{
- AllocHandle = 1,
- Connect = 2,
- DriverConnect = 3,
- BrowseConnect = 4,
- DataSources = 5,
- Drivers = 6,
- GetInfo = 7,
- GetFunctions = 8,
- GetTypeInfo = 9,
- SetConnectAttr = 10,
- GetConnectAttr = 11,
- SetEnvAttr = 12,
- GetEnvAttr = 13,
- SetStmtAttr = 14,
- GetStmtAttr = 15,
- Prepare = 16,
- BindParameter = 17,
- SetCursorName = 18,
- Execute = 19,
- ExecDirect = 20,
- DescribeParam = 21,
- NumParams = 22,
- ParamData = 23,
- PutData = 24,
- RowCount = 25,
- NumResultCols = 26,
- DescribeCol = 27,
- ColAttribute = 28,
- BindCol = 29,
- Fetch = 30,
- FetchScroll = 31,
- GetData = 32,
- SetPos = 33,
- BulkOperations = 34,
- MoreResults = 35,
- GetDiagRec = 36,
- ColumnPrivileges = 37,
- Columns = 38,
- ForeignKeys = 39,
- PrimaryKeys = 40,
- ProcedureColumns = 41,
- Procedures = 42,
- SpecialColumns = 43,
- Statistics = 44,
- TablePrivileges = 45,
- Tables = 46,
- FreeStmt = 47,
- CloseCursor = 48,
- Cancel = 49,
- EndTran = 50,
- Disconnect = 51,
- FreeHandle = 52,
- GetCursorName = 53,
- NativeSql = 54,
+ FIRST,
+ AllocHandle,
+ DriverConnect,
+ DriverConnectW,
+ GetInfo,
+ GetInfoW,
+ GetFunctions,
+ GetTypeInfo,
+ SetConnectAttr,
+ SetConnectAttrW,
+ GetConnectAttr,
+ GetConnectAttrW,
+ SetEnvAttr,
+ GetEnvAttr,
+ SetStmtAttr,
+ GetStmtAttr,
+ Prepare,
+ PrepareW,
+ BindParameter,
+ SetCursorName,
+ SetCursorNameW,
+ Execute,
+ ExecDirect,
+ ExecDirectW,
+ DescribeParam,
+ NumParams,
+ ParamData,
+ PutData,
+ RowCount,
+ NumResultCols,
+ ColAttribute,
+ ColAttributeW,
+ BindCol,
+ Fetch,
+ FetchScroll,
+ GetData,
+ SetPos,
+ BulkOperations,
+ MoreResults,
+ GetDiagRec,
+ GetDiagRecW,
+ ColumnPrivileges,
+ ColumnPrivilegesW,
+ Columns,
+ ColumnsW,
+ ForeignKeys,
+ ForeignKeysW,
+ PrimaryKeys,
+ PrimaryKeysW,
+ ProcedureColumns,
+ ProcedureColumnsW,
+ Procedures,
+ ProceduresW,
+ SpecialColumns,
+ SpecialColumnsW,
+ Statistics,
+ StatisticsW,
+ TablePrivileges,
+ TablePrivilegesW,
+ Tables,
+ TablesW,
+ FreeStmt,
+ CloseCursor,
+ Cancel,
+ EndTran,
+ Disconnect,
+ FreeHandle,
+ GetCursorName,
+ GetCursorNameW,
+ NativeSql,
+ NativeSqlW,
+
+ LAST
};
namespace connectivity::odbc
@@ -171,14 +191,12 @@ namespace connectivity::odbc
}
/**
getBindTypes set the ODBC type for C
- @param _bUseWChar true when Unicode should be used
@param _bUseOldTimeDate true when the old datetime format should be used
@param _nOdbcType the ODBC sql type
@param fCType the C type for the ODBC type
@param fSqlType the SQL type for the ODBC type
*/
- static void getBindTypes(bool _bUseWChar,
- bool _bUseOldTimeDate,
+ static void getBindTypes(bool _bUseOldTimeDate,
SQLSMALLINT _nOdbcType,
SQLSMALLINT& fCType,
SQLSMALLINT& fSqlType);
@@ -211,20 +229,6 @@ namespace connectivity::odbc
const css::uno::Reference< css::uno::XInterface >& _xInterface,
void* _pValue,
SQLLEN _nSize);
-
- /// @throws css::sdbc::SQLException
- /// @throws css::uno::RuntimeException
- static void bindValue( OConnection const * _pConnection,
- SQLHANDLE _aStatementHandle,
- sal_Int32 columnIndex,
- SQLSMALLINT _nType,
- SQLSMALLINT _nMaxLen,
- const void* _pValue,
- void* _pData,
- SQLLEN *pLen,
- const css::uno::Reference< css::uno::XInterface >& _xInterface,
- rtl_TextEncoding _nTextEncoding,
- bool _bUseOldTimeDate);
};
/// @throws css::sdbc::SQLException
@@ -240,8 +244,114 @@ namespace connectivity::odbc
OTools::getValue(_pConnection,_aStatementHandle,columnIndex,_nType,_bWasNull,_xInterface,&_rValue,sizeof _rValue);
}
+// Keep const_ and reinterpret_cast required to convert strings in one place
+
+inline OUString toUString(const SQLCHAR* str, sal_Int32 len, rtl_TextEncoding enc)
+{
+ return OUString(reinterpret_cast<const char*>(str), len, enc);
+}
+
+inline OUString toUString(const SQLCHAR* str)
+{
+ return OUString::createFromAscii(reinterpret_cast<const char*>(str));
+}
+
+inline OUString toUString(const SQLWCHAR* str, sal_Int32 len)
+{
+ static_assert(sizeof(SQLWCHAR) == sizeof(sal_Unicode) || sizeof(SQLWCHAR) == sizeof(sal_uInt32));
+ if constexpr (sizeof(SQLWCHAR) == sizeof(sal_Unicode))
+ return OUString(reinterpret_cast<const sal_Unicode*>(str), len);
+ else
+ {
+ auto* codepoints = reinterpret_cast<const sal_uInt32*>(str);
+ return OUString(codepoints, len);
+ }
+}
+
+// A templated class to encapsulate conversion from our string types into arrays of
+// SQLCHAR / SQLWCHAR (non-const, even if used as input values, and not modified),
+// that ODBC functions take. It owns its buffer (important for delayed reads/writes)
+
+template <typename C, size_t CHAR_SIZE = sizeof(C)> class CHARS {};
+
+template <size_t CHAR_SIZE> class SIZED
+{
+public:
+ SQLSMALLINT cch() const { return m_len; } // count of characters
+ bool empty() const { return m_len == 0; }
+ SQLSMALLINT cb() const { return m_len * CHAR_SIZE; } // count of bytes
+
+protected:
+ SQLSMALLINT m_len = 0;
+};
+
+template <typename C> class CHARS<C, sizeof(char)> : public SIZED<sizeof(char)>
+{
+public:
+ CHARS() = default;
+ CHARS(std::u16string_view str, rtl_TextEncoding encoding)
+ : CHARS(OUStringToOString(str, encoding))
+ {
+ }
+ CHARS(const OString& str)
+ : m_string(str)
+ {
+ m_len = std::min(m_string.getLength(), sal_Int32(std::numeric_limits<SQLSMALLINT>::max()));
+ }
+ C* get() { return reinterpret_cast<C*>(const_cast<char*>(m_string.getStr())); }
+
+private:
+ OString m_string; // ref-counted CoW, but in practice always created ad-hoc
+};
+
+template <typename C> class CHARS<C, sizeof(sal_Unicode)> : public SIZED<sizeof(sal_Unicode)>
+{
+public:
+ CHARS() = default;
+ CHARS(const OUString& str)
+ : m_string(str)
+ {
+ m_len = std::min(m_string.getLength(), sal_Int32(std::numeric_limits<SQLSMALLINT>::max()));
+ }
+ C* get() { return reinterpret_cast<C*>(const_cast<sal_Unicode*>(m_string.getStr())); }
+
+private:
+ OUString m_string; // ref-counted CoW
+};
+
+template <typename C> class CHARS<C, sizeof(sal_uInt32)> : public SIZED<sizeof(sal_uInt32)>
+{
+public:
+ CHARS() = default;
+ CHARS(std::u16string_view str)
+ {
+ auto size = std::min(str.size(), size_t(std::numeric_limits<SQLSMALLINT>::max()));
+ m_buf = std::make_unique<sal_uInt32[]>(size + 1);
+ auto p = m_buf.get();
+ for (size_t i = 0; i < str.size() && o3tl::make_unsigned(p - m_buf.get()) < size; ++p)
+ *p = o3tl::iterateCodePoints(str, &i);
+ m_len = p - m_buf.get();
+ *p = 0;
+ }
+ // Explicitly define a redundant overload for OUString to avoid certain loplugin warnings in
+ // code prepared to work with SQLWCHAR being either 16-bit unsigned short (Linux) or 32-bit
+ // wchar_t (macOS):
+ CHARS(OUString const & str): CHARS(static_cast<std::u16string_view>(str)) {}
+ C* get() { return reinterpret_cast<C*>(m_buf.get()); }
+
+private:
+ std::unique_ptr<sal_uInt32[]> m_buf;
+};
+
+using SQLChars = CHARS<SQLCHAR>;
+using SQLWChars = CHARS<SQLWCHAR>;
+// for now, use wchar only on Windows (see comment in OPreparedStatement::setParameter)
+#ifdef _WIN32
+const bool bUseWChar = true;
+#else
+const volatile inline bool bUseWChar = false; // volatile to avoid "unreachabe code" warnings
+#endif
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OTOOLS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/odbc/odbcbasedllapi.hxx b/connectivity/source/inc/odbc/odbcbasedllapi.hxx
index 59619eee7014..bf7f5a486dc2 100644
--- a/connectivity/source/inc/odbc/odbcbasedllapi.hxx
+++ b/connectivity/source/inc/odbc/odbcbasedllapi.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODBCBASEDLLAPI_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODBCBASEDLLAPI_HXX
+#pragma once
#include <sal/config.h>
@@ -30,6 +29,4 @@
#define OOO_DLLPUBLIC_ODBCBASE SAL_DLLPUBLIC_IMPORT
#endif
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx
index 538fe88c586e..b10b4f008e64 100644
--- a/connectivity/source/inc/propertyids.hxx
+++ b/connectivity/source/inc/propertyids.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_PROPERTYIDS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_PROPERTYIDS_HXX
+#pragma once
// this define has to be set to split the names into different dll's or so's
// every dll has his own set of property names
@@ -37,76 +36,76 @@ namespace dbtools
};
}
-#define PROPERTY_ID_QUERYTIMEOUT 1
-#define PROPERTY_ID_MAXFIELDSIZE 2
-#define PROPERTY_ID_MAXROWS 3
-#define PROPERTY_ID_CURSORNAME 4
-#define PROPERTY_ID_RESULTSETCONCURRENCY 5
-#define PROPERTY_ID_RESULTSETTYPE 6
-#define PROPERTY_ID_FETCHDIRECTION 7
-#define PROPERTY_ID_FETCHSIZE 8
-#define PROPERTY_ID_ESCAPEPROCESSING 9
-#define PROPERTY_ID_USEBOOKMARKS 10
-// Column
-#define PROPERTY_ID_NAME 11
-#define PROPERTY_ID_TYPE 12
-#define PROPERTY_ID_TYPENAME 13
-#define PROPERTY_ID_PRECISION 14
-#define PROPERTY_ID_SCALE 15
-#define PROPERTY_ID_ISNULLABLE 16
-#define PROPERTY_ID_ISAUTOINCREMENT 17
-#define PROPERTY_ID_ISROWVERSION 18
-#define PROPERTY_ID_DESCRIPTION 19
-#define PROPERTY_ID_DEFAULTVALUE 20
+enum PropertyId
+{
+ PROPERTY_ID_QUERYTIMEOUT = 1,
+ PROPERTY_ID_MAXFIELDSIZE = 2,
+ PROPERTY_ID_MAXROWS = 3,
+ PROPERTY_ID_CURSORNAME = 4,
+ PROPERTY_ID_RESULTSETCONCURRENCY = 5,
+ PROPERTY_ID_RESULTSETTYPE = 6,
+ PROPERTY_ID_FETCHDIRECTION = 7,
+ PROPERTY_ID_FETCHSIZE = 8,
+ PROPERTY_ID_ESCAPEPROCESSING = 9,
+ PROPERTY_ID_USEBOOKMARKS = 10,
-#define PROPERTY_ID_REFERENCEDTABLE 21
-#define PROPERTY_ID_UPDATERULE 22
-#define PROPERTY_ID_DELETERULE 23
-#define PROPERTY_ID_CATALOG 24
-#define PROPERTY_ID_ISUNIQUE 25
-#define PROPERTY_ID_ISPRIMARYKEYINDEX 26
-#define PROPERTY_ID_ISCLUSTERED 27
-#define PROPERTY_ID_ISASCENDING 28
-#define PROPERTY_ID_SCHEMANAME 29
-#define PROPERTY_ID_CATALOGNAME 30
+ // Column
+ PROPERTY_ID_NAME = 11,
+ PROPERTY_ID_TYPE = 12,
+ PROPERTY_ID_TYPENAME = 13,
+ PROPERTY_ID_PRECISION = 14,
+ PROPERTY_ID_SCALE = 15,
+ PROPERTY_ID_ISNULLABLE = 16,
+ PROPERTY_ID_ISAUTOINCREMENT = 17,
+ PROPERTY_ID_ISROWVERSION = 18,
+ PROPERTY_ID_DESCRIPTION = 19,
+ PROPERTY_ID_DEFAULTVALUE = 20,
-#define PROPERTY_ID_COMMAND 31
-#define PROPERTY_ID_CHECKOPTION 32
-#define PROPERTY_ID_PASSWORD 33
-#define PROPERTY_ID_RELATEDCOLUMN 34
+ PROPERTY_ID_REFERENCEDTABLE = 21,
+ PROPERTY_ID_UPDATERULE = 22,
+ PROPERTY_ID_DELETERULE = 23,
+ PROPERTY_ID_CATALOG = 24,
+ PROPERTY_ID_ISUNIQUE = 25,
+ PROPERTY_ID_ISPRIMARYKEYINDEX = 26,
+ PROPERTY_ID_ISCLUSTERED = 27,
+ PROPERTY_ID_ISASCENDING = 28,
+ PROPERTY_ID_SCHEMANAME = 29,
+ PROPERTY_ID_CATALOGNAME = 30,
-#define PROPERTY_ID_FUNCTION 35
-#define PROPERTY_ID_TABLENAME 36
-#define PROPERTY_ID_REALNAME 37
-#define PROPERTY_ID_DBASEPRECISIONCHANGED 38
-#define PROPERTY_ID_ISCURRENCY 39
-#define PROPERTY_ID_ISBOOKMARKABLE 40
+ PROPERTY_ID_COMMAND = 31,
+ PROPERTY_ID_CHECKOPTION = 32,
+ PROPERTY_ID_PASSWORD = 33,
+ PROPERTY_ID_RELATEDCOLUMN = 34,
-#define PROPERTY_ID_INVALID_INDEX 41
-#define PROPERTY_ID_HY010 43
-#define PROPERTY_ID_LABEL 44
-#define PROPERTY_ID_DELIMITER 45
-#define PROPERTY_ID_FORMATKEY 46
-#define PROPERTY_ID_LOCALE 47
-#define PROPERTY_ID_IM001 48
+ PROPERTY_ID_FUNCTION = 35,
+ PROPERTY_ID_TABLENAME = 36,
+ PROPERTY_ID_REALNAME = 37,
+ PROPERTY_ID_DBASEPRECISIONCHANGED = 38,
+ PROPERTY_ID_ISCURRENCY = 39,
+ PROPERTY_ID_ISBOOKMARKABLE = 40,
-#define PROPERTY_ID_AUTOINCREMENTCREATION 49
+ PROPERTY_ID_HY010 = 41,
+ PROPERTY_ID_LABEL = 42,
+ PROPERTY_ID_DELIMITER = 43,
+ PROPERTY_ID_FORMATKEY = 44,
+ PROPERTY_ID_LOCALE = 45,
-#define PROPERTY_ID_PRIVILEGES 50
-#define PROPERTY_ID_HAVINGCLAUSE 51
+ PROPERTY_ID_AUTOINCREMENTCREATION = 46,
-#define PROPERTY_ID_ISSIGNED 52
-#define PROPERTY_ID_AGGREGATEFUNCTION 53
-#define PROPERTY_ID_ISSEARCHABLE 54
+ PROPERTY_ID_PRIVILEGES = 47,
+ PROPERTY_ID_HAVINGCLAUSE = 48,
-#define PROPERTY_ID_APPLYFILTER 55
-#define PROPERTY_ID_FILTER 56
-#define PROPERTY_ID_MASTERFIELDS 57
-#define PROPERTY_ID_DETAILFIELDS 58
-#define PROPERTY_ID_FIELDTYPE 59
-#define PROPERTY_ID_VALUE 60
-#define PROPERTY_ID_ACTIVE_CONNECTION 61
+ PROPERTY_ID_ISSIGNED = 49,
+ PROPERTY_ID_AGGREGATEFUNCTION = 50,
+ PROPERTY_ID_ISSEARCHABLE = 51,
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_PROPERTYIDS_HXX
+ PROPERTY_ID_APPLYFILTER = 52,
+ PROPERTY_ID_FILTER = 53,
+ PROPERTY_ID_MASTERFIELDS = 54,
+ PROPERTY_ID_DETAILFIELDS = 55,
+ PROPERTY_ID_FIELDTYPE = 56,
+ PROPERTY_ID_VALUE = 57,
+ PROPERTY_ID_ACTIVE_CONNECTION = 58
+};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/resource/sharedresources.hxx b/connectivity/source/inc/resource/sharedresources.hxx
index bc4c1aecaa06..0c439cdf24e3 100644
--- a/connectivity/source/inc/resource/sharedresources.hxx
+++ b/connectivity/source/inc/resource/sharedresources.hxx
@@ -17,13 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_RESOURCE_SHAREDRESOURCES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_RESOURCE_SHAREDRESOURCES_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <vector>
#include <connectivity/dbtoolsdllapi.hxx>
-
+#include <unotools/resmgr.hxx>
namespace connectivity
{
@@ -48,7 +47,7 @@ namespace connectivity
*/
OUString
getResourceString(
- const char* pResId
+ TranslateId pResId
) const;
/** loads a string from the shared resource file, and replaces
@@ -66,7 +65,7 @@ namespace connectivity
*/
OUString
getResourceStringWithSubstitution(
- const char* pResId,
+ TranslateId pResId,
const char* _pAsciiPatternToReplace,
const OUString& _rStringToSubstitute
) const;
@@ -90,7 +89,7 @@ namespace connectivity
*/
OUString
getResourceStringWithSubstitution(
- const char* pResId,
+ TranslateId pResId,
const char* _pAsciiPatternToReplace1,
const OUString& _rStringToSubstitute1,
const char* _pAsciiPatternToReplace2,
@@ -120,7 +119,7 @@ namespace connectivity
*/
OUString
getResourceStringWithSubstitution(
- const char* pResId,
+ TranslateId pResId,
const char* _pAsciiPatternToReplace1,
const OUString& _rStringToSubstitute1,
const char* _pAsciiPatternToReplace2,
@@ -139,7 +138,7 @@ namespace connectivity
@return
the string from the resource file, with applied string substitution
*/
- OUString getResourceStringWithSubstitution( const char* pResId,
+ OUString getResourceStringWithSubstitution( TranslateId pResId,
const std::vector< std::pair<const char* , OUString > >& _rStringToSubstitutes) const;
};
@@ -147,6 +146,4 @@ namespace connectivity
} // namespace connectivity
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_RESOURCE_SHAREDRESOURCES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WCatalog.hxx b/connectivity/source/inc/writer/WCatalog.hxx
index 9fb289f2d893..be61dbabd1e0 100644
--- a/connectivity/source/inc/writer/WCatalog.hxx
+++ b/connectivity/source/inc/writer/WCatalog.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
+#pragma once
#include <file/FCatalog.hxx>
@@ -35,6 +34,4 @@ public:
} // namespace connectivity::writer
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WConnection.hxx b/connectivity/source/inc/writer/WConnection.hxx
index 1ae1dac85817..33c6dbb8d115 100644
--- a/connectivity/source/inc/writer/WConnection.hxx
+++ b/connectivity/source/inc/writer/WConnection.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCONNECTION_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCONNECTION_HXX
+#pragma once
#include <memory>
#include <file/FConnection.hxx>
@@ -31,21 +30,17 @@ namespace com::sun::star::text
{
class XTextDocument;
}
-namespace utl
-{
-class CloseVeto;
-}
namespace connectivity::writer
{
class ODriver;
class OWriterConnection : public file::OConnection
{
- // the spreadsheet document:
+ // the text document:
css::uno::Reference<css::text::XTextDocument> m_xDoc;
OUString m_sPassword;
OUString m_aFileName;
- oslInterlockedCount m_nDocCount;
+ oslInterlockedCount m_nDocCount = 0;
class CloseVetoButTerminateListener
: public cppu::WeakComponentImplHelper<css::frame::XTerminateListener>
@@ -152,6 +147,4 @@ public:
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCONNECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WDatabaseMetaData.hxx b/connectivity/source/inc/writer/WDatabaseMetaData.hxx
index c9fdcf9dd9f7..b464be11c46b 100644
--- a/connectivity/source/inc/writer/WDatabaseMetaData.hxx
+++ b/connectivity/source/inc/writer/WDatabaseMetaData.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDATABASEMETADATA_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDATABASEMETADATA_HXX
+#pragma once
#include <component/CDatabaseMetaData.hxx>
@@ -41,6 +40,4 @@ public:
} // namespace connectivity::writer
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDATABASEMETADATA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WDriver.hxx b/connectivity/source/inc/writer/WDriver.hxx
index 361d7f5c2acc..cb5259227ea8 100644
--- a/connectivity/source/inc/writer/WDriver.hxx
+++ b/connectivity/source/inc/writer/WDriver.hxx
@@ -17,16 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDRIVER_HXX
+#pragma once
#include <file/FDriver.hxx>
-namespace com::sun::star::lang
-{
-class XMultiServiceFactory;
-}
-
namespace connectivity::writer
{
class ODriver : public file::OFileDriver
@@ -50,6 +44,4 @@ public:
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDRIVER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WTable.hxx b/connectivity/source/inc/writer/WTable.hxx
index b82ef86647b2..685a098e5025 100644
--- a/connectivity/source/inc/writer/WTable.hxx
+++ b/connectivity/source/inc/writer/WTable.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLE_HXX
+#pragma once
#include <component/CTable.hxx>
@@ -26,10 +25,6 @@ namespace com::sun::star::text
{
class XTextTable;
}
-namespace com::sun::star::util
-{
-class XNumberFormats;
-}
namespace connectivity::writer
{
@@ -41,9 +36,9 @@ class OWriterTable : public OWriterTable_BASE
private:
css::uno::Reference<css::text::XTextTable> m_xTable;
OWriterConnection* m_pWriterConnection;
- sal_Int32 m_nStartCol;
- sal_Int32 m_nDataCols;
- bool m_bHasHeaders;
+ sal_Int32 m_nStartCol = 0;
+ sal_Int32 m_nDataCols = 0;
+ bool m_bHasHeaders = false;
void fillColumns();
@@ -55,15 +50,9 @@ public:
void SAL_CALL disposing() override;
- // css::lang::XUnoTunnel
- sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) override;
- static css::uno::Sequence<sal_Int8> getUnoTunnelId();
-
void construct() override;
};
} // namespace connectivity::writer
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WTables.hxx b/connectivity/source/inc/writer/WTables.hxx
index e83184c82e32..c4be63b90442 100644
--- a/connectivity/source/inc/writer/WTables.hxx
+++ b/connectivity/source/inc/writer/WTables.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLES_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLES_HXX
+#pragma once
#include <file/FTables.hxx>
@@ -29,7 +28,7 @@ using OWriterTables_BASE = file::OTables;
class OWriterTables : public OWriterTables_BASE
{
protected:
- sdbcx::ObjectType createObject(const OUString& rName) override;
+ css::uno::Reference<css::beans::XPropertySet> createObject(const OUString& rName) override;
public:
OWriterTables(const css::uno::Reference<css::sdbc::XDatabaseMetaData>& _rMetaData,
@@ -41,6 +40,4 @@ public:
};
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 0edf495bd8ab..a7d62a34e949 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_fuzzers.h>
#include "mdrivermanager.hxx"
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -26,14 +27,16 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/logging/LogLevel.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
#include <osl/diagnose.h>
+#include <officecfg/Office/DataAccess.hxx>
#include <algorithm>
#include <iterator>
+#include <utility>
#include <vector>
namespace drivermanager
@@ -47,13 +50,7 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::logging;
using namespace ::osl;
-#define SERVICE_SDBC_DRIVER "com.sun.star.sdbc.Driver"
-
-/// @throws NoSuchElementException
-static void throwNoSuchElementException()
-{
- throw NoSuchElementException();
-}
+constexpr OUStringLiteral SERVICE_SDBC_DRIVER = u"com.sun.star.sdbc.Driver";
class ODriverEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
{
@@ -67,7 +64,7 @@ class ODriverEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
protected:
virtual ~ODriverEnumeration() override;
public:
- explicit ODriverEnumeration(const DriverArray& _rDriverSequence);
+ explicit ODriverEnumeration(DriverArray&& _rDriverSequence);
// XEnumeration
virtual sal_Bool SAL_CALL hasMoreElements( ) override;
@@ -75,8 +72,8 @@ public:
};
-ODriverEnumeration::ODriverEnumeration(const DriverArray& _rDriverSequence)
- :m_aDrivers( _rDriverSequence )
+ODriverEnumeration::ODriverEnumeration(DriverArray&& _rDriverSequence)
+ :m_aDrivers( std::move(_rDriverSequence) )
,m_aPos( m_aDrivers.begin() )
{
}
@@ -96,13 +93,13 @@ sal_Bool SAL_CALL ODriverEnumeration::hasMoreElements( )
Any SAL_CALL ODriverEnumeration::nextElement( )
{
if ( !hasMoreElements() )
- throwNoSuchElementException();
+ throw NoSuchElementException();
- return makeAny( *m_aPos++ );
+ return Any( *m_aPos++ );
}
- namespace {
-
+namespace
+{
/// an STL functor which ensures that a SdbcDriver described by a DriverAccess is loaded
struct EnsureDriver
{
@@ -112,23 +109,23 @@ Any SAL_CALL ODriverEnumeration::nextElement( )
const DriverAccess& operator()( const DriverAccess& _rDescriptor ) const
{
// we did not load this driver, yet
- if (!_rDescriptor.xDriver.is())
+ if (_rDescriptor.xDriver.is())
+ return _rDescriptor;
+
+ // we have a factory for it
+ if (_rDescriptor.xComponentFactory.is())
{
- // we have a factory for it
- if (_rDescriptor.xComponentFactory.is())
+ DriverAccess& rDesc = const_cast<DriverAccess&>(_rDescriptor);
+ try
{
- DriverAccess& rDesc = const_cast<DriverAccess&>(_rDescriptor);
- try
- {
- //load driver
- rDesc.xDriver.set(
- rDesc.xComponentFactory->createInstanceWithContext(mxContext), css::uno::UNO_QUERY);
- }
- catch (const Exception&)
- {
- //failure, abandon driver
- rDesc.xComponentFactory.clear();
- }
+ //load driver
+ rDesc.xDriver.set(
+ rDesc.xComponentFactory->createInstanceWithContext(mxContext), css::uno::UNO_QUERY);
+ }
+ catch (const Exception&)
+ {
+ //failure, abandon driver
+ rDesc.xComponentFactory.clear();
}
}
return _rDescriptor;
@@ -156,63 +153,13 @@ Any SAL_CALL ODriverEnumeration::nextElement( )
};
// predicate for checking whether or not a driver accepts a given URL
- class AcceptsURL
- {
- protected:
- const OUString& m_rURL;
-
- public:
- // ctor
- explicit AcceptsURL( const OUString& _rURL ) : m_rURL( _rURL ) { }
-
-
- bool operator()( const Reference<XDriver>& _rDriver ) const
- {
- // ask the driver
- return _rDriver.is() && _rDriver->acceptsURL( m_rURL );
- }
- };
-
- }
-
- static sal_Int32 lcl_getDriverPrecedence( const Reference<XComponentContext>& _rContext, Sequence< OUString >& _rPrecedence )
+ bool AcceptsURL( const OUString& _rURL, const Reference<XDriver>& _rDriver )
{
- _rPrecedence.realloc( 0 );
- try
- {
- // create a configuration provider
- Reference< XMultiServiceFactory > xConfigurationProvider(
- css::configuration::theDefaultProvider::get( _rContext ) );
-
- // one argument for creating the node access: the path to the configuration node
- Sequence< Any > aCreationArgs(1);
- aCreationArgs[0] <<= NamedValue( "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) );
-
- // create the node access
- Reference< XNameAccess > xDriverManagerNode(
- xConfigurationProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aCreationArgs),
- UNO_QUERY);
-
- OSL_ENSURE(xDriverManagerNode.is(), "lcl_getDriverPrecedence: could not open my configuration node!");
- if (xDriverManagerNode.is())
- {
- // obtain the preference list
- Any aPreferences = xDriverManagerNode->getByName("DriverPrecedence");
- bool bSuccess = aPreferences >>= _rPrecedence;
- OSL_ENSURE(bSuccess || !aPreferences.hasValue(), "lcl_getDriverPrecedence: invalid value for the preferences node (no string sequence but not NULL)!");
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("connectivity.manager");
- }
-
- return _rPrecedence.getLength();
+ // ask the driver
+ return _rDriver.is() && _rDriver->acceptsURL( _rURL );
}
- namespace {
-
- /// an STL argorithm compatible predicate comparing two DriverAccess instances by their implementation names
+ /// an STL algorithm compatible predicate comparing two DriverAccess instances by their implementation names
struct CompareDriverAccessByName
{
@@ -222,19 +169,18 @@ Any SAL_CALL ODriverEnumeration::nextElement( )
}
};
- /// and STL argorithm compatible predicate comparing a DriverAccess' impl name to a string
+ /// and an STL algorithm compatible predicate comparing the impl name of a DriverAccess to a string
struct EqualDriverAccessToName
{
OUString m_sImplName;
- explicit EqualDriverAccessToName(const OUString& _sImplName) : m_sImplName(_sImplName){}
+ explicit EqualDriverAccessToName(OUString _sImplName) : m_sImplName(std::move(_sImplName)){}
bool operator()( const DriverAccess& lhs)
{
return lhs.sImplementationName == m_sImplName;
}
};
-
- }
+}
OSDBCDriverManager::OSDBCDriverManager( const Reference< XComponentContext >& _rxContext )
:OSDBCDriverManager_Base(m_aMutex)
@@ -328,6 +274,7 @@ void OSDBCDriverManager::bootstrapDrivers()
void OSDBCDriverManager::initializeDriverPrecedence()
{
+#if !ENABLE_FUZZERS
if ( m_aDriversBS.empty() )
// nothing to do
return;
@@ -335,8 +282,8 @@ void OSDBCDriverManager::initializeDriverPrecedence()
try
{
// get the precedence of the drivers from the configuration
- Sequence< OUString > aDriverOrder;
- if ( 0 == lcl_getDriverPrecedence( m_xContext, aDriverOrder ) )
+ Sequence< OUString > aDriverOrder = officecfg::Office::DataAccess::DriverManager::DriverPrecedence::get();
+ if ( 0 == aDriverOrder.getLength() )
// nothing to do
return;
@@ -360,7 +307,7 @@ void OSDBCDriverManager::initializeDriverPrecedence()
// at the moment this is the first of all drivers we know
// loop through the names in the precedence order
- for ( const OUString& rDriverOrder : std::as_const(aDriverOrder) )
+ for (const OUString& rDriverOrder : aDriverOrder)
{
if (aNoPrefDriversStart == m_aDriversBS.end())
break;
@@ -395,6 +342,7 @@ void OSDBCDriverManager::initializeDriverPrecedence()
{
TOOLS_WARN_EXCEPTION( "connectivity.hsqldb", "OSDBCDriverManager::initializeDriverPrecedence: caught an exception while sorting the drivers!");
}
+#endif
}
@@ -489,7 +437,7 @@ Reference< XEnumeration > SAL_CALL OSDBCDriverManager::createEnumeration( )
ExtractDriverFromCollectionElement() // transformation to apply (extract a driver from a driver access)
);
- return new ODriverEnumeration( aDrivers );
+ return new ODriverEnumeration( std::move(aDrivers) );
}
@@ -508,7 +456,7 @@ sal_Bool SAL_CALL OSDBCDriverManager::hasElements( )
OUString SAL_CALL OSDBCDriverManager::getImplementationName( )
{
- return "com.sun.star.comp.sdbc.OSDBCDriverManager";
+ return u"com.sun.star.comp.sdbc.OSDBCDriverManager"_ustr;
}
sal_Bool SAL_CALL OSDBCDriverManager::supportsService( const OUString& _rServiceName )
@@ -519,7 +467,7 @@ sal_Bool SAL_CALL OSDBCDriverManager::supportsService( const OUString& _rService
Sequence< OUString > SAL_CALL OSDBCDriverManager::getSupportedServiceNames( )
{
- return { "com.sun.star.sdbc.DriverManager" };
+ return { u"com.sun.star.sdbc.DriverManager"_ustr };
}
@@ -528,9 +476,9 @@ Reference< XInterface > SAL_CALL OSDBCDriverManager::getRegisteredObject( const
MutexGuard aGuard(m_aMutex);
DriverCollection::const_iterator aSearch = m_aDriversRT.find(_rName);
if (aSearch == m_aDriversRT.end())
- throwNoSuchElementException();
+ throw NoSuchElementException();
- return aSearch->second.get();
+ return aSearch->second;
}
@@ -570,7 +518,7 @@ void SAL_CALL OSDBCDriverManager::revokeObject( const OUString& _rName )
DriverCollection::iterator aSearch = m_aDriversRT.find(_rName);
if (aSearch == m_aDriversRT.end())
- throwNoSuchElementException();
+ throw NoSuchElementException();
m_aDriversRT.erase(aSearch); // we already have the iterator so we could use it
@@ -607,8 +555,8 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU
{
const OUString sDriverFactoryName = m_aDriverConfig.getDriverFactoryName(_rURL);
- EqualDriverAccessToName aEqual(sDriverFactoryName);
- DriverAccessArray::const_iterator aFind = std::find_if(m_aDriversBS.begin(),m_aDriversBS.end(),aEqual);
+ DriverAccessArray::const_iterator aFind = std::find_if(m_aDriversBS.begin(), m_aDriversBS.end(),
+ EqualDriverAccessToName(sDriverFactoryName));
if ( aFind == m_aDriversBS.end() )
{
// search all bootstrapped drivers
@@ -617,9 +565,16 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU
m_aDriversBS.end(), // end of search range
[&_rURL, this] (const DriverAccessArray::value_type& driverAccess) {
// extract the driver from the access, then ask the resulting driver for acceptance
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-reference"
+#endif
const DriverAccess& ensuredAccess = EnsureDriver(m_xContext)(driverAccess);
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 16
+#pragma GCC diagnostic pop
+#endif
const Reference<XDriver> driver = ExtractDriverFromAccess()(ensuredAccess);
- return AcceptsURL(_rURL)(driver);
+ return AcceptsURL(_rURL, driver);
});
} // if ( m_aDriversBS.find(sDriverFactoryName ) == m_aDriversBS.end() )
else
@@ -642,7 +597,7 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU
[&_rURL] (const DriverCollection::value_type& element) {
// extract the driver from the collection element, then ask the resulting driver for acceptance
const Reference<XDriver> driver = ExtractDriverFromCollectionElement()(element);
- return AcceptsURL(_rURL)(driver);
+ return AcceptsURL(_rURL, driver);
});
if ( m_aDriversRT.end() != aPos )
@@ -658,8 +613,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
connectivity_OSDBCDriverManager_get_implementation(
css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
- return cppu::acquire(
- static_cast<cppu::OWeakObject*>(new drivermanager::OSDBCDriverManager(context)));
+ return cppu::acquire(new drivermanager::OSDBCDriverManager(context));
}
diff --git a/connectivity/source/manager/mdrivermanager.hxx b/connectivity/source/manager/mdrivermanager.hxx
index ec72df370dd4..239116f1ccc7 100644
--- a/connectivity/source/manager/mdrivermanager.hxx
+++ b/connectivity/source/manager/mdrivermanager.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_MANAGER_MDRIVERMANAGER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_MANAGER_MDRIVERMANAGER_HXX
+#pragma once
#include <sal/config.h>
@@ -118,7 +117,5 @@ namespace drivermanager
} // namespace drivermanager
-#endif // INCLUDED_CONNECTIVITY_SOURCE_MANAGER_MDRIVERMANAGER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx
index cf9b17ee51df..29763c2dd438 100644
--- a/connectivity/source/parse/PColumn.cxx
+++ b/connectivity/source/parse/PColumn.cxx
@@ -109,7 +109,7 @@ OParseColumn::OParseColumn( const OUString& Name,
StringMap aColumnMap;
for ( sal_Int32 i = 1; i <= nColumnCount; ++i )
{
- OParseColumn* pColumn = createColumnForResultSet( _rxResMetaData, _rxDBMetaData, i,aColumnMap );
+ rtl::Reference<OParseColumn> pColumn = createColumnForResultSet( _rxResMetaData, _rxDBMetaData, i,aColumnMap );
aReturn->push_back( pColumn );
if ( i_xQueryColumns.is() && i_xQueryColumns->hasByName(pColumn->getRealName()) )
{
@@ -125,7 +125,7 @@ OParseColumn::OParseColumn( const OUString& Name,
}
-OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSetMetaData >& _rxResMetaData,
+rtl::Reference<OParseColumn> OParseColumn::createColumnForResultSet( const Reference< XResultSetMetaData >& _rxResMetaData,
const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos, StringMap& _rColumns )
{
OUString sLabel = _rxResMetaData->getColumnLabel( _nColumnPos );
@@ -142,7 +142,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe
sLabel = sAlias;
}
_rColumns.emplace(sLabel,0);
- OParseColumn* pColumn = new OParseColumn(
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(
sLabel,
_rxResMetaData->getColumnTypeName( _nColumnPos ),
OUString(),
@@ -264,7 +264,7 @@ void OOrderColumn::construct()
css::uno::Sequence< OUString > SAL_CALL OOrderColumn::getSupportedServiceNames( )
{
- return { "com.sun.star.sdb.OrderColumn" };
+ return { u"com.sun.star.sdb.OrderColumn"_ustr };
}
diff --git a/connectivity/source/parse/internalnode.cxx b/connectivity/source/parse/internalnode.cxx
index 1906ad3d4625..9b7849345556 100644
--- a/connectivity/source/parse/internalnode.cxx
+++ b/connectivity/source/parse/internalnode.cxx
@@ -28,7 +28,7 @@ OSQLInternalNode::OSQLInternalNode(const char* pNewValue,
sal_uInt32 nNodeID)
: OSQLParseNode(pNewValue,eNodeType,nNodeID)
{
- OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
+ assert(OSQLParser::s_pGarbageCollector && "Collector not initialized");
(*OSQLParser::s_pGarbageCollector)->push_back(this);
}
@@ -38,26 +38,23 @@ OSQLInternalNode::OSQLInternalNode(std::string_view NewValue,
sal_uInt32 nNodeID)
:OSQLParseNode(NewValue,eNodeType,nNodeID)
{
- OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
+ assert(OSQLParser::s_pGarbageCollector && "Collector not initialized");
(*OSQLParser::s_pGarbageCollector)->push_back(this);
}
-
OSQLInternalNode::OSQLInternalNode(const OUString &NewValue,
SQLNodeType eNodeType,
sal_uInt32 nNodeID)
:OSQLParseNode(NewValue,eNodeType,nNodeID)
{
- OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
+ assert(OSQLParser::s_pGarbageCollector && "Collector not initialized");
(*OSQLParser::s_pGarbageCollector)->push_back(this);
}
-
OSQLInternalNode::~OSQLInternalNode()
{
// remove the node from the garbage list
-
- OSL_ENSURE(OSQLParser::s_pGarbageCollector, "Collector not initialized");
+ assert(OSQLParser::s_pGarbageCollector && "Collector not initialized");
(*OSQLParser::s_pGarbageCollector)->erase(this);
}
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index d14f36e7794f..9b125768d260 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -44,7 +44,6 @@
#include <osl/diagnose.h>
#include "connectivity/dbconversion.hxx"
#include <rtl/ustrbuf.hxx>
-#include <sal/macros.h>
#include <sal/log.hxx>
#if defined _MSC_VER
@@ -74,9 +73,15 @@ inline connectivity::OSQLInternalNode* newNode(const OUString& _newValue,
// yyi is the internal number of the rule that is currently being reduced
// This can be mapped to external rule number via the yyrmap.
+#if defined YYBISON && YYBISON >= 30800
+#define SQL_NEW_RULE newNode("", SQLNodeType::Rule, yyr1[yyrule])
+#define SQL_NEW_LISTRULE newNode("", SQLNodeType::ListRule, yyr1[yyrule])
+#define SQL_NEW_COMMALISTRULE newNode("", SQLNodeType::CommaListRule, yyr1[yyrule])
+#else
#define SQL_NEW_RULE newNode("", SQLNodeType::Rule, yyr1[yyn])
#define SQL_NEW_LISTRULE newNode("", SQLNodeType::ListRule, yyr1[yyn])
#define SQL_NEW_COMMALISTRULE newNode("", SQLNodeType::CommaListRule, yyr1[yyn])
+#endif
extern connectivity::OSQLParser* xxx_pGLOBAL_SQLPARSER;
@@ -151,6 +156,7 @@ using namespace connectivity;
%token <pParseNode> SQL_TOKEN_DAYNAME SQL_TOKEN_DAYOFMONTH SQL_TOKEN_DAYOFWEEK SQL_TOKEN_DAYOFYEAR SQL_TOKEN_EXTRACT
%token <pParseNode> SQL_TOKEN_HOUR SQL_TOKEN_MILLISECOND SQL_TOKEN_MINUTE SQL_TOKEN_MONTH SQL_TOKEN_MONTHNAME SQL_TOKEN_NOW SQL_TOKEN_QUARTER SQL_TOKEN_DATEDIFF
%token <pParseNode> SQL_TOKEN_SECOND SQL_TOKEN_TIMESTAMPADD SQL_TOKEN_TIMESTAMPDIFF SQL_TOKEN_TIMEVALUE SQL_TOKEN_WEEK SQL_TOKEN_WEEKDAY SQL_TOKEN_YEAR SQL_TOKEN_YEARDAY
+%token <pParseNode> SQL_TOKEN_DATEADD
/* numeric functions */
%token <pParseNode> SQL_TOKEN_ABS SQL_TOKEN_ACOS SQL_TOKEN_ASIN SQL_TOKEN_ATAN SQL_TOKEN_ATAN2 SQL_TOKEN_CEILING
@@ -213,7 +219,7 @@ using namespace connectivity;
%type <pParseNode> like_predicate opt_escape test_for_null null_predicate_part_2 in_predicate in_predicate_part_2 character_like_predicate_part_2 other_like_predicate_part_2
%type <pParseNode> all_or_any_predicate any_all_some existence_test subquery quantified_comparison_predicate_part_2
%type <pParseNode> scalar_exp_commalist parameter_ref literal parenthesized_boolean_value_expression
-%type <pParseNode> column_ref data_type column cursor parameter range_variable user /*like_check*/
+%type <pParseNode> column_ref data_type column cursor parameter range_variable user /*like_check*/ datetime_unit
/* new rules at OJ */
%type <pParseNode> derived_column as_clause table_name num_primary term num_value_exp
%type <pParseNode> value_exp_primary num_value_fct unsigned_value_spec cast_spec set_fct_spec scalar_subquery
@@ -318,7 +324,7 @@ schema:
opt_schema_element_list:
{$$ = SQL_NEW_RULE;}
- | schema_glement_list
+ | schema_element_list
;
schema_element_list:
@@ -1973,6 +1979,7 @@ date_function_1Argument:
date_function:
SQL_TOKEN_TIMESTAMPADD
| SQL_TOKEN_TIMESTAMPDIFF
+ | SQL_TOKEN_DATEADD
;
numeric_function_0Argument:
SQL_TOKEN_PI
@@ -2952,11 +2959,27 @@ interval_value_exp:
*/
non_second_datetime_field:
SQL_TOKEN_YEAR
+ | SQL_TOKEN_YEARDAY
| SQL_TOKEN_MONTH
+ | SQL_TOKEN_WEEK
+ | SQL_TOKEN_WEEKDAY
| SQL_TOKEN_DAY
| SQL_TOKEN_HOUR
| SQL_TOKEN_MINUTE
+ | SQL_TOKEN_MILLISECOND
;
+
+datetime_unit:
+ SQL_TOKEN_YEAR
+ | SQL_TOKEN_MONTH
+ | SQL_TOKEN_WEEK
+ | SQL_TOKEN_DAY
+ | SQL_TOKEN_HOUR
+ | SQL_TOKEN_MINUTE
+ | SQL_TOKEN_SECOND
+ | SQL_TOKEN_MILLISECOND
+ ;
+
start_field:
non_second_datetime_field opt_paren_precision
{
@@ -3088,6 +3111,13 @@ function_args_commalist:
else
YYERROR;
}
+ | datetime_unit ',' function_arg ',' function_arg
+ {
+ $$ = SQL_NEW_COMMALISTRULE;
+ $$->append($1);
+ $$->append($3);
+ $$->append($5);
+ }
;
value_exp:
@@ -4376,7 +4406,7 @@ OString OParseContext::getIntlKeywordAscii(InternationalKeyCode _eKey) const
IParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const OString& rToken) const
{
- static IParseContext::InternationalKeyCode Intl_TokenID[] =
+ static IParseContext::InternationalKeyCode const Intl_TokenID[] =
{
InternationalKeyCode::Like, InternationalKeyCode::Not, InternationalKeyCode::Null, InternationalKeyCode::True,
InternationalKeyCode::False, InternationalKeyCode::Is, InternationalKeyCode::Between, InternationalKeyCode::Or,
@@ -4386,15 +4416,14 @@ IParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const OString&
InternationalKeyCode::VarPop,InternationalKeyCode::Collect,InternationalKeyCode::Fusion,InternationalKeyCode::Intersection
};
- sal_uInt32 nCount = SAL_N_ELEMENTS( Intl_TokenID );
- for (sal_uInt32 i = 0; i < nCount; i++)
- {
- OString aKey = getIntlKeywordAscii(Intl_TokenID[i]);
- if (rToken.equalsIgnoreAsciiCase(aKey))
- return Intl_TokenID[i];
- }
+ auto const token = std::find_if(std::cbegin(Intl_TokenID), std::cend(Intl_TokenID)
+ , [&rToken, this](IParseContext::InternationalKeyCode const & tokenID)
+ { return rToken.equalsIgnoreAsciiCase(getIntlKeywordAscii(tokenID)); });
+
+ if (std::cend(Intl_TokenID) != token)
+ return *token;
- return InternationalKeyCode::None;
+ return InternationalKeyCode::None;
}
@@ -4489,7 +4518,6 @@ sal_Int32 OSQLParser::s_nRefCount = 0;
// ::osl::Mutex OSQLParser::s_aMutex;
OSQLScanner* OSQLParser::s_pScanner = nullptr;
OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = nullptr;
-css::uno::Reference< css::i18n::XLocaleData4> OSQLParser::s_xLocaleData = nullptr;
void setParser(OSQLParser* _pParser)
{
@@ -4498,7 +4526,6 @@ void setParser(OSQLParser* _pParser)
void OSQLParser::setParseTree(OSQLParseNode* pNewParseTree)
{
- ::osl::MutexGuard aGuard(getMutex());
m_pParseTree.reset(pNewParseTree);
}
@@ -4570,7 +4597,7 @@ std::unique_ptr<OSQLParseNode> OSQLParser::parseTree(OUString& rErrorMessage,
// Guard the parsing
- ::osl::MutexGuard aGuard(getMutex());
+ std::unique_lock aGuard(getMutex());
// must be reset
setParser(this);
@@ -4599,7 +4626,8 @@ std::unique_ptr<OSQLParseNode> OSQLParser::parseTree(OUString& rErrorMessage,
// clear the garbage collector
(*s_pGarbageCollector)->clearAndDelete();
- m_pParseTree.release(); // because the garbage collector deleted it
+ // coverity[leaked_storage : FALSE] - because the garbage collector deleted it
+ m_pParseTree.release();
return nullptr;
}
else
@@ -4645,6 +4673,7 @@ OString OSQLParser::TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pCont
if (aStr.isEmpty())
{
+ // coverity[unsigned_compare : SUPPRESS] - YYTRANSLATE is out of our control
aStr = yytname[YYTRANSLATE(nTokenID)];
if(aStr.startsWith("SQL_TOKEN_"))
aStr = aStr.copy(10);
@@ -4663,7 +4692,7 @@ OString OSQLParser::TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pCont
#if OSL_DEBUG_LEVEL > 0
OUString OSQLParser::RuleIDToStr(sal_uInt32 nRuleID)
{
- OSL_ENSURE(nRuleID < SAL_N_ELEMENTS(yytname), "OSQLParser::RuleIDToStr: Invalid nRuleId!");
+ OSL_ENSURE(nRuleID < std::size(yytname), "OSQLParser::RuleIDToStr: Invalid nRuleId!");
return OUString::createFromAscii(yytname[nRuleID]);
}
#endif
@@ -4673,8 +4702,8 @@ sal_uInt32 OSQLParser::StrToRuleID(const OString & rValue)
{
// Search for the given name in yytname and return the index
// (or UNKNOWN_RULE, if not found)
- static sal_uInt32 nLen = SAL_N_ELEMENTS(yytname);
- for (sal_uInt32 i = YYTRANSLATE(SQL_TOKEN_INVALIDSYMBOL); i < (nLen-1); i++)
+ static sal_uInt32 const nLen = std::size(yytname)-1;
+ for (sal_uInt32 i = YYTRANSLATE(SQL_TOKEN_INVALIDSYMBOL); i < nLen; ++i)
{
if (rValue == yytname[i])
return i;
@@ -4743,8 +4772,7 @@ sal_Int16 OSQLParser::buildStringNodes(OSQLParseNode*& pLiteral)
OSQLParseNode* pParent = pLiteral->getParent();
OSQLParseNode* pNewNode = new OSQLInternalNode(pLiteral->getTokenValue(), SQLNodeType::String);
- pParent->replace(pLiteral, pNewNode);
- delete pLiteral;
+ pParent->replaceAndDelete(pLiteral, pNewNode);
pLiteral = nullptr;
return 1;
}
@@ -4802,12 +4830,11 @@ void OSQLParser::error(const char *fmt)
sal_Int32 nPos2 = sStr.indexOf(sSQL_TOKEN,nPos1+1);
if(nPos2 != -1)
{
- OUString sSecond = sStr.copy(nPos1+sSQL_TOKEN.getLength(),nPos2-nPos1-sSQL_TOKEN.getLength());
- sFirst += sSecond;
- sFirst += sStr.copy(nPos2+sSQL_TOKEN.getLength());
+ sFirst += sStr.subView(nPos1+sSQL_TOKEN.getLength(),nPos2-nPos1-sSQL_TOKEN.getLength());
+ sFirst += sStr.subView(nPos2+sSQL_TOKEN.getLength());
}
else
- sFirst += sStr.copy(nPos1+sSQL_TOKEN.getLength());
+ sFirst += sStr.subView(nPos1+sSQL_TOKEN.getLength());
m_sErrorMessage = sFirst;
}
diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l
index 34a4067ea21c..44daeb236bf7 100644
--- a/connectivity/source/parse/sqlflex.l
+++ b/connectivity/source/parse/sqlflex.l
@@ -186,6 +186,7 @@ CURSOR {SQL_NEW_KEYWORD(SQL_TOKEN_CURSOR); }
D {SQL_NEW_KEYWORD(SQL_TOKEN_D); }
DATE {SQL_NEW_KEYWORD(SQL_TOKEN_DATE); }
+DATEADD {SQL_NEW_KEYWORD(SQL_TOKEN_DATEADD); }
DATEDIFF {SQL_NEW_KEYWORD(SQL_TOKEN_DATEDIFF); }
DATEVALUE {SQL_NEW_KEYWORD(SQL_TOKEN_DATEVALUE); }
DAY {SQL_NEW_KEYWORD(SQL_TOKEN_DAY); }
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 766dcf3b8198..4e322731a146 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -32,15 +32,17 @@
#include <iostream>
#endif
#include <connectivity/PColumn.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <TConnection.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbmetadata.hxx>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
+#include <o3tl/safeint.hxx>
#include <sal/log.hxx>
#include <iterator>
#include <memory>
+#include <utility>
using namespace ::comphelper;
using namespace ::connectivity;
@@ -82,8 +84,8 @@ namespace connectivity
m_xDatabaseMetaData = m_xConnection->getMetaData();
m_bIsCaseSensitive = m_xDatabaseMetaData.is() && m_xDatabaseMetaData->supportsMixedCaseQuotedIdentifiers();
- m_pTables = std::make_shared<OSQLTables>( m_bIsCaseSensitive );
- m_pSubTables = std::make_shared<OSQLTables>( m_bIsCaseSensitive );
+ m_pTables = std::make_shared<OSQLTables>( UStringMixLess(m_bIsCaseSensitive) );
+ m_pSubTables = std::make_shared<OSQLTables>( UStringMixLess(m_bIsCaseSensitive) );
m_xTableContainer = _rxTables;
@@ -119,9 +121,9 @@ namespace connectivity
OUString m_sForbiddenQueryName;
public:
- ForbidQueryName( OSQLParseTreeIteratorImpl& _rIteratorImpl, const OUString& _rForbiddenQueryName )
+ ForbidQueryName( OSQLParseTreeIteratorImpl& _rIteratorImpl, OUString _aForbiddenQueryName )
:m_rpAllForbiddenNames( _rIteratorImpl.m_pForbiddenQueryNames )
- ,m_sForbiddenQueryName( _rForbiddenQueryName )
+ ,m_sForbiddenQueryName(std::move( _aForbiddenQueryName ))
{
if ( !m_rpAllForbiddenNames )
m_rpAllForbiddenNames = std::make_shared<QueryNameSet>();
@@ -264,20 +266,17 @@ namespace
{
OUString sComposedName;
- static constexpr OUStringLiteral s_sWildcard = u"%" ;
+ static constexpr OUString s_sWildcard = u"%"_ustr ;
// we want all catalogues, all schemas, all tables
- Sequence< OUString > sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = s_sWildcard; // just to be sure to include anything else...
+ Sequence< OUString > sTableTypes { u"VIEW"_ustr, u"TABLE"_ustr, s_sWildcard }; // this last one just to be sure to include anything else...
if ( _rxDBMeta.is() )
{
sComposedName.clear();
Reference< XResultSet> xRes = _rxDBMeta->getTables(
- !_rCatalog.isEmpty() ? makeAny( _rCatalog ) : Any(), !_rSchema.isEmpty() ? _rSchema : s_sWildcard, _rTableName, sTableTypes );
+ !_rCatalog.isEmpty() ? Any( _rCatalog ) : Any(), !_rSchema.isEmpty() ? _rSchema : s_sWildcard, _rTableName, sTableTypes );
Reference< XRow > xCurrentRow( xRes, UNO_QUERY );
if ( xCurrentRow.is() && xRes->next() )
@@ -456,7 +455,7 @@ void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQ
// get the object representing this table/query
OSQLTable aTable = impl_locateRecordSource( aComposedName );
if ( aTable.is() )
- _rTables[ aTableRange ] = aTable;
+ _rTables[ aTableRange ] = std::move(aTable);
}
void OSQLParseTreeIterator::impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition)
@@ -526,7 +525,7 @@ void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLP
{
const OSQLParseNode * pCol = pColumnCommalist->getChild(i);
// add twice because the column must exists in both tables
- m_pImpl->m_aJoinConditions.push_back( TNodePair(pCol,pCol) );
+ m_pImpl->m_aJoinConditions.emplace_back(pCol,pCol);
}
}
}
@@ -611,7 +610,7 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLP
}
OSQLParseNode * pTableRefCommalist = pSelect->getChild(3)->getChild(0)->getChild(1);
- OSL_ENSURE(pTableRefCommalist != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pTableRefCommalist != nullptr && "OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableRefCommalist,table_ref_commalist),"OSQLParseTreeIterator: error in parse tree!");
const OSQLParseNode* pTableName = nullptr;
@@ -820,14 +819,13 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo
if (!aTypeName.isEmpty())
{
//TODO:Create a new class for create statement to handle field length
- OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,OUString(),OUString(),
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(aColumnName,aTypeName,OUString(),OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,nType,false,false,isCaseSensitive(),
OUString(),OUString(),OUString());
pColumn->setFunction(false);
pColumn->setRealName(aColumnName);
- Reference< XPropertySet> xCol = pColumn;
- m_aCreateColumns->push_back(xCol);
+ m_aCreateColumns->push_back(pColumn);
}
}
@@ -855,7 +853,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
if (pSelectNode->getChild(2)->isRule() && SQL_ISPUNCTUATION(pSelectNode->getChild(2)->getChild(0),"*"))
{
// SELECT * ...
- setSelectColumnName(m_aSelectColumns, "*", "", "");
+ setSelectColumnName(u"*"_ustr, u""_ustr, u""_ustr);
}
else if (SQL_ISRULE(pSelectNode->getChild(2),scalar_exp_commalist))
{
@@ -875,7 +873,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
// All the table's columns
OUString aTableRange;
pColumnRef->getChild(0)->parseNodeToStr( aTableRange, m_pImpl->m_xConnection, nullptr, false, false );
- setSelectColumnName(m_aSelectColumns, "*", "", aTableRange);
+ setSelectColumnName(u"*"_ustr, u""_ustr, aTableRange);
continue;
}
else if (SQL_ISRULE(pColumnRef,derived_column))
@@ -927,7 +925,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
*/
if(aColumnAlias.isEmpty())
aColumnAlias = sColumnName;
- setSelectColumnName(m_aSelectColumns,sColumnName,aColumnAlias,aTableRange,bFkt,nType,SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec));
+ setSelectColumnName(sColumnName,aColumnAlias,aTableRange,bFkt,nType,SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec));
}
}
}
@@ -967,21 +965,21 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo
OSL_ENSURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
- OSL_ENSURE(pTableExp != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pTableExp != nullptr && "OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
sal_uInt32 nPos = ( _bOrder ? ORDER_BY_CHILD_POS : 2 );
OSQLParseNode * pOptByClause = pTableExp->getChild(nPos);
- OSL_ENSURE(pOptByClause != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pOptByClause != nullptr && "OSQLParseTreeIterator: error in parse tree!");
if ( pOptByClause->count() == 0 )
return;
OSL_ENSURE(pOptByClause->count() == 3,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pOrderingSpecCommalist = pOptByClause->getChild(2);
- OSL_ENSURE(pOrderingSpecCommalist != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pOrderingSpecCommalist != nullptr && "OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(!_bOrder || SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OSQLParseTreeIterator:ordering_spec_commalist error in parse tree!");
OSL_ENSURE(pOrderingSpecCommalist->count() > 0,"OSQLParseTreeIterator: error in parse tree!");
@@ -991,7 +989,7 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo
for (sal_uInt32 i = 0; i < nCount; ++i)
{
OSQLParseNode* pColumnRef = pOrderingSpecCommalist->getChild(i);
- OSL_ENSURE(pColumnRef != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pColumnRef != nullptr && "OSQLParseTreeIterator: error in parse tree!");
if ( _bOrder )
{
OSL_ENSURE(SQL_ISRULE(pColumnRef,ordering_spec),"OSQLParseTreeIterator:ordering_spec error in parse tree!");
@@ -999,7 +997,7 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo
pColumnRef = pColumnRef->getChild(0);
}
- OSL_ENSURE(pColumnRef != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pColumnRef != nullptr && "OSQLParseTreeIterator: error in parse tree!");
aTableRange.clear();
sColumnName.clear();
if ( SQL_ISRULE(pColumnRef,column_ref) )
@@ -1037,7 +1035,7 @@ namespace
{
OUString lcl_generateParameterName( const OSQLParseNode& _rParentNode, const OSQLParseNode& _rParamNode )
{
- OUString sColumnName( "param" );
+ OUString sColumnName( u"param"_ustr );
const sal_Int32 nCount = static_cast<sal_Int32>(_rParentNode.count());
for ( sal_Int32 i = 0; i < nCount; ++i )
{
@@ -1125,7 +1123,7 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele
OSL_ENSURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
- OSL_ENSURE(pTableExp != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pTableExp != nullptr && "OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
@@ -1218,13 +1216,13 @@ void OSQLParseTreeIterator::traverseSearchCondition(OSQLParseNode const * pSearc
OSL_ENSURE(pSearchCondition->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
const OSQLParseNode* pPart2 = pSearchCondition->getChild(1);
- sal_Int32 nCurentPos = pPart2->count()-2;
+ sal_Int32 nCurrentPos = pPart2->count()-2;
- OSQLParseNode * pNum_value_exp = pPart2->getChild(nCurentPos);
- OSQLParseNode * pOptEscape = pPart2->getChild(nCurentPos+1);
+ OSQLParseNode * pNum_value_exp = pPart2->getChild(nCurrentPos);
+ OSQLParseNode * pOptEscape = pPart2->getChild(nCurrentPos+1);
- OSL_ENSURE(pNum_value_exp != nullptr,"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pOptEscape != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pNum_value_exp != nullptr && "OSQLParseTreeIterator: error in parse tree!");
+ assert(pOptEscape != nullptr && "OSQLParseTreeIterator: error in parse tree!");
if (pOptEscape->count() != 0)
{
@@ -1315,7 +1313,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
? _rColumnAlias
: !_aColumnName.isEmpty()
? _aColumnName
- : OUString("?");
+ : u"?"_ustr;
}
else if (SQL_ISPUNCTUATION(pMark,":"))
{
@@ -1344,7 +1342,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
}
sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pParentNode->getChild(0)->getTokenID(), i-1);
- OParseColumn* pColumn = new OParseColumn( sParameterName,
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn( sParameterName,
OUString(),
OUString(),
OUString(),
@@ -1373,7 +1371,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
);
if(aIter != m_aSelectColumns->end())
{
- OParseColumn* pNewColumn = new OParseColumn(*aIter,isCaseSensitive());
+ rtl::Reference<OParseColumn> pNewColumn = new OParseColumn(*aIter,isCaseSensitive());
pNewColumn->setName(sParameterName);
pNewColumn->setRealName(_aColumnName);
m_aParameters->push_back(pNewColumn);
@@ -1386,7 +1384,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
if ( xColumn.is() )
{
- OParseColumn* pNewColumn = new OParseColumn(xColumn,isCaseSensitive());
+ rtl::Reference<OParseColumn> pNewColumn = new OParseColumn(xColumn,isCaseSensitive());
pNewColumn->setName(sParameterName);
pNewColumn->setRealName(_aColumnName);
m_aParameters->push_back(pNewColumn);
@@ -1409,9 +1407,9 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
nType = ::connectivity::OSQLParser::getFunctionParameterType( pParent->getChild(0)->getTokenID(), i+1);
}
- OUString aNewColName( getUniqueColumnName( sParameterName ) );
+ OUString aNewColName(getUniqueColumnName(getSelectColumnNames(), sParameterName));
- OParseColumn* pColumn = new OParseColumn(aNewColName,
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(aNewColName,
OUString(),
OUString(),
OUString(),
@@ -1518,15 +1516,15 @@ OSQLTable OSQLParseTreeIterator::impl_createTableObject( const OUString& rTableN
nullptr,
false,
rTableName,
- "Table",
- "New Created Table",
+ u"Table"_ustr,
+ u"New Created Table"_ustr,
rSchemaName,
rCatalogName
);
return aReturnTable;
}
-void OSQLParseTreeIterator::appendColumns(::rtl::Reference<OSQLColumns> const & _rColumns,const OUString& _rTableAlias,const OSQLTable& _rTable)
+void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OSQLTable& _rTable)
{
if (!_rTable.is())
return;
@@ -1535,18 +1533,16 @@ void OSQLParseTreeIterator::appendColumns(::rtl::Reference<OSQLColumns> const &
if ( !xColumns.is() )
return;
- Sequence< OUString > aColNames = xColumns->getElementNames();
- const OUString* pBegin = aColNames.getConstArray();
- const OUString* pEnd = pBegin + aColNames.getLength();
+ ::comphelper::UStringMixLess aCompare(isCaseSensitive());
+ std::vector<OUString> aSelectColumnNames = getSelectColumnNames();
- for(;pBegin != pEnd;++pBegin)
+ for (auto& colName : xColumns->getElementNames())
{
-
- OUString aName(getUniqueColumnName(*pBegin));
+ OUString aName(getUniqueColumnName(aSelectColumnNames, colName));
Reference< XPropertySet > xColumn;
- if(xColumns->hasByName(*pBegin) && (xColumns->getByName(*pBegin) >>= xColumn) && xColumn.is())
+ if(xColumns->hasByName(colName) && (xColumns->getByName(colName) >>= xColumn) && xColumn.is())
{
- OParseColumn* pColumn = new OParseColumn(aName
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(aName
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION)))
@@ -1562,37 +1558,36 @@ void OSQLParseTreeIterator::appendColumns(::rtl::Reference<OSQLColumns> const &
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))));
pColumn->setTableName(_rTableAlias);
- pColumn->setRealName(*pBegin);
- Reference< XPropertySet> xCol = pColumn;
- _rColumns->push_back(xCol);
+ pColumn->setRealName(colName);
+ m_aSelectColumns->push_back(pColumn);
+ // update aSelectColumnNames with newly insert aName
+ aSelectColumnNames.insert(std::upper_bound(aSelectColumnNames.begin(), aSelectColumnNames.end(), aName, aCompare), aName);
}
else
- impl_appendError( IParseContext::ErrorCode::InvalidColumn, pBegin, &_rTableAlias );
+ impl_appendError(IParseContext::ErrorCode::InvalidColumn, &colName, &_rTableAlias);
}
}
-void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> const & _rColumns,const OUString & rColumnName,const OUString & rColumnAlias, const OUString & rTableRange, bool bFkt, sal_Int32 _nType, bool bAggFkt)
+void OSQLParseTreeIterator::setSelectColumnName(const OUString & rColumnName,const OUString & rColumnAlias, const OUString & rTableRange, bool bFkt, sal_Int32 _nType, bool bAggFkt)
{
if(rColumnName.toChar() == '*' && rTableRange.isEmpty())
{ // SELECT * ...
- OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
for (auto const& table : *m_pImpl->m_pTables)
- appendColumns(_rColumns,table.first,table.second);
+ appendColumns(table.first, table.second);
}
else if( rColumnName.toChar() == '*' && !rTableRange.isEmpty() )
{ // SELECT <table>.*
- OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
OSQLTables::const_iterator aFind = m_pImpl->m_pTables->find(rTableRange);
if(aFind != m_pImpl->m_pTables->end())
- appendColumns(_rColumns,rTableRange,aFind->second);
+ appendColumns(rTableRange, aFind->second);
}
else if ( rTableRange.isEmpty() )
{ // SELECT <something> ...
// without table specified
if ( !bFkt )
{
- Reference< XPropertySet> xNewColumn;
+ rtl::Reference< OParseColumn> xNewColumn;
for (auto const& table : *m_pImpl->m_pTables)
{
@@ -1606,9 +1601,9 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
)
continue;
- OUString aNewColName(getUniqueColumnName(rColumnAlias));
+ OUString aNewColName(getUniqueColumnName(getSelectColumnNames(), rColumnAlias));
- OParseColumn* pColumn = new OParseColumn(xColumn,isCaseSensitive());
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(xColumn,isCaseSensitive());
xNewColumn = pColumn;
pColumn->setTableName(table.first);
pColumn->setName(aNewColName);
@@ -1621,11 +1616,11 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
{
// no function (due to the above !bFkt), no existing column
// => assume an expression
- OUString aNewColName( getUniqueColumnName( rColumnAlias ) );
+ OUString aNewColName(getUniqueColumnName(getSelectColumnNames(), rColumnAlias));
// did not find a column with this name in any of the tables
- OParseColumn* pColumn = new OParseColumn(
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(
aNewColName,
- "VARCHAR",
+ u"VARCHAR"_ustr,
// TODO: does this match with _nType?
// Or should be fill this from the getTypeInfo of the connection?
OUString(),
@@ -1646,21 +1641,20 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
pColumn->setRealName( rColumnName );
}
- _rColumns->push_back( xNewColumn );
+ m_aSelectColumns->push_back( xNewColumn );
}
else
{
- OUString aNewColName(getUniqueColumnName(rColumnAlias));
+ OUString aNewColName(getUniqueColumnName(getSelectColumnNames(), rColumnAlias));
- OParseColumn* pColumn = new OParseColumn(aNewColName,OUString(),OUString(),OUString(),
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(aNewColName,OUString(),OUString(),OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,false,false,isCaseSensitive(),
OUString(),OUString(),OUString());
pColumn->setFunction(true);
pColumn->setAggregateFunction(bAggFkt);
pColumn->setRealName(rColumnName);
- Reference< XPropertySet> xCol = pColumn;
- _rColumns->push_back(xCol);
+ m_aSelectColumns->push_back(pColumn);
}
}
else // ColumnName and TableName exist
@@ -1672,9 +1666,9 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
{
if (bFkt)
{
- OUString aNewColName(getUniqueColumnName(rColumnAlias));
+ OUString aNewColName(getUniqueColumnName(getSelectColumnNames(), rColumnAlias));
- OParseColumn* pColumn = new OParseColumn(aNewColName,OUString(),OUString(),OUString(),
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(aNewColName,OUString(),OUString(),OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,false,false,isCaseSensitive(),
OUString(),OUString(),OUString());
pColumn->setFunction(true);
@@ -1684,23 +1678,21 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
assert(false);
pColumn->setTableName(aFind->first);
- Reference< XPropertySet> xCol = pColumn;
- _rColumns->push_back(xCol);
+ m_aSelectColumns->push_back(pColumn);
}
else
{
Reference< XPropertySet > xColumn;
if (aFind->second->getColumns()->hasByName(rColumnName) && (aFind->second->getColumns()->getByName(rColumnName) >>= xColumn))
{
- OUString aNewColName(getUniqueColumnName(rColumnAlias));
+ OUString aNewColName(getUniqueColumnName(getSelectColumnNames(), rColumnAlias));
- OParseColumn* pColumn = new OParseColumn(xColumn,isCaseSensitive());
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(xColumn,isCaseSensitive());
pColumn->setName(aNewColName);
pColumn->setRealName(rColumnName);
pColumn->setTableName(aFind->first);
- Reference< XPropertySet> xCol = pColumn;
- _rColumns->push_back(xCol);
+ m_aSelectColumns->push_back(pColumn);
}
else
bError = true;
@@ -1712,41 +1704,45 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
// Table does not exist or lacking field
if (bError)
{
- OUString aNewColName(getUniqueColumnName(rColumnAlias));
+ OUString aNewColName(getUniqueColumnName(getSelectColumnNames(), rColumnAlias));
- OParseColumn* pColumn = new OParseColumn(aNewColName,OUString(),OUString(),OUString(),
+ rtl::Reference<OParseColumn> pColumn = new OParseColumn(aNewColName,OUString(),OUString(),OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,false,false,isCaseSensitive(),
OUString(),OUString(),OUString());
pColumn->setFunction(true);
pColumn->setAggregateFunction(bAggFkt);
- Reference< XPropertySet> xCol = pColumn;
- _rColumns->push_back(xCol);
+ m_aSelectColumns->push_back(pColumn);
}
}
}
-OUString OSQLParseTreeIterator::getUniqueColumnName(const OUString & rColumnName) const
+std::vector<OUString> OSQLParseTreeIterator::getSelectColumnNames() const
{
- OUString aAlias(rColumnName);
+ ::comphelper::UStringMixLess aCompare(isCaseSensitive());
- OSQLColumns::const_iterator aIter = find(
- m_aSelectColumns->begin(),
- m_aSelectColumns->end(),
- aAlias,
- ::comphelper::UStringMixEqual( isCaseSensitive() )
- );
+ std::vector<OUString> aColumnNames;
+ OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+ for (const auto& col : *m_aSelectColumns)
+ aColumnNames.push_back(getString(col->getPropertyValue(sPropertyName)));
+ std::sort(aColumnNames.begin(), aColumnNames.end(), aCompare);
+
+ return aColumnNames;
+}
+
+OUString OSQLParseTreeIterator::getUniqueColumnName(const std::vector<OUString>& rColumnNames, const OUString& rColumnName) const
+{
+ ::comphelper::UStringMixLess aCompare(isCaseSensitive());
+ if (!std::binary_search(rColumnNames.begin(), rColumnNames.end(), rColumnName, aCompare))
+ return rColumnName;
+
+ OUString aAlias;
sal_Int32 i=1;
- while(aIter != m_aSelectColumns->end())
+ do
{
aAlias = rColumnName + OUString::number(i++);
- aIter = find(
- m_aSelectColumns->begin(),
- m_aSelectColumns->end(),
- aAlias,
- ::comphelper::UStringMixEqual( isCaseSensitive() )
- );
}
+ while (std::binary_search(rColumnNames.begin(), rColumnNames.end(), aAlias, aCompare));
return aAlias;
}
@@ -1760,7 +1756,7 @@ void OSQLParseTreeIterator::setOrderByColumnName(const OUString & rColumnName, O
else
{
sal_Int32 nId = rColumnName.toInt32();
- if ( nId > 0 && nId < static_cast<sal_Int32>(m_aSelectColumns->size()) )
+ if ( nId > 0 && o3tl::make_unsigned(nId) < m_aSelectColumns->size() )
m_aOrderColumns->push_back( new OOrderColumn( (*m_aSelectColumns)[nId-1], isCaseSensitive(), bAscending ) );
}
@@ -1781,7 +1777,7 @@ void OSQLParseTreeIterator::setGroupByColumnName(const OUString & rColumnName, O
else
{
sal_Int32 nId = rColumnName.toInt32();
- if ( nId > 0 && nId < static_cast<sal_Int32>(m_aSelectColumns->size()) )
+ if ( nId > 0 && o3tl::make_unsigned(nId) < m_aSelectColumns->size() )
m_aGroupColumns->push_back(new OParseColumn((*m_aSelectColumns)[nId-1],isCaseSensitive()));
}
@@ -1807,7 +1803,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const
{
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
- OSL_ENSURE(pTableExp != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pTableExp != nullptr && "OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
@@ -1831,12 +1827,29 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const
// Analyse parse tree (depending on statement type)
// and set pointer to ORDER clause:
+
+ assert(SQL_ISRULE(m_pParseTree, select_statement) || SQL_ISRULE(m_pParseTree, union_statement));
+
+ auto pParseTree = m_pParseTree;
+ if(SQL_ISRULE(m_pParseTree, union_statement))
+ {
+ assert(m_pParseTree->count() == 4);
+ pParseTree = pParseTree->getChild(3);
+ // since UNION is left-associative (at least in our grammar),
+ // possibly the left-hand (m_pParseTree->getChild(0)) is a union_statement,
+ // but the right hand cannot.
+ assert(SQL_ISRULE(pParseTree, select_statement));
+ }
+
OSQLParseNode * pOrderClause = nullptr;
- OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
- OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
- OSL_ENSURE(pTableExp != nullptr,"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pParseTree->count() == 4, "OSQLParseTreeIterator::getOrderTree: expected a SELECT, and a SELECT must have exactly four children");
+ OSQLParseNode * pTableExp = pParseTree->getChild(3);
+ assert(pTableExp != nullptr && "OSQLParseTreeIterator::getOrderTree: got NULL table_exp");
+ OSL_ENSURE(SQL_ISRULE(pTableExp, table_exp), "OSQLParseTreeIterator::getOrderTree: expected table_exp but got something else");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator::getOrderTree: table_exp doesn't have the expected number of children");
+ // tdf#141115 upgrade the above to an assert;
+ // this cannot go well if there are too few children
+ assert(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT);
pOrderClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
// If it is an order_by, it must not be empty
@@ -1855,7 +1868,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const
OSQLParseNode * pGroupClause = nullptr;
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
- OSL_ENSURE(pTableExp != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pTableExp != nullptr && "OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
@@ -1876,7 +1889,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const
OSQLParseNode * pHavingClause = nullptr;
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
- OSL_ENSURE(pTableExp != nullptr,"OSQLParseTreeIterator: error in parse tree!");
+ assert(pTableExp != nullptr && "OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
@@ -2092,7 +2105,11 @@ sal_Int32 OSQLParseTreeIterator::getFunctionReturnType(const OSQLParseNode* _pNo
nType = DataType::DOUBLE;
}
else
+ {
nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
+ if (nType == DataType::SQLNULL)
+ nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, m_rParser.getNeutral() );
+ }
}
return nType;
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 77c1306d699d..1192183fc636 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -50,7 +50,7 @@
#include <comphelper/numbers.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbmetadata.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <string.h>
#include <algorithm>
#include <functional>
@@ -59,6 +59,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
+#include <utility>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::util;
@@ -91,39 +92,26 @@ namespace
void replaceAndReset(connectivity::OSQLParseNode*& _pResetNode,connectivity::OSQLParseNode* _pNewNode)
{
- _pResetNode->getParent()->replace(_pResetNode, _pNewNode);
- delete _pResetNode;
+ _pResetNode->getParent()->replaceAndDelete(_pResetNode, _pNewNode);
_pResetNode = _pNewNode;
}
/** quotes a string and search for quotes inside the string and replace them with the new quote
@param rValue
The value to be quoted.
- @param rQuot
+ @param rQuote
The quote
- @param rQuotToReplace
+ @param rQuoteToReplace
The quote to replace with
@return
The quoted string.
*/
- OUString SetQuotation(std::u16string_view rValue, const OUString& rQuot, const OUString& rQuotToReplace)
+ OUString SetQuotation(const OUString& rValue, std::u16string_view rQuote, std::u16string_view rQuoteToReplace)
{
- OUString rNewValue = rQuot + rValue;
- sal_Int32 nIndex = sal_Int32(-1); // Replace quotes with double quotes or the parser gets into problems
-
- if (!rQuot.isEmpty())
- {
- do
- {
- nIndex += 2;
- nIndex = rNewValue.indexOf(rQuot,nIndex);
- if(nIndex != -1)
- rNewValue = rNewValue.replaceAt(nIndex,rQuot.getLength(),rQuotToReplace);
- } while (nIndex != -1);
- }
-
- rNewValue += rQuot;
- return rNewValue;
+ // Replace quotes with double quotes or the parser gets into problems
+ if (!rQuote.empty())
+ return rQuote + rValue.replaceAll(rQuote, rQuoteToReplace) + rQuote;
+ return rValue;
}
bool columnMatchP(const connectivity::OSQLParseNode* pSubTree, const connectivity::SQLParseNodeParameter& rParam)
@@ -147,41 +135,41 @@ namespace
{
}
- if(pSubTree->count())
+ if(!pSubTree->count())
+ return false;
+
+ const OSQLParseNode* pCol = pSubTree->getChild(pSubTree->count()-1);
+ if (SQL_ISRULE(pCol,column_val))
{
- const OSQLParseNode* pCol = pSubTree->getChild(pSubTree->count()-1);
- if (SQL_ISRULE(pCol,column_val))
- {
- assert(pCol->count() == 1);
- pCol = pCol->getChild(0);
- }
- const OSQLParseNode* pTable(nullptr);
- switch (pSubTree->count())
- {
- case 1:
- break;
- case 3:
- pTable = pSubTree->getChild(0);
- break;
- case 5:
- case 7:
- SAL_WARN("connectivity.parse", "SQL: catalog and/or schema in column_ref in predicate");
- break;
- default:
- SAL_WARN("connectivity.parse", "columnMatchP: SQL grammar changed; column_ref has " << pSubTree->count() << " children");
- assert(false);
- break;
- }
- // TODO: not all DBMS match column names case-insensitively...
- // see XDatabaseMetaData::supportsMixedCaseIdentifiers()
- // and XDatabaseMetaData::supportsMixedCaseQuotedIdentifiers()
- if ( // table name matches (or no table name)?
- ( !pTable || pTable->getTokenValue().equalsIgnoreAsciiCase(rParam.sPredicateTableAlias) )
- && // column name matches?
- pCol->getTokenValue().equalsIgnoreAsciiCase(aFieldName)
- )
- return true;
+ assert(pCol->count() == 1);
+ pCol = pCol->getChild(0);
+ }
+ const OSQLParseNode* pTable(nullptr);
+ switch (pSubTree->count())
+ {
+ case 1:
+ break;
+ case 3:
+ pTable = pSubTree->getChild(0);
+ break;
+ case 5:
+ case 7:
+ SAL_WARN("connectivity.parse", "SQL: catalog and/or schema in column_ref in predicate");
+ break;
+ default:
+ SAL_WARN("connectivity.parse", "columnMatchP: SQL grammar changed; column_ref has " << pSubTree->count() << " children");
+ assert(false);
+ break;
}
+ // TODO: not all DBMS match column names case-insensitively...
+ // see XDatabaseMetaData::supportsMixedCaseIdentifiers()
+ // and XDatabaseMetaData::supportsMixedCaseQuotedIdentifiers()
+ if ( // table name matches (or no table name)?
+ ( !pTable || pTable->getTokenValue().equalsIgnoreAsciiCase(rParam.sPredicateTableAlias) )
+ && // column name matches?
+ pCol->getTokenValue().equalsIgnoreAsciiCase(aFieldName)
+ )
+ return true;
return false;
}
}
@@ -191,7 +179,7 @@ namespace connectivity
SQLParseNodeParameter::SQLParseNodeParameter( const Reference< XConnection >& _rxConnection,
const Reference< XNumberFormatter >& _xFormatter, const Reference< XPropertySet >& _xField,
- const OUString &_sPredicateTableAlias,
+ OUString _sPredicateTableAlias,
const Locale& _rLocale, const IParseContext* _pContext,
bool _bIntl, bool _bQuote, OUString _sDecSep, bool _bPredicate, bool _bParseToSDBC )
:rLocale(_rLocale)
@@ -200,9 +188,9 @@ SQLParseNodeParameter::SQLParseNodeParameter( const Reference< XConnection >& _r
,pSubQueryHistory( std::make_shared<QueryNameSet>() )
,xFormatter(_xFormatter)
,xField(_xField)
- ,sPredicateTableAlias(_sPredicateTableAlias)
+ ,sPredicateTableAlias(std::move(_sPredicateTableAlias))
,m_rContext( _pContext ? *_pContext : OSQLParser::s_aDefaultContext )
- ,sDecSep(_sDecSep)
+ ,sDecSep(std::move(_sDecSep))
,bQuote(_bQuote)
,bInternational(_bIntl)
,bPredicate(_bPredicate)
@@ -210,14 +198,14 @@ SQLParseNodeParameter::SQLParseNodeParameter( const Reference< XConnection >& _r
{
}
-OUString OSQLParseNode::convertDateString(const SQLParseNodeParameter& rParam, const OUString& rString)
+OUString OSQLParseNode::convertDateString(const SQLParseNodeParameter& rParam, std::u16string_view rString)
{
Date aDate = DBTypeConversion::toDate(rString);
Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier());
Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY);
double fDate = DBTypeConversion::toDouble(aDate,DBTypeConversion::getNULLDate(xSupplier));
- sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 36; // XXX hack
+ sal_Int32 nKey = xTypes->getFormatIndex(NumberFormatIndex::DATE_SYS_DDMMYYYY, rParam.rLocale);
return rParam.xFormatter->convertNumberToString(nKey, fDate);
}
@@ -229,12 +217,12 @@ OUString OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rPara
Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY);
double fDateTime = DBTypeConversion::toDouble(aDate,DBTypeConversion::getNULLDate(xSupplier));
- sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 51; // XXX hack
+ sal_Int32 nKey = xTypes->getFormatIndex(NumberFormatIndex::DATETIME_SYS_DDMMYYYY_HHMMSS, rParam.rLocale);
return rParam.xFormatter->convertNumberToString(nKey, fDateTime);
}
-OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, const OUString& rString)
+OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, std::u16string_view rString)
{
css::util::Time aTime = DBTypeConversion::toTime(rString);
Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier());
@@ -242,7 +230,7 @@ OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, c
Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY);
double fTime = DBTypeConversion::toDouble(aTime);
- sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 41; // XXX hack
+ sal_Int32 nKey = xTypes->getFormatIndex(NumberFormatIndex::TIME_HHMMSS, rParam.rLocale);
return rParam.xFormatter->convertNumberToString(nKey, fTime);
}
@@ -256,7 +244,7 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
parseNodeToStr(
rString, _rxConnection, nullptr, nullptr, OUString(),
pContext ? pContext->getPreferredLocale() : OParseContext::getDefaultLocale(),
- pContext, _bIntl, _bQuote, OUString("."), false );
+ pContext, _bIntl, _bQuote, u"."_ustr, false );
}
@@ -264,13 +252,13 @@ void OSQLParseNode::parseNodeToPredicateStr(OUString& rString,
const Reference< XConnection >& _rxConnection,
const Reference< XNumberFormatter > & xFormatter,
const css::lang::Locale& rIntl,
- OUString _sDec,
+ const OUString& rDec,
const IParseContext* pContext ) const
{
OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!");
if (xFormatter.is())
- parseNodeToStr(rString, _rxConnection, xFormatter, nullptr, OUString(), rIntl, pContext, true, true, _sDec, true);
+ parseNodeToStr(rString, _rxConnection, xFormatter, nullptr, OUString(), rIntl, pContext, true, true, rDec, true);
}
@@ -280,13 +268,13 @@ void OSQLParseNode::parseNodeToPredicateStr(OUString& rString,
const Reference< XPropertySet > & _xField,
const OUString &_sPredicateTableAlias,
const css::lang::Locale& rIntl,
- OUString _sDec,
+ const OUString& rDec,
const IParseContext* pContext ) const
{
OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!");
if (xFormatter.is())
- parseNodeToStr( rString, _rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext, true, true, _sDec, true );
+ parseNodeToStr( rString, _rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext, true, true, rDec, true );
}
@@ -299,7 +287,7 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
const IParseContext* pContext,
bool _bIntl,
bool _bQuote,
- OUString _sDecSep,
+ const OUString& _rDecSep,
bool _bPredicate) const
{
OSL_ENSURE( _rxConnection.is(), "OSQLParseNode::parseNodeToStr: invalid connection!" );
@@ -307,13 +295,13 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
if ( !_rxConnection.is() )
return;
- OUStringBuffer sBuffer = rString;
+ OUStringBuffer sBuffer(rString);
try
{
OSQLParseNode::impl_parseNodeToString_throw( sBuffer,
SQLParseNodeParameter(
_rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext,
- _bIntl, _bQuote, _sDecSep, _bPredicate, false
+ _bIntl, _bQuote, _rDecSep, _bPredicate, false
) );
}
catch( const SQLException& )
@@ -332,7 +320,7 @@ bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, cons
{
OSL_PRECOND( _rxConnection.is(), "OSQLParseNode::parseNodeToExecutableStatement: invalid connection!" );
SQLParseNodeParameter aParseParam( _rxConnection,
- nullptr, nullptr, OUString(), OParseContext::getDefaultLocale(), nullptr, false, true, OUString("."), false, true );
+ nullptr, nullptr, OUString(), OParseContext::getDefaultLocale(), nullptr, false, true, u"."_ustr, false, true );
if ( aParseParam.aMetaData.supportsSubqueriesInFrom() )
{
@@ -353,7 +341,7 @@ bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, cons
|| xMeta->getURL().startsWithIgnoreAsciiCase("sdbc:firebird:")))
{
sLimitValue = pTableExp->getChild(6)->getChild(1)->getTokenValue();
- pTableExp->removeAt(6);
+ delete pTableExp->removeAt(6);
}
_out_rString.clear();
@@ -372,9 +360,9 @@ bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, cons
if(sLimitValue.getLength() > 0)
{
- constexpr char SELECT_KEYWORD[] = "SELECT";
+ static constexpr char SELECT_KEYWORD[] = "SELECT";
sBuffer.insert(sBuffer.indexOf(SELECT_KEYWORD) + strlen(SELECT_KEYWORD),
- " FIRST " + sLimitValue);
+ Concat2View(" FIRST " + sLimitValue));
}
_out_rString = sBuffer.makeStringAndClear();
@@ -399,7 +387,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(OUStringBuffer& rString, const
return;
}
- // Lets see how many nodes this subtree has
+ // Let's see how many nodes this subtree has
sal_uInt32 nCount = count();
bool bHandled = false;
@@ -505,14 +493,35 @@ void OSQLParseNode::impl_parseNodeToString_throw(OUStringBuffer& rString, const
else
i++;
}
- rString.append(aStringPara.makeStringAndClear());
+ rString.append(aStringPara);
}
bHandled = true;
break;
+
+ case factor:
+ bSimple = false;
+ if (nCount == 2 && m_aChildren[0] && m_aChildren[1]
+ && (SQL_ISPUNCTUATION(m_aChildren[0], "-") || SQL_ISPUNCTUATION(m_aChildren[0], "+"))
+ && (m_aChildren[1]->getNodeType() == SQLNodeType::IntNum
+ || m_aChildren[1]->getNodeType() == SQLNodeType::ApproxNum))
+ {
+ // A signed number ("+" or "-" plus either IntNum or ApproxNum)
+ // The default processing would first add the sign, then process the number, which
+ // would see that rString is not empty already, and insert a space between the sign
+ // and the digits. Avoid that unneeded space.
+ OUStringBuffer aFactorPara;
+ m_aChildren[1]->impl_parseNodeToString_throw(aFactorPara, rParam, bSimple);
+ // Insert a space before the signed number, similar to parseLeaf for IntNum / ApproxNum
+ if (!rString.isEmpty())
+ rString.append(" ");
+ rString.append(m_aChildren[0]->getTokenValue() + aFactorPara);
+ bHandled = true;
+ }
+ break;
+
case odbc_call_spec:
case subquery:
case term:
- case factor:
case window_function:
case cast_spec:
case num_value_exp:
@@ -741,7 +750,7 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( OUStringBuffer& rString, c
const OSQLParseNode* pEscNode = nullptr;
const OSQLParseNode* pParaNode = nullptr;
- SQLParseNodeParameter aNewParam(rParam);
+ const SQLParseNodeParameter& aNewParam(rParam);
//aNewParam.bQuote = sal_True; // why setting this to true? @see https://bz.apache.org/ooo/show_bug.cgi?id=75557
if ( !(bSimple && rParam.bPredicate && rParam.xField.is() && SQL_ISRULE(m_aChildren[0],column_ref) && columnMatchP(m_aChildren[0].get(), rParam)) )
@@ -757,7 +766,7 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( OUStringBuffer& rString, c
{
OUString aStr = ConvertLikeToken(pParaNode, pEscNode, rParam.bInternational);
rString.append(" ");
- rString.append(SetQuotation(aStr,"\'","\'\'"));
+ rString.append(SetQuotation(aStr, u"\'", u"\'\'"));
}
else
pParaNode->impl_parseNodeToString_throw( rString, aNewParam, false );
@@ -815,7 +824,8 @@ void OSQLParser::killThousandSeparator(OSQLParseNode* pLiteral)
{
if ( pLiteral )
{
- if ( s_xLocaleData->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
+ auto& s_xLocaleData = getLocaleData();
+ if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
{
pLiteral->m_aNodeValue = pLiteral->m_aNodeValue.replace('.', sal_Unicode());
// and replace decimal
@@ -823,7 +833,7 @@ void OSQLParser::killThousandSeparator(OSQLParseNode* pLiteral)
}
else
pLiteral->m_aNodeValue = pLiteral->m_aNodeValue.replace(',', sal_Unicode());
- }
+ }
}
OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType, OSQLParseNode* pLiteral)
@@ -1020,7 +1030,7 @@ sal_Int16 OSQLParser::buildLikeRule(OSQLParseNode* pAppend, OSQLParseNode*& pLit
sal_Int16 nScale = 0;
try
{
- Any aValue = getNumberFormatProperty( m_xFormatter, m_nFormatKey, "Decimals" );
+ Any aValue = getNumberFormatProperty( m_xFormatter, m_nFormatKey, u"Decimals"_ustr );
aValue >>= nScale;
}
catch( Exception& )
@@ -1107,7 +1117,7 @@ OSQLParseNode* OSQLParser::buildNode_STR_NUM(OSQLParseNode*& _pLiteral)
sal_Int16 nScale = 0;
try
{
- Any aValue = getNumberFormatProperty( m_xFormatter, m_nFormatKey, "Decimals" );
+ Any aValue = getNumberFormatProperty( m_xFormatter, m_nFormatKey, u"Decimals"_ustr );
aValue >>= nScale;
}
catch( Exception& )
@@ -1130,7 +1140,8 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale)
OUString aValue;
if(!m_xCharClass.is())
m_xCharClass = CharacterClassification::create( m_xContext );
- if( s_xLocaleData.is() )
+ auto& s_xLocaleData = getLocaleData();
+ if( s_xLocaleData.get() )
{
try
{
@@ -1140,8 +1151,9 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale)
aValue = OUString::number(aResult.Value);
sal_Int32 nPos = aValue.lastIndexOf('.');
if((nPos+_nScale) < aValue.getLength())
- aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale,OUString());
- aValue = aValue.replaceAt(aValue.lastIndexOf('.'),1,s_xLocaleData->getLocaleItem(m_pData->aLocale).decimalSeparator);
+ aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale, u"");
+ OUString sDecimalSeparator = s_xLocaleData.get()->get()->getLocaleItem(m_pData->aLocale).decimalSeparator;
+ aValue = aValue.replaceAt(aValue.lastIndexOf('.'), 1, sDecimalSeparator);
return aValue;
}
}
@@ -1153,9 +1165,9 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale)
}
-::osl::Mutex& OSQLParser::getMutex()
+std::mutex& OSQLParser::getMutex()
{
- static ::osl::Mutex aMutex;
+ static std::mutex aMutex;
return aMutex;
}
@@ -1166,7 +1178,7 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
bool bUseRealName)
{
// Guard the parsing
- ::osl::MutexGuard aGuard(getMutex());
+ std::unique_lock aGuard(getMutex());
// must be reset
setParser(this);
@@ -1232,7 +1244,7 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
css::lang::Locale aLocale;
aLocale.Language = "en";
aLocale.Country = "US";
- OUString sFormat("YYYY-MM-DD");
+ OUString sFormat(u"YYYY-MM-DD"_ustr);
m_nDateFormatKey = xFormats->queryKey(sFormat,aLocale,false);
if ( m_nDateFormatKey == sal_Int32(-1) )
m_nDateFormatKey = xFormats->addNew(sFormat, aLocale);
@@ -1259,10 +1271,13 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
s_pScanner->SetRule(OSQLScanner::GetSTRINGRule());
break;
default:
- if ( s_xLocaleData->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
+ {
+ auto& s_xLocaleData = getLocaleData();
+ if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
s_pScanner->SetRule(OSQLScanner::GetGERRule());
else
s_pScanner->SetRule(OSQLScanner::GetENGRule());
+ }
}
}
@@ -1294,7 +1309,8 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
// clear the garbage collector
(*s_pGarbageCollector)->clearAndDelete();
- m_pParseTree.release(); // because the garbage collector deleted it
+ // coverity[leaked_storage : FALSE] - because the garbage collector deleted it
+ m_pParseTree.release();
return nullptr;
}
else
@@ -1316,12 +1332,15 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
}
-OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const IParseContext* _pContext)
+OSQLParser::OSQLParser(css::uno::Reference< css::uno::XComponentContext > xContext,
+ const IParseContext* _pContext,
+ const IParseContext* _pNeutral)
:m_pContext(_pContext)
+ ,m_pNeutral(_pNeutral)
,m_pData( new OSQLParser_Data )
,m_nFormatKey(0)
,m_nDateFormatKey(0)
- ,m_xContext(rxContext)
+ ,m_xContext(std::move(xContext))
{
@@ -1333,7 +1352,7 @@ OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >&
#endif
#endif
- ::osl::MutexGuard aGuard(getMutex());
+ std::unique_lock aGuard(getMutex());
// Do we have to initialize the data?
if (s_nRefCount == 0)
{
@@ -1341,8 +1360,9 @@ OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >&
s_pScanner->setScanner();
s_pGarbageCollector = new OSQLParseNodesGarbageCollector();
- if(!s_xLocaleData.is())
- s_xLocaleData = LocaleData::create(m_xContext);
+ auto& s_xLocaleData = getLocaleData();
+ if(!s_xLocaleData.get())
+ s_xLocaleData.set(LocaleData::create(m_xContext));
// reset to UNKNOWN_RULE
static_assert(OSQLParseNode::UNKNOWN_RULE==0, "UNKNOWN_RULE must be 0 for memset to 0 to work");
@@ -1354,109 +1374,109 @@ OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >&
OString sRuleName; // the name of the rule ("select_statement")
} aRuleDescriptions[] =
{
- { OSQLParseNode::select_statement, "select_statement" },
- { OSQLParseNode::table_exp, "table_exp" },
- { OSQLParseNode::table_ref_commalist, "table_ref_commalist" },
- { OSQLParseNode::table_ref, "table_ref" },
- { OSQLParseNode::catalog_name, "catalog_name" },
- { OSQLParseNode::schema_name, "schema_name" },
- { OSQLParseNode::table_name, "table_name" },
- { OSQLParseNode::opt_column_commalist, "opt_column_commalist" },
- { OSQLParseNode::column_commalist, "column_commalist" },
- { OSQLParseNode::column_ref_commalist, "column_ref_commalist" },
- { OSQLParseNode::column_ref, "column_ref" },
- { OSQLParseNode::opt_order_by_clause, "opt_order_by_clause" },
- { OSQLParseNode::ordering_spec_commalist, "ordering_spec_commalist" },
- { OSQLParseNode::ordering_spec, "ordering_spec" },
- { OSQLParseNode::opt_asc_desc, "opt_asc_desc" },
- { OSQLParseNode::where_clause, "where_clause" },
- { OSQLParseNode::opt_where_clause, "opt_where_clause" },
- { OSQLParseNode::search_condition, "search_condition" },
- { OSQLParseNode::comparison, "comparison" },
- { OSQLParseNode::comparison_predicate, "comparison_predicate" },
- { OSQLParseNode::between_predicate, "between_predicate" },
- { OSQLParseNode::like_predicate, "like_predicate" },
- { OSQLParseNode::opt_escape, "opt_escape" },
- { OSQLParseNode::test_for_null, "test_for_null" },
- { OSQLParseNode::scalar_exp_commalist, "scalar_exp_commalist" },
- { OSQLParseNode::scalar_exp, "scalar_exp" },
- { OSQLParseNode::parameter_ref, "parameter_ref" },
- { OSQLParseNode::parameter, "parameter" },
- { OSQLParseNode::general_set_fct, "general_set_fct" },
- { OSQLParseNode::range_variable, "range_variable" },
- { OSQLParseNode::column, "column" },
- { OSQLParseNode::delete_statement_positioned, "delete_statement_positioned" },
- { OSQLParseNode::delete_statement_searched, "delete_statement_searched" },
- { OSQLParseNode::update_statement_positioned, "update_statement_positioned" },
- { OSQLParseNode::update_statement_searched, "update_statement_searched" },
- { OSQLParseNode::assignment_commalist, "assignment_commalist" },
- { OSQLParseNode::assignment, "assignment" },
- { OSQLParseNode::values_or_query_spec, "values_or_query_spec" },
- { OSQLParseNode::insert_statement, "insert_statement" },
- { OSQLParseNode::insert_atom_commalist, "insert_atom_commalist" },
- { OSQLParseNode::insert_atom, "insert_atom" },
- { OSQLParseNode::from_clause, "from_clause" },
- { OSQLParseNode::qualified_join, "qualified_join" },
- { OSQLParseNode::cross_union, "cross_union" },
- { OSQLParseNode::select_sublist, "select_sublist" },
- { OSQLParseNode::derived_column, "derived_column" },
- { OSQLParseNode::column_val, "column_val" },
- { OSQLParseNode::set_fct_spec, "set_fct_spec" },
- { OSQLParseNode::boolean_term, "boolean_term" },
- { OSQLParseNode::boolean_primary, "boolean_primary" },
- { OSQLParseNode::num_value_exp, "num_value_exp" },
- { OSQLParseNode::join_type, "join_type" },
- { OSQLParseNode::position_exp, "position_exp" },
- { OSQLParseNode::extract_exp, "extract_exp" },
- { OSQLParseNode::length_exp, "length_exp" },
- { OSQLParseNode::char_value_fct, "char_value_fct" },
- { OSQLParseNode::odbc_call_spec, "odbc_call_spec" },
- { OSQLParseNode::in_predicate, "in_predicate" },
- { OSQLParseNode::existence_test, "existence_test" },
- { OSQLParseNode::unique_test, "unique_test" },
- { OSQLParseNode::all_or_any_predicate, "all_or_any_predicate" },
- { OSQLParseNode::named_columns_join, "named_columns_join" },
- { OSQLParseNode::join_condition, "join_condition" },
- { OSQLParseNode::joined_table, "joined_table" },
- { OSQLParseNode::boolean_factor, "boolean_factor" },
- { OSQLParseNode::sql_not, "sql_not" },
- { OSQLParseNode::manipulative_statement, "manipulative_statement" },
- { OSQLParseNode::subquery, "subquery" },
- { OSQLParseNode::value_exp_commalist, "value_exp_commalist" },
- { OSQLParseNode::odbc_fct_spec, "odbc_fct_spec" },
- { OSQLParseNode::union_statement, "union_statement" },
- { OSQLParseNode::outer_join_type, "outer_join_type" },
- { OSQLParseNode::char_value_exp, "char_value_exp" },
- { OSQLParseNode::term, "term" },
- { OSQLParseNode::value_exp_primary, "value_exp_primary" },
- { OSQLParseNode::value_exp, "value_exp" },
- { OSQLParseNode::selection, "selection" },
- { OSQLParseNode::fold, "fold" },
- { OSQLParseNode::char_substring_fct, "char_substring_fct" },
- { OSQLParseNode::factor, "factor" },
- { OSQLParseNode::base_table_def, "base_table_def" },
- { OSQLParseNode::base_table_element_commalist, "base_table_element_commalist" },
- { OSQLParseNode::data_type, "data_type" },
- { OSQLParseNode::column_def, "column_def" },
- { OSQLParseNode::table_node, "table_node" },
- { OSQLParseNode::as_clause, "as_clause" },
- { OSQLParseNode::opt_as, "opt_as" },
- { OSQLParseNode::op_column_commalist, "op_column_commalist" },
- { OSQLParseNode::table_primary_as_range_column, "table_primary_as_range_column" },
- { OSQLParseNode::datetime_primary, "datetime_primary" },
- { OSQLParseNode::concatenation, "concatenation" },
- { OSQLParseNode::char_factor, "char_factor" },
- { OSQLParseNode::bit_value_fct, "bit_value_fct" },
- { OSQLParseNode::comparison_predicate_part_2, "comparison_predicate_part_2" },
- { OSQLParseNode::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression" },
- { OSQLParseNode::character_string_type, "character_string_type" },
- { OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" },
- { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" },
- { OSQLParseNode::null_predicate_part_2, "null_predicate_part_2" },
- { OSQLParseNode::cast_spec, "cast_spec" },
- { OSQLParseNode::window_function, "window_function" }
+ { OSQLParseNode::select_statement, "select_statement"_ostr },
+ { OSQLParseNode::table_exp, "table_exp"_ostr },
+ { OSQLParseNode::table_ref_commalist, "table_ref_commalist"_ostr },
+ { OSQLParseNode::table_ref, "table_ref"_ostr },
+ { OSQLParseNode::catalog_name, "catalog_name"_ostr },
+ { OSQLParseNode::schema_name, "schema_name"_ostr },
+ { OSQLParseNode::table_name, "table_name"_ostr },
+ { OSQLParseNode::opt_column_commalist, "opt_column_commalist"_ostr },
+ { OSQLParseNode::column_commalist, "column_commalist"_ostr },
+ { OSQLParseNode::column_ref_commalist, "column_ref_commalist"_ostr },
+ { OSQLParseNode::column_ref, "column_ref"_ostr },
+ { OSQLParseNode::opt_order_by_clause, "opt_order_by_clause"_ostr },
+ { OSQLParseNode::ordering_spec_commalist, "ordering_spec_commalist"_ostr },
+ { OSQLParseNode::ordering_spec, "ordering_spec"_ostr },
+ { OSQLParseNode::opt_asc_desc, "opt_asc_desc"_ostr },
+ { OSQLParseNode::where_clause, "where_clause"_ostr },
+ { OSQLParseNode::opt_where_clause, "opt_where_clause"_ostr },
+ { OSQLParseNode::search_condition, "search_condition"_ostr },
+ { OSQLParseNode::comparison, "comparison"_ostr },
+ { OSQLParseNode::comparison_predicate, "comparison_predicate"_ostr },
+ { OSQLParseNode::between_predicate, "between_predicate"_ostr },
+ { OSQLParseNode::like_predicate, "like_predicate"_ostr },
+ { OSQLParseNode::opt_escape, "opt_escape"_ostr },
+ { OSQLParseNode::test_for_null, "test_for_null"_ostr },
+ { OSQLParseNode::scalar_exp_commalist, "scalar_exp_commalist"_ostr },
+ { OSQLParseNode::scalar_exp, "scalar_exp"_ostr },
+ { OSQLParseNode::parameter_ref, "parameter_ref"_ostr },
+ { OSQLParseNode::parameter, "parameter"_ostr },
+ { OSQLParseNode::general_set_fct, "general_set_fct"_ostr },
+ { OSQLParseNode::range_variable, "range_variable"_ostr },
+ { OSQLParseNode::column, "column"_ostr },
+ { OSQLParseNode::delete_statement_positioned, "delete_statement_positioned"_ostr },
+ { OSQLParseNode::delete_statement_searched, "delete_statement_searched"_ostr },
+ { OSQLParseNode::update_statement_positioned, "update_statement_positioned"_ostr },
+ { OSQLParseNode::update_statement_searched, "update_statement_searched"_ostr },
+ { OSQLParseNode::assignment_commalist, "assignment_commalist"_ostr },
+ { OSQLParseNode::assignment, "assignment"_ostr },
+ { OSQLParseNode::values_or_query_spec, "values_or_query_spec"_ostr },
+ { OSQLParseNode::insert_statement, "insert_statement"_ostr },
+ { OSQLParseNode::insert_atom_commalist, "insert_atom_commalist"_ostr },
+ { OSQLParseNode::insert_atom, "insert_atom"_ostr },
+ { OSQLParseNode::from_clause, "from_clause"_ostr },
+ { OSQLParseNode::qualified_join, "qualified_join"_ostr },
+ { OSQLParseNode::cross_union, "cross_union"_ostr },
+ { OSQLParseNode::select_sublist, "select_sublist"_ostr },
+ { OSQLParseNode::derived_column, "derived_column"_ostr },
+ { OSQLParseNode::column_val, "column_val"_ostr },
+ { OSQLParseNode::set_fct_spec, "set_fct_spec"_ostr },
+ { OSQLParseNode::boolean_term, "boolean_term"_ostr },
+ { OSQLParseNode::boolean_primary, "boolean_primary"_ostr },
+ { OSQLParseNode::num_value_exp, "num_value_exp"_ostr },
+ { OSQLParseNode::join_type, "join_type"_ostr },
+ { OSQLParseNode::position_exp, "position_exp"_ostr },
+ { OSQLParseNode::extract_exp, "extract_exp"_ostr },
+ { OSQLParseNode::length_exp, "length_exp"_ostr },
+ { OSQLParseNode::char_value_fct, "char_value_fct"_ostr },
+ { OSQLParseNode::odbc_call_spec, "odbc_call_spec"_ostr },
+ { OSQLParseNode::in_predicate, "in_predicate"_ostr },
+ { OSQLParseNode::existence_test, "existence_test"_ostr },
+ { OSQLParseNode::unique_test, "unique_test"_ostr },
+ { OSQLParseNode::all_or_any_predicate, "all_or_any_predicate"_ostr },
+ { OSQLParseNode::named_columns_join, "named_columns_join"_ostr },
+ { OSQLParseNode::join_condition, "join_condition"_ostr },
+ { OSQLParseNode::joined_table, "joined_table"_ostr },
+ { OSQLParseNode::boolean_factor, "boolean_factor"_ostr },
+ { OSQLParseNode::sql_not, "sql_not"_ostr },
+ { OSQLParseNode::manipulative_statement, "manipulative_statement"_ostr },
+ { OSQLParseNode::subquery, "subquery"_ostr },
+ { OSQLParseNode::value_exp_commalist, "value_exp_commalist"_ostr },
+ { OSQLParseNode::odbc_fct_spec, "odbc_fct_spec"_ostr },
+ { OSQLParseNode::union_statement, "union_statement"_ostr },
+ { OSQLParseNode::outer_join_type, "outer_join_type"_ostr },
+ { OSQLParseNode::char_value_exp, "char_value_exp"_ostr },
+ { OSQLParseNode::term, "term"_ostr },
+ { OSQLParseNode::value_exp_primary, "value_exp_primary"_ostr },
+ { OSQLParseNode::value_exp, "value_exp"_ostr },
+ { OSQLParseNode::selection, "selection"_ostr },
+ { OSQLParseNode::fold, "fold"_ostr },
+ { OSQLParseNode::char_substring_fct, "char_substring_fct"_ostr },
+ { OSQLParseNode::factor, "factor"_ostr },
+ { OSQLParseNode::base_table_def, "base_table_def"_ostr },
+ { OSQLParseNode::base_table_element_commalist, "base_table_element_commalist"_ostr },
+ { OSQLParseNode::data_type, "data_type"_ostr },
+ { OSQLParseNode::column_def, "column_def"_ostr },
+ { OSQLParseNode::table_node, "table_node"_ostr },
+ { OSQLParseNode::as_clause, "as_clause"_ostr },
+ { OSQLParseNode::opt_as, "opt_as"_ostr },
+ { OSQLParseNode::op_column_commalist, "op_column_commalist"_ostr },
+ { OSQLParseNode::table_primary_as_range_column, "table_primary_as_range_column"_ostr },
+ { OSQLParseNode::datetime_primary, "datetime_primary"_ostr },
+ { OSQLParseNode::concatenation, "concatenation"_ostr },
+ { OSQLParseNode::char_factor, "char_factor"_ostr },
+ { OSQLParseNode::bit_value_fct, "bit_value_fct"_ostr },
+ { OSQLParseNode::comparison_predicate_part_2, "comparison_predicate_part_2"_ostr },
+ { OSQLParseNode::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression"_ostr },
+ { OSQLParseNode::character_string_type, "character_string_type"_ostr },
+ { OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2"_ostr },
+ { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2"_ostr },
+ { OSQLParseNode::null_predicate_part_2, "null_predicate_part_2"_ostr },
+ { OSQLParseNode::cast_spec, "cast_spec"_ostr },
+ { OSQLParseNode::window_function, "window_function"_ostr }
};
- const size_t nRuleMapCount = SAL_N_ELEMENTS( aRuleDescriptions );
+ const size_t nRuleMapCount = std::size( aRuleDescriptions );
// added a new rule? Adjust this map!
// +1 for UNKNOWN_RULE
static_assert(nRuleMapCount + 1 == static_cast<size_t>(OSQLParseNode::rule_count), "must be equal");
@@ -1480,10 +1500,16 @@ OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >&
m_pData->aLocale = m_pContext->getPreferredLocale();
}
+//static
+tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>>& OSQLParser::getLocaleData()
+{
+ static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> s_xLocaleData(tools::DeleteOnDeinitFlag::Empty);
+ return s_xLocaleData;
+}
OSQLParser::~OSQLParser()
{
- ::osl::MutexGuard aGuard(getMutex());
+ std::unique_lock aGuard(getMutex());
OSL_ENSURE(s_nRefCount > 0, "OSQLParser::~OSQLParser() : suspicious call : has a refcount of 0 !");
if (!--s_nRefCount)
{
@@ -1493,11 +1519,8 @@ OSQLParser::~OSQLParser()
delete s_pGarbageCollector;
s_pGarbageCollector = nullptr;
- // Is only set the first time, so we should delete it only when there are no more instances
- s_xLocaleData = nullptr;
- RuleIDMap aEmpty;
- s_aReverseRuleIDLookup.swap( aEmpty );
+ RuleIDMap().swap(s_aReverseRuleIDLookup);
}
m_pParseTree = nullptr;
}
@@ -1511,7 +1534,7 @@ void OSQLParseNode::substituteParameterNames(OSQLParseNode const * _pNode)
if(SQL_ISRULE(pChildNode,parameter) && pChildNode->count() > 1)
{
OSQLParseNode* pNewNode = new OSQLParseNode("?" ,SQLNodeType::Punctuation,0);
- delete pChildNode->replace(pChildNode->getChild(0),pNewNode);
+ pChildNode->replaceAndDelete(pChildNode->getChild(0), pNewNode);
sal_Int32 nChildCount = pChildNode->count();
for(sal_Int32 j=1;j < nChildCount;++j)
delete pChildNode->removeAt(1);
@@ -1612,11 +1635,11 @@ OSQLParseNode::OSQLParseNode(std::string_view _rNewValue,
OSL_ENSURE(m_eNodeType >= SQLNodeType::Rule && m_eNodeType <= SQLNodeType::Concat,"OSQLParseNode: created with invalid NodeType");
}
-OSQLParseNode::OSQLParseNode(const OUString &_rNewValue,
+OSQLParseNode::OSQLParseNode(OUString _aNewValue,
SQLNodeType eNewNodeType,
sal_uInt32 nNewNodeID)
:m_pParent(nullptr)
- ,m_aNodeValue(_rNewValue)
+ ,m_aNodeValue(std::move(_aNewValue))
,m_eNodeType(eNewNodeType)
,m_nNodeID(nNewNodeID)
{
@@ -1686,10 +1709,9 @@ OSQLParseNode::~OSQLParseNode()
{
}
-
void OSQLParseNode::append(OSQLParseNode* pNewNode)
{
- OSL_ENSURE(pNewNode != nullptr, "OSQLParseNode: invalid NewSubTree");
+ assert(pNewNode != nullptr && "OSQLParseNode: invalid NewSubTree");
OSL_ENSURE(pNewNode->getParent() == nullptr, "OSQLParseNode: Node is not an orphan");
OSL_ENSURE(std::none_of(m_aChildren.begin(), m_aChildren.end(),
[&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pNewNode; }),
@@ -1704,54 +1726,53 @@ void OSQLParseNode::append(OSQLParseNode* pNewNode)
bool OSQLParseNode::addDateValue(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const
{
// special display for date/time values
- if (SQL_ISRULE(this,set_fct_spec) && SQL_ISPUNCTUATION(m_aChildren[0],"{"))
- {
- const OSQLParseNode* pODBCNode = m_aChildren[1].get();
- const OSQLParseNode* pODBCNodeChild = pODBCNode->m_aChildren[0].get();
+ if (!SQL_ISRULE(this,set_fct_spec) || !SQL_ISPUNCTUATION(m_aChildren[0],"{"))
+ return false;
- if (pODBCNodeChild->getNodeType() == SQLNodeType::Keyword && (
- SQL_ISTOKEN(pODBCNodeChild, D) ||
- SQL_ISTOKEN(pODBCNodeChild, T) ||
- SQL_ISTOKEN(pODBCNodeChild, TS) ))
- {
- OUString suQuote("'");
- if (rParam.bPredicate)
- {
- if (rParam.aMetaData.shouldEscapeDateTime())
- {
- suQuote = "#";
- }
- }
- else
- {
- if (rParam.aMetaData.shouldEscapeDateTime())
- {
- // suQuote = "'";
- return false;
- }
- }
+ const OSQLParseNode* pODBCNode = m_aChildren[1].get();
+ const OSQLParseNode* pODBCNodeChild = pODBCNode->m_aChildren[0].get();
- if (!rString.isEmpty())
- rString.append(" ");
- rString.append(suQuote);
- const OUString sTokenValue = pODBCNode->m_aChildren[1]->getTokenValue();
- if (SQL_ISTOKEN(pODBCNodeChild, D))
- {
- rString.append(rParam.bPredicate ? convertDateString(rParam, sTokenValue) : sTokenValue);
- }
- else if (SQL_ISTOKEN(pODBCNodeChild, T))
- {
- rString.append(rParam.bPredicate ? convertTimeString(rParam, sTokenValue) : sTokenValue);
- }
- else
- {
- rString.append(rParam.bPredicate ? convertDateTimeString(rParam, sTokenValue) : sTokenValue);
- }
- rString.append(suQuote);
- return true;
- }
+ if (pODBCNodeChild->getNodeType() != SQLNodeType::Keyword || !(
+ SQL_ISTOKEN(pODBCNodeChild, D) ||
+ SQL_ISTOKEN(pODBCNodeChild, T) ||
+ SQL_ISTOKEN(pODBCNodeChild, TS) ))
+ return false;
+
+ OUString suQuote(u"'"_ustr);
+ if (rParam.bPredicate)
+ {
+ if (rParam.aMetaData.shouldEscapeDateTime())
+ {
+ suQuote = "#";
+ }
}
- return false;
+ else
+ {
+ if (rParam.aMetaData.shouldEscapeDateTime())
+ {
+ // suQuote = "'";
+ return false;
+ }
+ }
+
+ if (!rString.isEmpty())
+ rString.append(" ");
+ rString.append(suQuote);
+ const OUString sTokenValue = pODBCNode->m_aChildren[1]->getTokenValue();
+ if (SQL_ISTOKEN(pODBCNodeChild, D))
+ {
+ rString.append(rParam.bPredicate ? convertDateString(rParam, sTokenValue) : sTokenValue);
+ }
+ else if (SQL_ISTOKEN(pODBCNodeChild, T))
+ {
+ rString.append(rParam.bPredicate ? convertTimeString(rParam, sTokenValue) : sTokenValue);
+ }
+ else
+ {
+ rString.append(rParam.bPredicate ? convertDateTimeString(rParam, sTokenValue) : sTokenValue);
+ }
+ rString.append(suQuote);
+ return true;
}
void OSQLParseNode::replaceNodeValue(const OUString& rTableAlias, const OUString& rColumnName)
@@ -1845,10 +1866,11 @@ void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition)
OSQLParseNode* pNewRight = nullptr;
// cut right from parent
- pSearchCondition->removeAt(2);
+ OSQLParseNode* pOldRight = pSearchCondition->removeAt(2);
+ assert(pOldRight == pRight);
- pNewRight = MakeANDNode(pOr->removeAt(2) ,pRight);
- pNewLeft = MakeANDNode(pOr->removeAt(sal_uInt32(0)) ,new OSQLParseNode(*pRight));
+ pNewRight = MakeANDNode(pOr->removeAt(2), pOldRight);
+ pNewLeft = MakeANDNode(pOr->removeAt(sal_uInt32(0)), new OSQLParseNode(*pOldRight));
pNewNode = MakeORNode(pNewLeft,pNewRight);
// and append new Node
replaceAndReset(pSearchCondition,pNewNode);
@@ -1864,10 +1886,11 @@ void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition)
OSQLParseNode* pNewRight = nullptr;
// cut left from parent
- pSearchCondition->removeAt(sal_uInt32(0));
+ OSQLParseNode* pOldLeft = pSearchCondition->removeAt(sal_uInt32(0));
+ assert(pOldLeft == pLeft);
- pNewRight = MakeANDNode(pLeft,pOr->removeAt(2));
- pNewLeft = MakeANDNode(new OSQLParseNode(*pLeft),pOr->removeAt(sal_uInt32(0)));
+ pNewRight = MakeANDNode(pOldLeft, pOr->removeAt(2));
+ pNewLeft = MakeANDNode(new OSQLParseNode(*pOldLeft), pOr->removeAt(sal_uInt32(0)));
pNewNode = MakeORNode(pNewLeft,pNewRight);
// and append new Node
@@ -1875,9 +1898,9 @@ void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition)
disjunctiveNormalForm(pSearchCondition);
}
else if(SQL_ISRULE(pLeft,boolean_primary) && (!SQL_ISRULE(pLeft->getChild(1),search_condition) || !SQL_ISRULE(pLeft->getChild(1),boolean_term)))
- pSearchCondition->replace(pLeft, pLeft->removeAt(1));
+ pSearchCondition->replaceAndDelete(pLeft, pLeft->removeAt(1));
else if(SQL_ISRULE(pRight,boolean_primary) && (!SQL_ISRULE(pRight->getChild(1),search_condition) || !SQL_ISRULE(pRight->getChild(1),boolean_term)))
- pSearchCondition->replace(pRight, pRight->removeAt(1));
+ pSearchCondition->replaceAndDelete(pRight, pRight->removeAt(1));
}
}
@@ -1964,8 +1987,7 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition, bool
assert(SQL_ISTOKEN(pNot,NOT));
pNotNot = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::sql_not));
}
- pComparison->replace(pNot, pNotNot);
- delete pNot;
+ pComparison->replaceAndDelete(pNot, pNotNot);
}
else
{
@@ -1994,8 +2016,7 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition, bool
pNewComparison = new OSQLParseNode("=",SQLNodeType::Equal,SQL_EQUAL);
break;
}
- pSearchCondition->replace(pComparison, pNewComparison);
- delete pComparison;
+ pSearchCondition->replaceAndDelete(pComparison, pNewComparison);
}
}
@@ -2017,8 +2038,7 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition, bool
assert(SQL_ISTOKEN(pNot,NOT));
pNotNot = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::sql_not));
}
- pPart2->replace(pNot, pNotNot);
- delete pNot;
+ pPart2->replaceAndDelete(pNot, pNotNot);
}
else if(bNegate && SQL_ISRULE(pSearchCondition,like_predicate))
{
@@ -2028,8 +2048,7 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition, bool
pNotNot = new OSQLParseNode("NOT",SQLNodeType::Keyword,SQL_TOKEN_NOT);
else
pNotNot = new OSQLParseNode(OUString(),SQLNodeType::Rule,OSQLParser::RuleID(OSQLParseNode::sql_not));
- pSearchCondition->getChild( 1 )->replace(pNot, pNotNot);
- delete pNot;
+ pSearchCondition->getChild( 1 )->replaceAndDelete(pNot, pNotNot);
}
}
@@ -2365,7 +2384,7 @@ void OSQLParseNode::showParseTree( OUStringBuffer& _inout_rBuffer, sal_uInt32 nL
void OSQLParseNode::insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree)
{
- OSL_ENSURE(pNewSubTree != nullptr, "OSQLParseNode: invalid NewSubTree");
+ assert(pNewSubTree != nullptr && "OSQLParseNode: invalid NewSubTree");
OSL_ENSURE(pNewSubTree->getParent() == nullptr, "OSQLParseNode: Node is not an orphan");
// Create connection to getParent
@@ -2377,7 +2396,7 @@ void OSQLParseNode::insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree)
OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos)
{
- OSL_ENSURE(nPos < m_aChildren.size(),"Illegal position for removeAt");
+ assert(nPos < m_aChildren.size() && "Illegal position for removeAt");
auto aPos(m_aChildren.begin() + nPos);
auto pNode = std::move(*aPos);
@@ -2390,27 +2409,24 @@ OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos)
// Replace methods
-OSQLParseNode* OSQLParseNode::replace(OSQLParseNode* pOldSubNode, OSQLParseNode* pNewSubNode )
+void OSQLParseNode::replaceAndDelete(OSQLParseNode* pOldSubNode, OSQLParseNode* pNewSubNode )
{
- OSL_ENSURE(pOldSubNode != nullptr && pNewSubNode != nullptr, "OSQLParseNode: invalid nodes");
- OSL_ENSURE(pNewSubNode->getParent() == nullptr, "OSQLParseNode: node already has getParent");
- OSL_ENSURE(std::any_of(m_aChildren.begin(), m_aChildren.end(),
- [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pOldSubNode; }),
- "OSQLParseNode::Replace() Node not element of parent");
- OSL_ENSURE(std::none_of(m_aChildren.begin(), m_aChildren.end(),
- [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pNewSubNode; }),
- "OSQLParseNode::Replace() Node already element of parent");
+ assert(pOldSubNode != nullptr && pNewSubNode != nullptr && "OSQLParseNode: invalid nodes");
+ assert(pOldSubNode != pNewSubNode && "OSQLParseNode: same node");
+ assert(pNewSubNode->getParent() == nullptr && "OSQLParseNode: node already has getParent");
+ assert(std::any_of(m_aChildren.begin(), m_aChildren.end(),
+ [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pOldSubNode; })
+ && "OSQLParseNode::Replace() Node not element of parent");
+ assert(std::none_of(m_aChildren.begin(), m_aChildren.end(),
+ [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pNewSubNode; })
+ && "OSQLParseNode::Replace() Node already element of parent");
pOldSubNode->setParent( nullptr );
pNewSubNode->setParent( this );
auto it = std::find_if(m_aChildren.begin(), m_aChildren.end(),
[&pOldSubNode](const std::unique_ptr<OSQLParseNode>& rxChild) { return rxChild.get() == pOldSubNode; });
- if (it != m_aChildren.end())
- {
- it->release();
- it->reset(pNewSubNode);
- }
- return pOldSubNode;
+ assert(it != m_aChildren.end());
+ it->reset(pNewSubNode);
}
void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const
@@ -2430,7 +2446,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet
case SQLNodeType::String:
if (!rString.isEmpty())
rString.append(" ");
- rString.append(SetQuotation(m_aNodeValue,"\'","\'\'"));
+ rString.append(SetQuotation(m_aNodeValue, u"\'", u"\'\'"));
break;
case SQLNodeType::Name:
if (!rString.isEmpty())
@@ -2474,7 +2490,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet
case SQLNodeType::ApproxNum:
{
OUString aTmp = m_aNodeValue;
- static OUString strPoint(".");
+ static constexpr OUString strPoint(u"."_ustr);
if (rParam.bInternational && rParam.bPredicate && rParam.sDecSep != strPoint)
aTmp = aTmp.replaceAll(strPoint, rParam.sDecSep);
@@ -2512,7 +2528,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet
sal_Int32 OSQLParser::getFunctionReturnType(std::u16string_view _sFunctionName, const IParseContext* pContext)
{
- sal_Int32 nType = DataType::VARCHAR;
+ sal_Int32 nType = DataType::SQLNULL;
OString sFunctionName(OUStringToOString(_sFunctionName,RTL_TEXTENCODING_UTF8));
if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_ASCII,pContext))) nType = DataType::INTEGER;
@@ -2723,15 +2739,16 @@ OSQLParseNode::Rule OSQLParseNode::getKnownRuleID() const
OUString OSQLParseNode::getTableRange(const OSQLParseNode* _pTableRef)
{
- OSL_ENSURE(_pTableRef && _pTableRef->count() > 1 && _pTableRef->getKnownRuleID() == OSQLParseNode::table_ref,"Invalid node give, only table ref is allowed!");
+ assert(_pTableRef);
+ OSL_ENSURE(_pTableRef->count() > 1 && _pTableRef->getKnownRuleID() == OSQLParseNode::table_ref,"Invalid node give, only table ref is allowed!");
const sal_uInt32 nCount = _pTableRef->count();
OUString sTableRange;
if ( nCount == 2 || (nCount == 3 && !_pTableRef->getChild(0)->isToken()) )
{
const OSQLParseNode* pNode = _pTableRef->getChild(nCount - (nCount == 2 ? 1 : 2));
- OSL_ENSURE(pNode && (pNode->getKnownRuleID() == OSQLParseNode::table_primary_as_range_column
- || pNode->getKnownRuleID() == OSQLParseNode::range_variable)
- ,"SQL grammar changed!");
+ assert(pNode);
+ OSL_ENSURE(pNode->getKnownRuleID() == OSQLParseNode::table_primary_as_range_column ||
+ pNode->getKnownRuleID() == OSQLParseNode::range_variable, "SQL grammar changed!");
if ( !pNode->isLeaf() )
sTableRange = pNode->getChild(1)->getTokenValue();
} // if ( nCount == 2 || nCount == 3 )
@@ -2749,13 +2766,13 @@ OSQLParseNodesContainer::~OSQLParseNodesContainer()
void OSQLParseNodesContainer::push_back(OSQLParseNode* _pNode)
{
- ::osl::MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
m_aNodes.push_back(_pNode);
}
void OSQLParseNodesContainer::erase(OSQLParseNode* _pNode)
{
- ::osl::MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
if ( !m_aNodes.empty() )
{
std::vector< OSQLParseNode* >::iterator aFind = std::find(m_aNodes.begin(), m_aNodes.end(),_pNode);
@@ -2766,13 +2783,13 @@ void OSQLParseNodesContainer::erase(OSQLParseNode* _pNode)
void OSQLParseNodesContainer::clear()
{
- ::osl::MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
m_aNodes.clear();
}
void OSQLParseNodesContainer::clearAndDelete()
{
- ::osl::MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
// clear the garbage collector
while ( !m_aNodes.empty() )
{
@@ -2781,7 +2798,9 @@ void OSQLParseNodesContainer::clearAndDelete()
{
pNode = pNode->getParent();
}
+ aGuard.unlock(); // can call back into this object during destruction
delete pNode;
+ aGuard.lock();
}
}
} // namespace connectivity
diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx
index 3f7062f6be52..cc6f65e64541 100644
--- a/connectivity/source/resource/sharedresources.cxx
+++ b/connectivity/source/resource/sharedresources.cxx
@@ -44,7 +44,7 @@ namespace connectivity
static SharedResources_Impl&
getInstance();
- OUString getResourceString(const char* pId);
+ OUString getResourceString(TranslateId pId) const;
private:
SharedResources_Impl();
@@ -66,7 +66,7 @@ namespace connectivity
{
}
- OUString SharedResources_Impl::getResourceString(const char* pId)
+ OUString SharedResources_Impl::getResourceString(TranslateId pId) const
{
return Translate::get(pId, m_aLocale);
}
@@ -100,20 +100,13 @@ namespace connectivity
namespace
{
- size_t lcl_substitute( OUString& _inout_rString,
- const char* _pAsciiPattern, const OUString& _rReplace )
+ bool lcl_substitute( OUString& _inout_rString,
+ const char* _pAsciiPattern, std::u16string_view _rReplace )
{
- size_t nOccurrences = 0;
-
+ OUString oldString = _inout_rString;
OUString sPattern( OUString::createFromAscii( _pAsciiPattern ) );
- sal_Int32 nIndex = 0;
- while ( ( nIndex = _inout_rString.indexOf( sPattern ) ) > -1 )
- {
- ++nOccurrences;
- _inout_rString = _inout_rString.replaceAt( nIndex, sPattern.getLength(), _rReplace );
- }
-
- return nOccurrences;
+ _inout_rString = _inout_rString.replaceAll(sPattern, _rReplace);
+ return oldString != _inout_rString;
}
}
@@ -129,13 +122,13 @@ namespace connectivity
}
- OUString SharedResources::getResourceString(const char* pResId) const
+ OUString SharedResources::getResourceString(TranslateId pResId) const
{
return SharedResources_Impl::getInstance().getResourceString(pResId);
}
- OUString SharedResources::getResourceStringWithSubstitution(const char* pResId,
+ OUString SharedResources::getResourceStringWithSubstitution(TranslateId pResId,
const char* _pAsciiPatternToReplace, const OUString& _rStringToSubstitute ) const
{
OUString sString( SharedResources_Impl::getInstance().getResourceString(pResId) );
@@ -145,7 +138,7 @@ namespace connectivity
}
- OUString SharedResources::getResourceStringWithSubstitution(const char* pResId,
+ OUString SharedResources::getResourceStringWithSubstitution(TranslateId pResId,
const char* _pAsciiPatternToReplace1, const OUString& _rStringToSubstitute1,
const char* _pAsciiPatternToReplace2, const OUString& _rStringToSubstitute2 ) const
{
@@ -158,7 +151,7 @@ namespace connectivity
}
- OUString SharedResources::getResourceStringWithSubstitution(const char* pResId,
+ OUString SharedResources::getResourceStringWithSubstitution(TranslateId pResId,
const char* _pAsciiPatternToReplace1, const OUString& _rStringToSubstitute1,
const char* _pAsciiPatternToReplace2, const OUString& _rStringToSubstitute2,
const char* _pAsciiPatternToReplace3, const OUString& _rStringToSubstitute3 ) const
@@ -173,7 +166,7 @@ namespace connectivity
return sString;
}
- OUString SharedResources::getResourceStringWithSubstitution(const char* pResId,
+ OUString SharedResources::getResourceStringWithSubstitution(TranslateId pResId,
const std::vector< std::pair<const char* , OUString > >& _rStringToSubstitutes) const
{
OUString sString( SharedResources_Impl::getInstance().getResourceString(pResId) );
diff --git a/connectivity/source/sdbcx/VCatalog.cxx b/connectivity/source/sdbcx/VCatalog.cxx
index b30519fcaab1..79f4400d1025 100644
--- a/connectivity/source/sdbcx/VCatalog.cxx
+++ b/connectivity/source/sdbcx/VCatalog.cxx
@@ -35,7 +35,7 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-IMPLEMENT_SERVICE_INFO(OCatalog,"com.sun.star.comp.connectivity.OCatalog","com.sun.star.sdbcx.DatabaseDefinition")
+IMPLEMENT_SERVICE_INFO(OCatalog,u"com.sun.star.comp.connectivity.OCatalog"_ustr,u"com.sun.star.sdbcx.DatabaseDefinition"_ustr)
OCatalog::OCatalog(const Reference< XConnection> &_xConnection) : OCatalog_BASE(m_aMutex)
{
diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx
index 860ead949074..b5564f90930e 100644
--- a/connectivity/source/sdbcx/VCollection.cxx
+++ b/connectivity/source/sdbcx/VCollection.cxx
@@ -60,13 +60,13 @@ namespace
ObjectMap m_aNameMap; // hold the elements and a name
public:
OHardRefMap(bool _bCase)
- : m_aNameMap(_bCase)
+ : m_aNameMap(::comphelper::UStringMixLess(_bCase))
{
}
virtual bool exists(const OUString& _sName ) override
{
- return m_aNameMap.find(_sName) != m_aNameMap.end();
+ return m_aNameMap.contains(_sName);
}
virtual bool empty() override
@@ -99,7 +99,7 @@ namespace
m_aNameMap.clear();
}
- virtual void insert(const OUString& _sName,const ObjectType& _xObject) override
+ virtual void insert(const OUString& _sName,const css::uno::Reference< css::beans::XPropertySet >& _xObject) override
{
m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectEntry(_sName,_xObject)));
}
@@ -110,7 +110,7 @@ namespace
m_aElements.reserve(_rVector.size());
for (auto const& elem : _rVector)
- m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectEntry(elem,ObjectType())));
+ m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectEntry(elem,nullptr)));
}
virtual bool rename(const OUString& _sOldName, const OUString& _sNewName) override
@@ -189,18 +189,18 @@ namespace
return m_aElements.size() - (m_aElements.end() - std::find(m_aElements.begin(),m_aElements.end(),aIter));
}
- virtual ObjectType getObject(sal_Int32 _nIndex) override
+ virtual css::uno::Reference< css::beans::XPropertySet > getObject(sal_Int32 _nIndex) override
{
OSL_ENSURE(_nIndex >= 0 && _nIndex < static_cast<sal_Int32>(m_aElements.size()),"Illegal argument!");
return m_aElements[_nIndex]->second;
}
- virtual ObjectType getObject(const OUString& columnName) override
+ virtual css::uno::Reference< css::beans::XPropertySet > getObject(const OUString& columnName) override
{
return m_aNameMap.find(columnName)->second;
}
- virtual void setObject(sal_Int32 _nIndex,const ObjectType& _xObject) override
+ virtual void setObject(sal_Int32 _nIndex,const css::uno::Reference< css::beans::XPropertySet >& _xObject) override
{
OSL_ENSURE(_nIndex >= 0 && _nIndex < static_cast<sal_Int32>(m_aElements.size()),"Illegal argument!");
m_aElements[_nIndex]->second = _xObject;
@@ -216,7 +216,7 @@ namespace
IObjectCollection::~IObjectCollection() {}
-IMPLEMENT_SERVICE_INFO(OCollection,"com.sun.star.sdbcx.VContainer" , "com.sun.star.sdbcx.Container")
+IMPLEMENT_SERVICE_INFO(OCollection,u"com.sun.star.sdbcx.VContainer"_ustr , u"com.sun.star.sdbcx.Container"_ustr)
OCollection::OCollection(::cppu::OWeakObject& _rParent
, bool _bCase
@@ -232,7 +232,7 @@ OCollection::OCollection(::cppu::OWeakObject& _rParent
{
if ( _bUseHardRef )
{
- m_pElements.reset(new OHardRefMap< ObjectType >(_bCase));
+ m_pElements.reset(new OHardRefMap< css::uno::Reference< css::beans::XPropertySet > >(_bCase));
}
else
{
@@ -302,7 +302,7 @@ Any SAL_CALL OCollection::getByIndex( sal_Int32 Index )
if (Index < 0 || Index >= m_pElements->size() )
throw IndexOutOfBoundsException(OUString::number(Index),static_cast<XTypeProvider*>(this));
- return makeAny(getObject(Index));
+ return Any(getObject(Index));
}
Any SAL_CALL OCollection::getByName( const OUString& aName )
@@ -319,7 +319,7 @@ Any SAL_CALL OCollection::getByName( const OUString& aName )
throw NoSuchElementException( sError, static_cast< XTypeProvider* >( this ) );
}
- return makeAny(getObject(m_pElements->findColumn(aName)));
+ return Any(getObject(m_pElements->findColumn(aName)));
}
Sequence< OUString > SAL_CALL OCollection::getElementNames( )
@@ -352,7 +352,7 @@ Reference< XPropertySet > SAL_CALL OCollection::createDataDescriptor( )
return createDescriptor();
}
-OUString OCollection::getNameForObject(const ObjectType& _xObject)
+OUString OCollection::getNameForObject(const css::uno::Reference< css::beans::XPropertySet >& _xObject)
{
OSL_ENSURE(_xObject.is(),"OCollection::getNameForObject: Object is NULL!");
OUString sName;
@@ -370,11 +370,11 @@ void SAL_CALL OCollection::appendByDescriptor( const Reference< XPropertySet >&
if ( m_pElements->exists(sName) )
throw ElementExistException(sName,static_cast<XTypeProvider*>(this));
- ObjectType xNewlyCreated = appendObject( sName, descriptor );
+ css::uno::Reference< css::beans::XPropertySet > xNewlyCreated = appendObject( sName, descriptor );
if ( !xNewlyCreated.is() )
throw RuntimeException();
- ODescriptor* pDescriptor = comphelper::getUnoTunnelImplementation<ODescriptor>( xNewlyCreated );
+ ODescriptor* pDescriptor = dynamic_cast<ODescriptor*>( xNewlyCreated.get() );
if ( pDescriptor )
pDescriptor->setNew( false );
@@ -383,7 +383,7 @@ void SAL_CALL OCollection::appendByDescriptor( const Reference< XPropertySet >&
m_pElements->insert( sName, xNewlyCreated );
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(sName), makeAny(xNewlyCreated), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(sName), Any(xNewlyCreated), Any());
aGuard.clear();
m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
@@ -423,20 +423,17 @@ void OCollection::dropImpl(sal_Int32 _nIndex, bool _bReallyDrop)
void OCollection::notifyElementRemoved(const OUString& _sName)
{
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_sName), Any(), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_sName), Any(), Any());
// note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment
- OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners);
+ OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementRemoved(aEvent);
+ aListenerLoop.next()->elementRemoved(aEvent);
}
sal_Int32 SAL_CALL OCollection::findColumn( const OUString& columnName )
{
if ( !m_pElements->exists(columnName) )
- {
::dbtools::throwInvalidColumnException( columnName, static_cast< XIndexAccess*>(this) );
- O3TL_UNREACHABLE;
- }
return m_pElements->findColumn(columnName) + 1; // because columns start at one
}
@@ -458,12 +455,12 @@ void SAL_CALL OCollection::removeContainerListener( const Reference< XContainerL
m_aContainerListeners.removeInterface(_rxListener);
}
-void SAL_CALL OCollection::acquire() throw()
+void SAL_CALL OCollection::acquire() noexcept
{
m_rParent.acquire();
}
-void SAL_CALL OCollection::release() throw()
+void SAL_CALL OCollection::release() noexcept
{
m_rParent.release();
}
@@ -501,7 +498,7 @@ void SAL_CALL OCollection::removeRefreshListener( const Reference< XRefreshListe
m_aRefreshListeners.removeInterface(l);
}
-void OCollection::insertElement(const OUString& _sElementName,const ObjectType& _xElement)
+void OCollection::insertElement(const OUString& _sElementName,const css::uno::Reference< css::beans::XPropertySet >& _xElement)
{
OSL_ENSURE(!m_pElements->exists(_sElementName),"Element already exists");
if ( !m_pElements->exists(_sElementName) )
@@ -517,17 +514,17 @@ void OCollection::renameObject(const OUString& _sOldName, const OUString& _sNewN
if ( m_pElements->rename(_sOldName,_sNewName) )
{
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_sNewName), makeAny(m_pElements->getObject(_sNewName)),makeAny(_sOldName));
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_sNewName), Any(m_pElements->getObject(_sNewName)),Any(_sOldName));
// note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment
- OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners);
+ OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementReplaced(aEvent);
+ aListenerLoop.next()->elementReplaced(aEvent);
}
}
-ObjectType OCollection::getObject(sal_Int32 _nIndex)
+css::uno::Reference< css::beans::XPropertySet > OCollection::getObject(sal_Int32 _nIndex)
{
- ObjectType xName = m_pElements->getObject(_nIndex);
+ css::uno::Reference< css::beans::XPropertySet > xName = m_pElements->getObject(_nIndex);
if ( !xName.is() )
{
try
@@ -562,14 +559,14 @@ Reference< XPropertySet > OCollection::createDescriptor()
throw SQLException();
}
-ObjectType OCollection::cloneDescriptor( const ObjectType& _descriptor )
+css::uno::Reference< css::beans::XPropertySet > OCollection::cloneDescriptor( const css::uno::Reference< css::beans::XPropertySet >& _descriptor )
{
- ObjectType xNewDescriptor( createDescriptor() );
+ css::uno::Reference< css::beans::XPropertySet > xNewDescriptor( createDescriptor() );
::comphelper::copyProperties( _descriptor, xNewDescriptor );
return xNewDescriptor;
}
-ObjectType OCollection::appendObject( const OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
+css::uno::Reference< css::beans::XPropertySet > OCollection::appendObject( const OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
{
return cloneDescriptor( descriptor );
}
diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx
index 23993453101a..bae1f7140c8a 100644
--- a/connectivity/source/sdbcx/VColumn.cxx
+++ b/connectivity/source/sdbcx/VColumn.cxx
@@ -23,6 +23,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <TConnection.hxx>
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <utility>
using namespace connectivity;
using namespace connectivity::sdbcx;
@@ -36,13 +37,13 @@ using namespace ::com::sun::star::sdbc;
OUString SAL_CALL OColumn::getImplementationName( )
{
if(isNew())
- return "com.sun.star.sdbcx.VColumnDescriptor";
- return "com.sun.star.sdbcx.VColumn";
+ return u"com.sun.star.sdbcx.VColumnDescriptor"_ustr;
+ return u"com.sun.star.sdbcx.VColumn"_ustr;
}
css::uno::Sequence< OUString > SAL_CALL OColumn::getSupportedServiceNames( )
{
- return { isNew()?OUString("com.sun.star.sdbcx.ColumnDescriptor"):OUString("com.sun.star.sdbcx.Column") };
+ return { isNew()?u"com.sun.star.sdbcx.ColumnDescriptor"_ustr:u"com.sun.star.sdbcx.Column"_ustr };
}
sal_Bool SAL_CALL OColumn::supportsService( const OUString& _rServiceName )
@@ -65,9 +66,9 @@ OColumn::OColumn(bool _bCase)
}
OColumn::OColumn( const OUString& Name,
- const OUString& TypeName,
- const OUString& DefaultValue,
- const OUString& Description,
+ OUString TypeName,
+ OUString DefaultValue,
+ OUString Description,
sal_Int32 IsNullable,
sal_Int32 Precision,
sal_Int32 Scale,
@@ -76,14 +77,14 @@ OColumn::OColumn( const OUString& Name,
bool IsRowVersion,
bool IsCurrency,
bool _bCase,
- const OUString& CatalogName,
- const OUString& SchemaName,
- const OUString& TableName)
+ OUString CatalogName,
+ OUString SchemaName,
+ OUString TableName)
:OColumnDescriptor_BASE(m_aMutex)
,ODescriptor(OColumnDescriptor_BASE::rBHelper,_bCase)
- ,m_TypeName(TypeName)
- ,m_Description(Description)
- ,m_DefaultValue(DefaultValue)
+ ,m_TypeName(std::move(TypeName))
+ ,m_Description(std::move(Description))
+ ,m_DefaultValue(std::move(DefaultValue))
,m_IsNullable(IsNullable)
,m_Precision(Precision)
,m_Scale(Scale)
@@ -91,9 +92,9 @@ OColumn::OColumn( const OUString& Name,
,m_IsAutoIncrement(IsAutoIncrement)
,m_IsRowVersion(IsRowVersion)
,m_IsCurrency(IsCurrency)
- ,m_CatalogName(CatalogName)
- ,m_SchemaName(SchemaName)
- ,m_TableName(TableName)
+ ,m_CatalogName(std::move(CatalogName))
+ ,m_SchemaName(std::move(SchemaName))
+ ,m_TableName(std::move(TableName))
{
m_Name = Name;
@@ -114,12 +115,12 @@ OColumn::~OColumn()
return *OColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
}
-void SAL_CALL OColumn::acquire() throw()
+void SAL_CALL OColumn::acquire() noexcept
{
OColumnDescriptor_BASE::acquire();
}
-void SAL_CALL OColumn::release() throw()
+void SAL_CALL OColumn::release() noexcept
{
OColumnDescriptor_BASE::release();
}
@@ -169,10 +170,6 @@ void OColumn::construct()
void OColumn::disposing()
{
OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed);
-
}
Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor( )
@@ -180,8 +177,7 @@ Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor( )
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed);
-
- OColumn* pNewColumn = new OColumn( m_Name,
+ rtl::Reference<OColumn> pNewColumn = new OColumn( m_Name,
m_TypeName,
m_DefaultValue,
m_Description,
diff --git a/connectivity/source/sdbcx/VDescriptor.cxx b/connectivity/source/sdbcx/VDescriptor.cxx
index 8a32a1b58b39..d6ceabc96837 100644
--- a/connectivity/source/sdbcx/VDescriptor.cxx
+++ b/connectivity/source/sdbcx/VDescriptor.cxx
@@ -28,7 +28,6 @@
namespace connectivity::sdbcx
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
@@ -44,14 +43,6 @@ namespace connectivity::sdbcx
// css::lang::XUnoTunnel
- sal_Int64 SAL_CALL ODescriptor::getSomething( const Sequence< sal_Int8 >& rId )
- {
- return (isUnoTunnelId<ODescriptor>(rId))
- ? reinterpret_cast< sal_Int64 >( this )
- : 0;
- }
-
-
namespace
{
struct ResetROAttribute
@@ -76,10 +67,11 @@ namespace connectivity::sdbcx
Sequence< Property > aProperties;
describeProperties( aProperties );
+ auto [begin, end] = asNonConstRange(aProperties);
if ( isNew() )
- std::for_each( aProperties.begin(), aProperties.end(), ResetROAttribute() );
+ std::for_each( begin, end, ResetROAttribute() );
else
- std::for_each( aProperties.begin(), aProperties.end(), SetROAttribute() );
+ std::for_each( begin, end, SetROAttribute() );
return new ::cppu::OPropertyArrayHelper( aProperties );
}
@@ -87,26 +79,11 @@ namespace connectivity::sdbcx
bool ODescriptor::isNew( const Reference< XInterface >& _rxDescriptor )
{
- ODescriptor* pImplementation = comphelper::getUnoTunnelImplementation<ODescriptor>( _rxDescriptor );
+ ODescriptor* pImplementation = dynamic_cast<ODescriptor*>( _rxDescriptor.get() );
return pImplementation && pImplementation->isNew();
}
- Sequence< sal_Int8 > ODescriptor::getUnoTunnelId()
- {
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
- }
-
-
- Any SAL_CALL ODescriptor::queryInterface( const Type & rType )
- {
- Any aRet = ::cppu::queryInterface(rType,static_cast< XUnoTunnel*> (this));
- return aRet.hasValue() ? aRet : ODescriptor_PBASE::queryInterface(rType);
- }
-
-
void ODescriptor::setNew(bool _bNew)
{
m_bNew = _bNew;
@@ -117,8 +94,7 @@ namespace connectivity::sdbcx
{
::cppu::OTypeCollection aTypes( cppu::UnoType<XMultiPropertySet>::get(),
cppu::UnoType<XFastPropertySet>::get(),
- cppu::UnoType<XPropertySet>::get(),
- cppu::UnoType<XUnoTunnel>::get());
+ cppu::UnoType<XPropertySet>::get());
return aTypes.getTypes();
}
diff --git a/connectivity/source/sdbcx/VGroup.cxx b/connectivity/source/sdbcx/VGroup.cxx
index ed11a617526f..c2a789a90574 100644
--- a/connectivity/source/sdbcx/VGroup.cxx
+++ b/connectivity/source/sdbcx/VGroup.cxx
@@ -26,13 +26,12 @@
using namespace ::connectivity::sdbcx;
using namespace ::connectivity;
using namespace ::dbtools;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
-IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group");
+IMPLEMENT_SERVICE_INFO(OGroup,u"com.sun.star.sdbcx.VGroup"_ustr,u"com.sun.star.sdbcx.Group"_ustr);
OGroup::OGroup(bool _bCase) : OGroup_BASE(m_aMutex)
, ODescriptor(OGroup_BASE::rBHelper,_bCase)
@@ -126,14 +125,14 @@ void SAL_CALL OGroup::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OGroup_BASE::rBHelper.bDisposed);
- throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
+ throwFeatureNotImplementedSQLException( u"XAuthorizable::grantPrivileges"_ustr, *this );
}
void SAL_CALL OGroup::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OGroup_BASE::rBHelper.bDisposed);
- throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
+ throwFeatureNotImplementedSQLException( u"XAuthorizable::revokePrivileges"_ustr, *this );
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( )
@@ -148,16 +147,16 @@ OUString SAL_CALL OGroup::getName( )
void SAL_CALL OGroup::setName( const OUString& /*aName*/ )
{
- throwFeatureNotImplementedRuntimeException( "XNamed::setName", *this );
+ throwFeatureNotImplementedRuntimeException( u"XNamed::setName"_ustr, *this );
}
// XInterface
-void SAL_CALL OGroup::acquire() throw()
+void SAL_CALL OGroup::acquire() noexcept
{
OGroup_BASE::acquire();
}
-void SAL_CALL OGroup::release() throw()
+void SAL_CALL OGroup::release() noexcept
{
OGroup_BASE::release();
}
diff --git a/connectivity/source/sdbcx/VIndex.cxx b/connectivity/source/sdbcx/VIndex.cxx
index 1649ff83ad97..b69c1414d9f7 100644
--- a/connectivity/source/sdbcx/VIndex.cxx
+++ b/connectivity/source/sdbcx/VIndex.cxx
@@ -24,7 +24,8 @@
#include <connectivity/sdbcx/VCollection.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <TConnection.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::connectivity;
using namespace ::dbtools;
@@ -32,7 +33,6 @@ using namespace ::connectivity::sdbcx;
using namespace ::cppu;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
@@ -41,13 +41,13 @@ using namespace ::com::sun::star::lang;
OUString SAL_CALL OIndex::getImplementationName( )
{
if(isNew())
- return "com.sun.star.sdbcx.VIndexDescriptor";
- return "com.sun.star.sdbcx.VIndex";
+ return u"com.sun.star.sdbcx.VIndexDescriptor"_ustr;
+ return u"com.sun.star.sdbcx.VIndex"_ustr;
}
css::uno::Sequence< OUString > SAL_CALL OIndex::getSupportedServiceNames( )
{
- return { isNew()?OUString("com.sun.star.sdbcx.IndexDescriptor"):OUString("com.sun.star.sdbcx.Index") };
+ return { isNew()?u"com.sun.star.sdbcx.IndexDescriptor"_ustr:u"com.sun.star.sdbcx.Index"_ustr };
}
sal_Bool SAL_CALL OIndex::supportsService( const OUString& _rServiceName )
@@ -64,13 +64,13 @@ OIndex::OIndex(bool _bCase) : ODescriptor_BASE(m_aMutex)
}
OIndex::OIndex( const OUString& Name,
- const OUString& Catalog,
+ OUString Catalog,
bool _isUnique,
bool _isPrimaryKeyIndex,
bool _isClustered,
bool _bCase) : ODescriptor_BASE(m_aMutex)
,ODescriptor(ODescriptor_BASE::rBHelper, _bCase)
- ,m_Catalog(Catalog)
+ ,m_Catalog(std::move(Catalog))
,m_IsUnique(_isUnique)
,m_IsPrimaryKeyIndex(_isPrimaryKeyIndex)
,m_IsClustered(_isClustered)
@@ -181,12 +181,12 @@ void SAL_CALL OIndex::setName( const OUString& /*aName*/ )
}
// XInterface
-void SAL_CALL OIndex::acquire() throw()
+void SAL_CALL OIndex::acquire() noexcept
{
ODescriptor_BASE::acquire();
}
-void SAL_CALL OIndex::release() throw()
+void SAL_CALL OIndex::release() noexcept
{
ODescriptor_BASE::release();
}
diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx
index edd1ea93e9a2..4f55fc864167 100644
--- a/connectivity/source/sdbcx/VIndexColumn.cxx
+++ b/connectivity/source/sdbcx/VIndexColumn.cxx
@@ -30,13 +30,13 @@ using namespace ::com::sun::star::uno;
OUString SAL_CALL OIndexColumn::getImplementationName( )
{
if(isNew())
- return "com.sun.star.sdbcx.VIndexColumnDescriptor";
- return "com.sun.star.sdbcx.VIndexColumn";
+ return u"com.sun.star.sdbcx.VIndexColumnDescriptor"_ustr;
+ return u"com.sun.star.sdbcx.VIndexColumn"_ustr;
}
css::uno::Sequence< OUString > SAL_CALL OIndexColumn::getSupportedServiceNames( )
{
- return { isNew()?OUString("com.sun.star.sdbcx.IndexColumnDescriptor"):OUString("com.sun.star.sdbcx.IndexColumn") };
+ return { isNew()?u"com.sun.star.sdbcx.IndexColumnDescriptor"_ustr:u"com.sun.star.sdbcx.IndexColumn"_ustr };
}
sal_Bool SAL_CALL OIndexColumn::supportsService( const OUString& _rServiceName )
diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx
index 33e9340b51c7..0780d13fc944 100644
--- a/connectivity/source/sdbcx/VKey.cxx
+++ b/connectivity/source/sdbcx/VKey.cxx
@@ -24,12 +24,12 @@
#include <cppuhelper/supportsservice.hxx>
#include <connectivity/sdbcx/VCollection.hxx>
#include <TConnection.hxx>
+#include <utility>
using namespace connectivity;
using namespace connectivity::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
@@ -38,13 +38,13 @@ using namespace ::com::sun::star::lang;
OUString SAL_CALL OKey::getImplementationName( )
{
if(isNew())
- return "com.sun.star.sdbcx.VKeyDescriptor";
- return "com.sun.star.sdbcx.VKey";
+ return u"com.sun.star.sdbcx.VKeyDescriptor"_ustr;
+ return u"com.sun.star.sdbcx.VKey"_ustr;
}
css::uno::Sequence< OUString > SAL_CALL OKey::getSupportedServiceNames( )
{
- return { isNew()?OUString("com.sun.star.sdbcx.KeyDescriptor"):OUString("com.sun.star.sdbcx.Key") };
+ return { isNew()?u"com.sun.star.sdbcx.KeyDescriptor"_ustr:u"com.sun.star.sdbcx.Key"_ustr };
}
sal_Bool SAL_CALL OKey::supportsService( const OUString& _rServiceName )
@@ -58,10 +58,10 @@ OKey::OKey(bool _bCase) : ODescriptor_BASE(m_aMutex)
{
}
-OKey::OKey(const OUString& Name,const std::shared_ptr<KeyProperties>& _rProps, bool _bCase)
+OKey::OKey(const OUString& Name,std::shared_ptr<KeyProperties> _xProps, bool _bCase)
: ODescriptor_BASE(m_aMutex)
,ODescriptor(ODescriptor_BASE::rBHelper, _bCase)
- ,m_aProps(_rProps)
+ ,m_aProps(std::move(_xProps))
{
m_Name = Name;
}
@@ -188,12 +188,12 @@ void SAL_CALL OKey::setName( const OUString& /*aName*/ )
}
// XInterface
-void SAL_CALL OKey::acquire() throw()
+void SAL_CALL OKey::acquire() noexcept
{
ODescriptor_BASE::acquire();
}
-void SAL_CALL OKey::release() throw()
+void SAL_CALL OKey::release() noexcept
{
ODescriptor_BASE::release();
}
diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx
index b6f69e65c9de..4bf85159d932 100644
--- a/connectivity/source/sdbcx/VKeyColumn.cxx
+++ b/connectivity/source/sdbcx/VKeyColumn.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <TConnection.hxx>
+#include <utility>
using namespace connectivity;
using namespace connectivity::sdbcx;
@@ -31,13 +32,13 @@ using namespace cppu;
OUString SAL_CALL OKeyColumn::getImplementationName( )
{
if(isNew())
- return "com.sun.star.sdbcx.VKeyColumnDescriptor";
- return "com.sun.star.sdbcx.VKeyColumn";
+ return u"com.sun.star.sdbcx.VKeyColumnDescriptor"_ustr;
+ return u"com.sun.star.sdbcx.VKeyColumn"_ustr;
}
css::uno::Sequence< OUString > SAL_CALL OKeyColumn::getSupportedServiceNames( )
{
- return { isNew()?OUString("com.sun.star.sdbcx.KeyColumnDescriptor"):OUString("com.sun.star.sdbcx.KeyColumn") };
+ return { isNew()?u"com.sun.star.sdbcx.KeyColumnDescriptor"_ustr:u"com.sun.star.sdbcx.KeyColumn"_ustr };
}
sal_Bool SAL_CALL OKeyColumn::supportsService( const OUString& _rServiceName )
@@ -50,7 +51,7 @@ OKeyColumn::OKeyColumn(bool _bCase) : OColumn(_bCase)
construct();
}
-OKeyColumn::OKeyColumn( const OUString& ReferencedColumn,
+OKeyColumn::OKeyColumn( OUString ReferencedColumn,
const OUString& Name,
const OUString& TypeName,
const OUString& DefaultValue,
@@ -77,7 +78,7 @@ OKeyColumn::OKeyColumn( const OUString& ReferencedColumn,
CatalogName,
SchemaName,
TableName)
- , m_ReferencedColumn(ReferencedColumn)
+ , m_ReferencedColumn(std::move(ReferencedColumn))
{
construct();
}
diff --git a/connectivity/source/sdbcx/VTable.cxx b/connectivity/source/sdbcx/VTable.cxx
index 90c7427823c0..afa70c87b745 100644
--- a/connectivity/source/sdbcx/VTable.cxx
+++ b/connectivity/source/sdbcx/VTable.cxx
@@ -25,6 +25,7 @@
#include <connectivity/dbtools.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <utility>
using namespace ::connectivity;
using namespace ::connectivity::sdbcx;
@@ -40,14 +41,14 @@ using namespace ::com::sun::star::lang;
OUString SAL_CALL OTable::getImplementationName( )
{
if(isNew())
- return "com.sun.star.sdbcx.VTableDescriptor";
- return "com.sun.star.sdbcx.Table";
+ return u"com.sun.star.sdbcx.VTableDescriptor"_ustr;
+ return u"com.sun.star.sdbcx.Table"_ustr;
}
css::uno::Sequence< OUString > SAL_CALL OTable::getSupportedServiceNames( )
{
- return { isNew()?OUString("com.sun.star.sdbcx.TableDescriptor"):OUString("com.sun.star.sdbcx.Table") };
+ return { isNew()?u"com.sun.star.sdbcx.TableDescriptor"_ustr:u"com.sun.star.sdbcx.Table"_ustr };
}
sal_Bool SAL_CALL OTable::supportsService( const OUString& _rServiceName )
@@ -65,14 +66,14 @@ OTable::OTable(OCollection* _pTables,
OTable::OTable( OCollection* _pTables,
bool _bCase,
- const OUString& Name, const OUString& Type,
- const OUString& Description,const OUString& SchemaName,
- const OUString& CatalogName) : OTableDescriptor_BASE(m_aMutex)
+ const OUString& Name, OUString Type,
+ OUString Description, OUString SchemaName,
+ OUString CatalogName) : OTableDescriptor_BASE(m_aMutex)
,ODescriptor(OTableDescriptor_BASE::rBHelper,_bCase)
- ,m_CatalogName(CatalogName)
- ,m_SchemaName(SchemaName)
- ,m_Description(Description)
- ,m_Type(Type)
+ ,m_CatalogName(std::move(CatalogName))
+ ,m_SchemaName(std::move(SchemaName))
+ ,m_Description(std::move(Description))
+ ,m_Type(std::move(Type))
,m_pTables(_pTables)
{
m_Name = Name;
@@ -94,12 +95,12 @@ void OTable::construct()
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE), PROPERTY_ID_TYPE, nAttrib,&m_Type, ::cppu::UnoType<OUString>::get());
}
-void SAL_CALL OTable::acquire() throw()
+void SAL_CALL OTable::acquire() noexcept
{
OTableDescriptor_BASE::acquire();
}
-void SAL_CALL OTable::release() throw()
+void SAL_CALL OTable::release() noexcept
{
OTableDescriptor_BASE::release();
}
@@ -210,7 +211,7 @@ Reference< XPropertySet > SAL_CALL OTable::createDataDescriptor( )
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed);
- OTable* pTable = new OTable(m_pTables,isCaseSensitive(),m_Name,m_Type,m_Description,m_SchemaName,m_CatalogName);
+ rtl::Reference<OTable> pTable = new OTable(m_pTables,isCaseSensitive(),m_Name,m_Type,m_Description,m_SchemaName,m_CatalogName);
pTable->setNew(true);
return pTable;
}
@@ -263,12 +264,12 @@ Reference< XDatabaseMetaData> OTable::getMetaData() const
// XAlterTable
void SAL_CALL OTable::alterColumnByName( const OUString& /*colName*/, const Reference< XPropertySet >& /*descriptor*/ )
{
- throwFeatureNotImplementedSQLException( "XAlterTable::alterColumnByName", *this );
+ throwFeatureNotImplementedSQLException( u"XAlterTable::alterColumnByName"_ustr, *this );
}
void SAL_CALL OTable::alterColumnByIndex( sal_Int32 /*index*/, const Reference< XPropertySet >& /*descriptor*/ )
{
- throwFeatureNotImplementedSQLException( "XAlterTable::alterColumnByIndex", *this );
+ throwFeatureNotImplementedSQLException( u"XAlterTable::alterColumnByIndex"_ustr, *this );
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OTable::getPropertySetInfo( )
diff --git a/connectivity/source/sdbcx/VUser.cxx b/connectivity/source/sdbcx/VUser.cxx
index 9cecd7dfdd46..0e897260e032 100644
--- a/connectivity/source/sdbcx/VUser.cxx
+++ b/connectivity/source/sdbcx/VUser.cxx
@@ -22,17 +22,17 @@
#include <connectivity/sdbcx/VCollection.hxx>
#include <connectivity/dbexception.hxx>
#include <comphelper/sequence.hxx>
+#include <o3tl/unreachable.hxx>
using namespace connectivity;
using namespace connectivity::sdbcx;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-IMPLEMENT_SERVICE_INFO(OUser,"com.sun.star.sdbcx.VUser","com.sun.star.sdbcx.User");
+IMPLEMENT_SERVICE_INFO(OUser,u"com.sun.star.sdbcx.VUser"_ustr,u"com.sun.star.sdbcx.User"_ustr);
OUser::OUser(bool _bCase) : OUser_BASE(m_aMutex)
, ODescriptor(OUser_BASE::rBHelper,_bCase,true)
@@ -86,7 +86,7 @@ void SAL_CALL OUser::changePassword( const OUString& /*objPassword*/, const OUSt
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XUser::changePassword", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XUser::changePassword"_ustr, *this );
}
// XGroupsSupplier
@@ -113,40 +113,32 @@ Reference< XNameAccess > SAL_CALL OUser::getGroups( )
return m_pGroups.get();
}
-
-SAL_WNOUNREACHABLE_CODE_PUSH
-
sal_Int32 SAL_CALL OUser::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::changePassword", *this );
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XAuthorizable::changePassword"_ustr, *this );
}
sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::getGrantablePrivileges", *this );
- return 0;
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XAuthorizable::getGrantablePrivileges"_ustr, *this );
}
-SAL_WNOUNREACHABLE_CODE_POP
-
-
void SAL_CALL OUser::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XAuthorizable::grantPrivileges"_ustr, *this );
}
void SAL_CALL OUser::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
+ ::dbtools::throwFeatureNotImplementedSQLException( u"XAuthorizable::revokePrivileges"_ustr, *this );
}
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OUser::getPropertySetInfo( )
@@ -166,12 +158,12 @@ void SAL_CALL OUser::setName( const OUString& /*aName*/ )
}
// XInterface
-void SAL_CALL OUser::acquire() throw()
+void SAL_CALL OUser::acquire() noexcept
{
OUser_BASE::acquire();
}
-void SAL_CALL OUser::release() throw()
+void SAL_CALL OUser::release() noexcept
{
OUser_BASE::release();
}
diff --git a/connectivity/source/sdbcx/VView.cxx b/connectivity/source/sdbcx/VView.cxx
index 317e985b5199..cd634cc68db8 100644
--- a/connectivity/source/sdbcx/VView.cxx
+++ b/connectivity/source/sdbcx/VView.cxx
@@ -22,38 +22,38 @@
#include <comphelper/sequence.hxx>
#include <connectivity/dbtools.hxx>
#include <TConnection.hxx>
+#include <utility>
using namespace connectivity;
using namespace connectivity::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-IMPLEMENT_SERVICE_INFO(OView,"com.sun.star.sdbcx.VView","com.sun.star.sdbcx.View");
+IMPLEMENT_SERVICE_INFO(OView,u"com.sun.star.sdbcx.VView"_ustr,u"com.sun.star.sdbcx.View"_ustr);
OView::OView(bool _bCase,
const OUString& Name,
- const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData,
- const OUString& Command,
- const OUString& SchemaName,
- const OUString& CatalogName) : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper,_bCase)
- ,m_CatalogName(CatalogName)
- ,m_SchemaName(SchemaName)
- ,m_Command(Command)
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData,
+ OUString Command,
+ OUString SchemaName,
+ OUString CatalogName) : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper,_bCase)
+ ,m_CatalogName(std::move(CatalogName))
+ ,m_SchemaName(std::move(SchemaName))
+ ,m_Command(std::move(Command))
,m_CheckOption(0)
- ,m_xMetaData(_xMetaData)
+ ,m_xMetaData(std::move(_xMetaData))
{
m_Name = Name;
construct();
}
-OView::OView(bool _bCase, const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData)
+OView::OView(bool _bCase, css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData)
: ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper, _bCase, true)
- ,m_xMetaData(_xMetaData)
+ ,m_xMetaData(std::move(_xMetaData))
{
construct();
}
@@ -118,12 +118,12 @@ void SAL_CALL OView::setName( const OUString& )
{
}
-void SAL_CALL OView::acquire() throw()
+void SAL_CALL OView::acquire() noexcept
{
OView_BASE::acquire();
}
-void SAL_CALL OView::release() throw()
+void SAL_CALL OView::release() noexcept
{
OView_BASE::release();
}
diff --git a/connectivity/workben/skeleton/SResultSet.hxx b/connectivity/workben/skeleton/SResultSet.hxx
index c12b1e924e94..e7e5367b8c69 100644
--- a/connectivity/workben/skeleton/SResultSet.hxx
+++ b/connectivity/workben/skeleton/SResultSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_WORKBEN_SKELETON_SRESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_WORKBEN_SKELETON_SRESULTSET_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -37,201 +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);
+ };
+}
}
-#endif // INCLUDED_CONNECTIVITY_WORKBEN_SKELETON_SRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */