summaryrefslogtreecommitdiff
path: root/connectivity/source
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/commontools/AutoRetrievingBase.cxx3
-rw-r--r--connectivity/source/commontools/BlobHelper.cxx14
-rw-r--r--connectivity/source/commontools/CommonTools.cxx17
-rw-r--r--connectivity/source/commontools/ConnectionWrapper.cxx6
-rw-r--r--connectivity/source/commontools/DateConversion.cxx31
-rw-r--r--connectivity/source/commontools/DriversConfig.cxx32
-rw-r--r--connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx137
-rw-r--r--connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx2
-rw-r--r--connectivity/source/commontools/FValue.cxx11
-rw-r--r--connectivity/source/commontools/ParameterSubstitution.cxx3
-rw-r--r--connectivity/source/commontools/RowFunctionParser.cxx45
-rw-r--r--connectivity/source/commontools/TColumnsHelper.cxx2
-rw-r--r--connectivity/source/commontools/TConnection.cxx3
-rw-r--r--connectivity/source/commontools/TDatabaseMetaDataBase.cxx14
-rw-r--r--connectivity/source/commontools/TIndex.cxx3
-rw-r--r--connectivity/source/commontools/TIndexColumns.cxx2
-rw-r--r--connectivity/source/commontools/TIndexes.cxx13
-rw-r--r--connectivity/source/commontools/TKey.cxx3
-rw-r--r--connectivity/source/commontools/TKeyColumns.cxx2
-rw-r--r--connectivity/source/commontools/TKeys.cxx29
-rw-r--r--connectivity/source/commontools/TPrivilegesResultSet.cxx12
-rw-r--r--connectivity/source/commontools/TTableHelper.cxx23
-rw-r--r--connectivity/source/commontools/conncleanup.cxx8
-rw-r--r--connectivity/source/commontools/dbcharset.cxx15
-rw-r--r--connectivity/source/commontools/dbconversion.cxx127
-rw-r--r--connectivity/source/commontools/dbexception.cxx22
-rw-r--r--connectivity/source/commontools/dbmetadata.cxx5
-rw-r--r--connectivity/source/commontools/dbtools.cxx84
-rw-r--r--connectivity/source/commontools/dbtools2.cxx97
-rw-r--r--connectivity/source/commontools/filtermanager.cxx17
-rw-r--r--connectivity/source/commontools/formattedcolumnvalue.cxx6
-rw-r--r--connectivity/source/commontools/parameters.cxx20
-rw-r--r--connectivity/source/commontools/paramwrapper.cxx32
-rw-r--r--connectivity/source/commontools/predicateinput.cxx14
-rw-r--r--connectivity/source/commontools/propertyids.cxx1
-rw-r--r--connectivity/source/commontools/sqlerror.cxx2
-rw-r--r--connectivity/source/commontools/statementcomposer.cxx6
-rw-r--r--connectivity/source/commontools/warningscontainer.cxx6
-rw-r--r--connectivity/source/cpool/ZConnectionPool.cxx15
-rw-r--r--connectivity/source/cpool/ZConnectionPool.hxx5
-rw-r--r--connectivity/source/cpool/ZConnectionWrapper.cxx1
-rw-r--r--connectivity/source/cpool/ZDriverWrapper.cxx2
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx69
-rw-r--r--connectivity/source/drivers/ado/AColumn.cxx17
-rw-r--r--connectivity/source/drivers/ado/AColumns.cxx2
-rw-r--r--connectivity/source/drivers/ado/AConnection.cxx41
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaData.cxx6
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx19
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx53
-rw-r--r--connectivity/source/drivers/ado/ADriver.cxx2
-rw-r--r--connectivity/source/drivers/ado/AGroup.cxx17
-rw-r--r--connectivity/source/drivers/ado/AGroups.cxx2
-rw-r--r--connectivity/source/drivers/ado/AIndex.cxx14
-rw-r--r--connectivity/source/drivers/ado/AIndexes.cxx2
-rw-r--r--connectivity/source/drivers/ado/AKey.cxx14
-rw-r--r--connectivity/source/drivers/ado/AKeys.cxx2
-rw-r--r--connectivity/source/drivers/ado/APreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx55
-rw-r--r--connectivity/source/drivers/ado/AStatement.cxx93
-rw-r--r--connectivity/source/drivers/ado/ATable.cxx16
-rw-r--r--connectivity/source/drivers/ado/ATables.cxx4
-rw-r--r--connectivity/source/drivers/ado/AUser.cxx15
-rw-r--r--connectivity/source/drivers/ado/AUsers.cxx5
-rw-r--r--connectivity/source/drivers/ado/AView.cxx23
-rw-r--r--connectivity/source/drivers/ado/AViews.cxx6
-rw-r--r--connectivity/source/drivers/ado/Aolevariant.cxx68
-rw-r--r--connectivity/source/drivers/ado/Awrapado.cxx268
-rw-r--r--connectivity/source/drivers/ado/adoimp.cxx5
-rw-r--r--connectivity/source/drivers/calc/CCatalog.cxx1
-rw-r--r--connectivity/source/drivers/calc/CConnection.cxx26
-rw-r--r--connectivity/source/drivers/calc/CDatabaseMetaData.cxx19
-rw-r--r--connectivity/source/drivers/calc/CDriver.cxx2
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx25
-rw-r--r--connectivity/source/drivers/calc/CTables.cxx5
-rw-r--r--connectivity/source/drivers/component/CColumns.cxx4
-rw-r--r--connectivity/source/drivers/component/CDatabaseMetaData.cxx125
-rw-r--r--connectivity/source/drivers/component/CPreparedStatement.cxx1
-rw-r--r--connectivity/source/drivers/component/CResultSet.cxx2
-rw-r--r--connectivity/source/drivers/component/CStatement.cxx1
-rw-r--r--connectivity/source/drivers/component/CTable.cxx5
-rw-r--r--connectivity/source/drivers/dbase/DCatalog.cxx1
-rw-r--r--connectivity/source/drivers/dbase/DColumns.cxx4
-rw-r--r--connectivity/source/drivers/dbase/DConnection.cxx2
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx224
-rw-r--r--connectivity/source/drivers/dbase/DDriver.cxx2
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx28
-rw-r--r--connectivity/source/drivers/dbase/DIndexColumns.cxx2
-rw-r--r--connectivity/source/drivers/dbase/DIndexes.cxx17
-rw-r--r--connectivity/source/drivers/dbase/DPreparedStatement.cxx1
-rw-r--r--connectivity/source/drivers/dbase/DResultSet.cxx4
-rw-r--r--connectivity/source/drivers/dbase/DStatement.cxx1
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx98
-rw-r--r--connectivity/source/drivers/dbase/DTables.cxx10
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx7
-rw-r--r--connectivity/source/drivers/evoab2/EApi.cxx1
-rw-r--r--connectivity/source/drivers/evoab2/EApi.h2
-rw-r--r--connectivity/source/drivers/evoab2/NCatalog.cxx3
-rw-r--r--connectivity/source/drivers/evoab2/NColumns.cxx4
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.cxx1
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.hxx1
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx15
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.cxx2
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.hxx2
-rw-r--r--connectivity/source/drivers/evoab2/NPreparedStatement.cxx3
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx16
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.hxx2
-rw-r--r--connectivity/source/drivers/evoab2/NResultSetMetaData.cxx6
-rw-r--r--connectivity/source/drivers/evoab2/NResultSetMetaData.hxx2
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.cxx7
-rw-r--r--connectivity/source/drivers/evoab2/NTable.cxx5
-rw-r--r--connectivity/source/drivers/evoab2/NTables.cxx5
-rw-r--r--connectivity/source/drivers/evoab2/NTables.hxx5
-rw-r--r--connectivity/source/drivers/file/FCatalog.cxx2
-rw-r--r--connectivity/source/drivers/file/FColumns.cxx4
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx22
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx18
-rw-r--r--connectivity/source/drivers/file/FDriver.cxx5
-rw-r--r--connectivity/source/drivers/file/FNumericFunctions.cxx9
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx5
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx21
-rw-r--r--connectivity/source/drivers/file/FResultSetMetaData.cxx11
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx7
-rw-r--r--connectivity/source/drivers/file/FStringFunctions.cxx30
-rw-r--r--connectivity/source/drivers/file/FTable.cxx14
-rw-r--r--connectivity/source/drivers/file/FTables.cxx2
-rw-r--r--connectivity/source/drivers/file/fanalyzer.cxx1
-rw-r--r--connectivity/source/drivers/file/fcode.cxx1
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx2
-rw-r--r--connectivity/source/drivers/firebird/Blob.cxx2
-rw-r--r--connectivity/source/drivers/firebird/Catalog.cxx17
-rw-r--r--connectivity/source/drivers/firebird/Catalog.hxx3
-rw-r--r--connectivity/source/drivers/firebird/Columns.cxx2
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx122
-rw-r--r--connectivity/source/drivers/firebird/Connection.hxx19
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.cxx37
-rw-r--r--connectivity/source/drivers/firebird/Driver.cxx26
-rw-r--r--connectivity/source/drivers/firebird/Driver.hxx4
-rw-r--r--connectivity/source/drivers/firebird/Indexes.cxx3
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx59
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.cxx2
-rw-r--r--connectivity/source/drivers/firebird/ResultSetMetaData.cxx24
-rw-r--r--connectivity/source/drivers/firebird/Statement.cxx9
-rw-r--r--connectivity/source/drivers/firebird/StatementCommonBase.cxx92
-rw-r--r--connectivity/source/drivers/firebird/Table.cxx19
-rw-r--r--connectivity/source/drivers/firebird/Tables.cxx42
-rw-r--r--connectivity/source/drivers/firebird/Tables.hxx7
-rw-r--r--connectivity/source/drivers/firebird/Users.cxx2
-rw-r--r--connectivity/source/drivers/firebird/Util.cxx29
-rw-r--r--connectivity/source/drivers/firebird/Util.hxx12
-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.cxx112
-rw-r--r--connectivity/source/drivers/firebird/Views.hxx42
-rw-r--r--connectivity/source/drivers/flat/ECatalog.cxx1
-rw-r--r--connectivity/source/drivers/flat/EColumns.cxx4
-rw-r--r--connectivity/source/drivers/flat/EConnection.cxx1
-rw-r--r--connectivity/source/drivers/flat/EDatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/flat/EDriver.cxx4
-rw-r--r--connectivity/source/drivers/flat/EPreparedStatement.cxx1
-rw-r--r--connectivity/source/drivers/flat/EResultSet.cxx2
-rw-r--r--connectivity/source/drivers/flat/EStatement.cxx1
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx22
-rw-r--r--connectivity/source/drivers/flat/ETables.cxx7
-rw-r--r--connectivity/source/drivers/hsqldb/HCatalog.cxx3
-rw-r--r--connectivity/source/drivers/hsqldb/HColumns.cxx4
-rw-r--r--connectivity/source/drivers/hsqldb/HConnection.cxx5
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx67
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageAccess.cxx16
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageMap.cxx6
-rw-r--r--connectivity/source/drivers/hsqldb/HTable.cxx17
-rw-r--r--connectivity/source/drivers/hsqldb/HTables.cxx3
-rw-r--r--connectivity/source/drivers/hsqldb/HTerminateListener.cxx1
-rw-r--r--connectivity/source/drivers/hsqldb/HUser.cxx9
-rw-r--r--connectivity/source/drivers/hsqldb/HUsers.cxx7
-rw-r--r--connectivity/source/drivers/hsqldb/HView.cxx6
-rw-r--r--connectivity/source/drivers/hsqldb/HViews.cxx3
-rw-r--r--connectivity/source/drivers/hsqldb/StorageFileAccess.cxx2
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx4
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx4
-rw-r--r--connectivity/source/drivers/jdbc/CallableStatement.cxx1
-rw-r--r--connectivity/source/drivers/jdbc/DatabaseMetaData.cxx5
-rw-r--r--connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx25
-rw-r--r--connectivity/source/drivers/jdbc/JStatement.cxx96
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx1
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx56
-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.cxx1
-rw-r--r--connectivity/source/drivers/macab/MacabAddressBook.cxx11
-rw-r--r--connectivity/source/drivers/macab/MacabCatalog.cxx2
-rw-r--r--connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx4
-rw-r--r--connectivity/source/drivers/macab/MacabDriver.cxx4
-rw-r--r--connectivity/source/drivers/macab/MacabHeader.cxx4
-rw-r--r--connectivity/source/drivers/macab/MacabHeader.hxx1
-rw-r--r--connectivity/source/drivers/macab/MacabRecords.cxx7
-rw-r--r--connectivity/source/drivers/macab/MacabRecords.hxx1
-rw-r--r--connectivity/source/drivers/macab/MacabResultSet.cxx65
-rw-r--r--connectivity/source/drivers/macab/MacabStatement.cxx92
-rw-r--r--connectivity/source/drivers/macab/macabutilities.hxx10
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx2
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx7
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx10
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx2
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YCatalog.cxx3
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YColumns.cxx4
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YDriver.cxx63
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTable.cxx20
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTables.cxx5
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YUser.cxx9
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YUsers.cxx7
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YViews.cxx3
-rw-r--r--connectivity/source/drivers/mysqlc/DataAccess.xcu35
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx46
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_catalog.hxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_column.cxx15
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_columns.cxx19
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_connection.cxx23
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_connection.hxx11
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx132
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_driver.cxx5
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_driver.hxx10
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_general.cxx55
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_general.hxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx18
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_keys.cxx15
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx36
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx12
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx81
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx4
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx4
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_statement.cxx42
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_statement.hxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_table.cxx81
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_table.hxx8
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_tables.cxx113
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_tables.hxx19
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_user.cxx180
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_user.hxx30
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_users.cxx40
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_users.hxx4
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_view.cxx23
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_views.cxx72
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_views.hxx13
-rw-r--r--connectivity/source/drivers/odbc/OConnection.cxx9
-rw-r--r--connectivity/source/drivers/odbc/ODatabaseMetaData.cxx7
-rw-r--r--connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx53
-rw-r--r--connectivity/source/drivers/odbc/ODriver.cxx5
-rw-r--r--connectivity/source/drivers/odbc/OPreparedStatement.cxx4
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx67
-rw-r--r--connectivity/source/drivers/odbc/OResultSetMetaData.cxx1
-rw-r--r--connectivity/source/drivers/odbc/OStatement.cxx98
-rw-r--r--connectivity/source/drivers/postgresql/pq_array.hxx13
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx17
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.hxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx64
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_driver.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx5
-rw-r--r--connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx23
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.hxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultset.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultset.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx20
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx27
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.hxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_statics.cxx37
-rw-r--r--connectivity/source/drivers/postgresql/pq_statics.hxx17
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx96
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.hxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.cxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.hxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xbase.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xbase.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.cxx40
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.cxx32
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindex.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindex.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx16
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.cxx19
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkey.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkey.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx14
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeys.cxx30
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeys.hxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtable.cxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtables.cxx18
-rw-r--r--connectivity/source/drivers/postgresql/pq_xusers.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xview.cxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_xviews.cxx13
-rw-r--r--connectivity/source/drivers/writer/WConnection.cxx11
-rw-r--r--connectivity/source/drivers/writer/WDatabaseMetaData.cxx11
-rw-r--r--connectivity/source/drivers/writer/WDriver.cxx9
-rw-r--r--connectivity/source/drivers/writer/WTable.cxx16
-rw-r--r--connectivity/source/inc/FDatabaseMetaDataResultSet.hxx69
-rw-r--r--connectivity/source/inc/OColumn.hxx5
-rw-r--r--connectivity/source/inc/ParameterSubstitution.hxx2
-rw-r--r--connectivity/source/inc/TConnection.hxx2
-rw-r--r--connectivity/source/inc/TPrivilegesResultSet.hxx4
-rw-r--r--connectivity/source/inc/ado/AColumn.hxx3
-rw-r--r--connectivity/source/inc/ado/AConnection.hxx3
-rw-r--r--connectivity/source/inc/ado/AGroup.hxx4
-rw-r--r--connectivity/source/inc/ado/AIndex.hxx3
-rw-r--r--connectivity/source/inc/ado/AKey.hxx4
-rw-r--r--connectivity/source/inc/ado/ATable.hxx3
-rw-r--r--connectivity/source/inc/ado/AUser.hxx3
-rw-r--r--connectivity/source/inc/ado/AView.hxx4
-rw-r--r--connectivity/source/inc/ado/Aolevariant.hxx21
-rw-r--r--connectivity/source/inc/ado/Awrapado.hxx12
-rw-r--r--connectivity/source/inc/ado/adoimp.hxx5
-rw-r--r--connectivity/source/inc/calc/CTable.hxx4
-rw-r--r--connectivity/source/inc/dbase/DIndex.hxx6
-rw-r--r--connectivity/source/inc/dbase/DTable.hxx5
-rw-r--r--connectivity/source/inc/dbase/dindexnode.hxx20
-rw-r--r--connectivity/source/inc/file/FColumns.hxx2
-rw-r--r--connectivity/source/inc/file/FConnection.hxx2
-rw-r--r--connectivity/source/inc/file/FDriver.hxx2
-rw-r--r--connectivity/source/inc/file/FResultSet.hxx11
-rw-r--r--connectivity/source/inc/file/FResultSetMetaData.hxx2
-rw-r--r--connectivity/source/inc/file/FTable.hxx4
-rw-r--r--connectivity/source/inc/file/fcode.hxx10
-rw-r--r--connectivity/source/inc/file/fcomp.hxx3
-rw-r--r--connectivity/source/inc/flat/ETable.hxx4
-rw-r--r--connectivity/source/inc/hsqldb/HStorageMap.hxx2
-rw-r--r--connectivity/source/inc/hsqldb/HTable.hxx3
-rw-r--r--connectivity/source/inc/hsqldb/HTables.hxx5
-rw-r--r--connectivity/source/inc/hsqldb/HUser.hxx4
-rw-r--r--connectivity/source/inc/hsqldb/HUsers.hxx2
-rw-r--r--connectivity/source/inc/mysql/YDriver.hxx2
-rw-r--r--connectivity/source/inc/mysql/YTable.hxx3
-rw-r--r--connectivity/source/inc/mysql/YTables.hxx5
-rw-r--r--connectivity/source/inc/mysql/YUser.hxx4
-rw-r--r--connectivity/source/inc/mysql/YUsers.hxx2
-rw-r--r--connectivity/source/inc/mysql/YViews.hxx5
-rw-r--r--connectivity/source/inc/odbc/OConnection.hxx2
-rw-r--r--connectivity/source/inc/odbc/ODatabaseMetaData.hxx2
-rw-r--r--connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx2
-rw-r--r--connectivity/source/inc/odbc/ODriver.hxx2
-rw-r--r--connectivity/source/inc/odbc/OFunctions.hxx2
-rw-r--r--connectivity/source/inc/odbc/OPreparedStatement.hxx2
-rw-r--r--connectivity/source/inc/odbc/OResultSet.hxx12
-rw-r--r--connectivity/source/inc/odbc/OResultSetMetaData.hxx4
-rw-r--r--connectivity/source/inc/odbc/OStatement.hxx18
-rw-r--r--connectivity/source/inc/propertyids.hxx124
-rw-r--r--connectivity/source/inc/writer/WConnection.hxx4
-rw-r--r--connectivity/source/inc/writer/WTable.hxx10
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx57
-rw-r--r--connectivity/source/parse/sqlbison.y93
-rw-r--r--connectivity/source/parse/sqlflex.l1
-rw-r--r--connectivity/source/parse/sqliterator.cxx43
-rw-r--r--connectivity/source/parse/sqlnode.cxx384
-rw-r--r--connectivity/source/resource/sharedresources.cxx15
-rw-r--r--connectivity/source/sdbcx/VCollection.cxx12
-rw-r--r--connectivity/source/sdbcx/VColumn.cxx29
-rw-r--r--connectivity/source/sdbcx/VDescriptor.cxx26
-rw-r--r--connectivity/source/sdbcx/VGroup.cxx1
-rw-r--r--connectivity/source/sdbcx/VIndex.cxx8
-rw-r--r--connectivity/source/sdbcx/VKey.cxx6
-rw-r--r--connectivity/source/sdbcx/VKeyColumn.cxx5
-rw-r--r--connectivity/source/sdbcx/VTable.cxx15
-rw-r--r--connectivity/source/sdbcx/VUser.cxx12
-rw-r--r--connectivity/source/sdbcx/VView.cxx22
373 files changed, 3635 insertions, 3770 deletions
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..f1f048a7318e 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,16 @@ 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;
+ O3TL_UNREACHABLE;
}
::sal_Int64 SAL_CALL BlobHelper::positionOfBlob( const css::uno::Reference< css::sdbc::XBlob >& /*pattern*/, ::sal_Int64 /*start*/ )
{
::dbtools::throwFeatureNotImplementedSQLException( "XBlob::positionOfBlob", *this );
- return 0;
+ O3TL_UNREACHABLE;
}
-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 b7467c6933ab..b5f7ce50fe74 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;
@@ -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 9ed4f394b5ee..b8e45fb027e7 100644
--- a/connectivity/source/commontools/ConnectionWrapper.cxx
+++ b/connectivity/source/commontools/ConnectionWrapper.cxx
@@ -162,7 +162,7 @@ sal_Int64 SAL_CALL OConnectionWrapper::getSomething( const Sequence< sal_Int8 >&
}
-Sequence< sal_Int8 > OConnectionWrapper::getUnoTunnelId()
+const Sequence< sal_Int8 > & OConnectionWrapper::getUnoTunnelId()
{
static const comphelper::UnoIdInit implId;
return implId.getSeq();
@@ -202,7 +202,7 @@ void OConnectionWrapper::createUniqueId( const OUString& _rURL
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;
@@ -218,7 +218,7 @@ void OConnectionWrapper::createUniqueId( const OUString& _rURL
Sequence< OUString> aSeq;
if ( prop.Value >>= aSeq )
{
- for(OUString const & s : std::as_const(aSeq))
+ for (OUString const& s : aSeq)
sha1.update(reinterpret_cast<unsigned char const*>(s.getStr()), s.getLength() * sizeof(sal_Unicode));
}
}
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx
index 38f20af0926c..0895881d7ee3 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;
@@ -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);
- static const OUStringLiteral sQuot(u"\'");
- do
- {
- nIndex += 2;
- nIndex = aTemp.indexOf(sQuot,nIndex);
- if(nIndex != -1)
- aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), u"\'\'");
- } while (nIndex != -1);
-
+ aTemp = aTemp.replaceAll(u"\'", u"\'\'");
aRet.append(aTemp);
}
aRet.append("'");
@@ -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;
@@ -162,9 +153,9 @@ 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:
{
@@ -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;
}
}
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx
index e1d492f9f51e..90e361a8e0a8 100644
--- a/connectivity/source/commontools/DriversConfig.cxx
+++ b/connectivity/source/commontools/DriversConfig.cxx
@@ -22,6 +22,7 @@
#include <o3tl/string_view.hxx>
#include <tools/wldcrd.hxx>
#include <comphelper/sequence.hxx>
+#include <utility>
using namespace connectivity;
using namespace utl;
@@ -32,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)
@@ -48,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)
@@ -105,23 +98,20 @@ const TInstalledDrivers& DriversConfigImpl::getInstalledDrivers(const uno::Refer
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))
{
}
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
index 6b9ea06247f5..6b80f9495fe4 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,12 +102,11 @@ 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_aStatement.clear();
m_xMetaData.clear();
m_aRowsIter = m_aRows.end();
m_aRows.clear();
@@ -152,11 +147,10 @@ void ODatabaseMetaDataResultSet::setRows(ORows&& _rRows)
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)
@@ -171,9 +165,9 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& colum
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);
}
@@ -244,9 +238,13 @@ sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex )
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();
@@ -307,28 +305,28 @@ css::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32
}
-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;
+ O3TL_UNREACHABLE;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
-SAL_WNOUNREACHABLE_CODE_POP
-
void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( )
{
@@ -344,49 +342,44 @@ 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;
+ O3TL_UNREACHABLE;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 /*row*/ )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 /*row*/ )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
-SAL_WNOUNREACHABLE_CODE_POP
-
Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( )
{
@@ -394,39 +387,44 @@ Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( )
}
-SAL_WNOUNREACHABLE_CODE_PUSH
-
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( )
{
::dbtools::throwFunctionSequenceException(*this);
- return false;
+ O3TL_UNREACHABLE;
}
-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 +452,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;
@@ -633,13 +630,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())
@@ -744,29 +741,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;
@@ -774,7 +767,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;
@@ -782,7 +775,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;
@@ -790,28 +783,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;
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
index 561953a0796c..291ce7a7d96b 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()
{
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 85da5fba30b3..a21cdb336413 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -965,11 +965,8 @@ OUString ORowSetValue::getString( ) const
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;
@@ -2285,11 +2282,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:
diff --git a/connectivity/source/commontools/ParameterSubstitution.cxx b/connectivity/source/commontools/ParameterSubstitution.cxx
index ca96cf331406..6fa55780803f 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 )
diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx
index 21f5e638a651..f8799848de9b 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 ))
{
}
diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx
index f81eca9f0a90..aeb8b48a649a 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
{
diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx
index 25997b512a3e..c730946a56b7 100644
--- a/connectivity/source/commontools/TConnection.cxx
+++ b/connectivity/source/commontools/TConnection.cxx
@@ -26,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;
@@ -59,7 +58,7 @@ sal_Int64 SAL_CALL OMetaConnection::getSomething( const css::uno::Sequence< sal_
return comphelper::getSomethingImpl(rId, this);
}
-Sequence< sal_Int8 > OMetaConnection::getUnoTunnelId()
+const Sequence< sal_Int8 > & OMetaConnection::getUnoTunnelId()
{
static const comphelper::UnoIdInit implId;
return implId.getSeq();
diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
index 173f87987659..73fb335b5382 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>
@@ -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();
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 1db4426c1888..d190bb2af312 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,
diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx
index b0998b5b3a79..723b4a447a18 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;
@@ -152,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);
@@ -192,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( );
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 0a2c02bb22bb..a26628765417 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,
diff --git a/connectivity/source/commontools/TKeys.cxx b/connectivity/source/commontools/TKeys.cxx
index ab16752677b5..427ab524162e 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,
@@ -155,12 +154,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 )
{
@@ -188,9 +186,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)
{
@@ -200,9 +198,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( );
@@ -236,7 +234,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;
}
@@ -272,10 +270,9 @@ void OKeysHelper::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
}
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 928e9c016a73..71a6986239f5 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;
@@ -104,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() )
@@ -126,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/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx
index 2436776fb177..27c874636069 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -200,20 +200,17 @@ 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);
- 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 ) );
+ _out_rColumns.emplace_back(xRow->getString(4), // COLUMN_NAME,
+ xRow->getInt(5),
+ xRow->getString(6),
+ xRow->getInt(7),
+ xRow->getInt(9),
+ xRow->getInt(11),
+ xRow->getString(12),
+ xRow->getString(13),
+ xRow->getInt(17)); // ORDINAL_POSITION
}
}
@@ -549,7 +546,7 @@ OUString SAL_CALL OTableHelper::getName()
return sComposedName;
}
-OUString OTableHelper::getTableName()
+const OUString & OTableHelper::getTableName()
{
return m_Name;
}
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 d1cfd7ac7f6e..4dd7d5b8e9f3 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -26,6 +26,8 @@
#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>
@@ -60,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;
@@ -79,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)
@@ -90,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)
@@ -102,7 +103,7 @@ 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)
@@ -147,95 +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)
- {
- SAL_WARN_IF(_nMonth < 1 || _nMonth > 12, "connectivity.commontools", "Month has invalid value: " << _nMonth);
- if (_nMonth < 1)
- _nMonth = 1;
- else if (_nMonth > 12)
- _nMonth = 12;
- 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
- {
- 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;
- }
- }
- }
- }
- while ( bCalc );
-
- rMonth = 1;
- while ( nTempDays > implDaysInMonth( rMonth, rYear ) )
+ if (_rDate.Day == 0 && _rDate.Month == 0 && _rDate.Year == 0)
{
- nTempDays -= implDaysInMonth( rMonth, rYear );
- rMonth++;
+ // 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;
}
- 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)
@@ -281,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;
@@ -289,7 +219,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 );
}
static void subDays(const sal_Int32 nDays, css::util::Date& _rDate )
@@ -304,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;
@@ -312,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)
@@ -403,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 = '-';
@@ -412,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);
@@ -440,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,
@@ -448,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 e6663f7d188b..bc5a9be80804 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,11 +176,7 @@ 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, {}, "S1000", 0, m_aContent);
m_aContent <<= aException;
m_eType = TYPE::SQLException;
@@ -194,24 +189,19 @@ Any SQLExceptionInfo::createException(TYPE eType, const OUString& rErrorMessage,
switch (eType)
{
case TYPE::SQLException:
- aAppend <<= SQLException();
+ aAppend <<= SQLException(rErrorMessage, {}, rSQLState, nErrorCode, {});
break;
case TYPE::SQLWarning:
- aAppend <<= SQLWarning();
+ aAppend <<= SQLWarning(rErrorMessage, {}, rSQLState, nErrorCode, {});
break;
case TYPE::SQLContext:
- aAppend <<= 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;
}
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index 0a2123aaa782..8983ee25bada 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>
@@ -135,8 +135,7 @@ namespace dbtools
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;
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index ce6f3a6a03ba..82f981014f3c 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -78,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>
@@ -278,7 +278,7 @@ static Reference< XConnection > getConnection_allowException(
Reference<XInitialization> xIni(xDataSource, UNO_QUERY);
if (xIni.is())
{
- Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(_rxParent) )) };
+ Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", Any(_rxParent) )) };
xIni->initialize(aArgs);
}
@@ -316,7 +316,7 @@ static Reference< XConnection > getConnection_allowException(
if (xIni.is())
{
- Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(Reference<XWindow>()) )) };
+ Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", Any(Reference<XWindow>()) )) };
xIni->initialize(aArgs);
}
@@ -380,7 +380,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
|| ( xExistingConn = findConnection( _rxRowSet ) ).is()
)
{
- xRowSetProps->setPropertyValue("ActiveConnection", makeAny( xExistingConn ) );
+ xRowSetProps->setPropertyValue("ActiveConnection", Any( xExistingConn ) );
// no auto disposer needed, since we did not create the connection
xConnection.reset( xExistingConn, SharedConnection::NoTakeOwnership );
@@ -389,7 +389,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
// build a connection with its current settings (4. data source name, or 5. URL)
- static const OUStringLiteral sUserProp( u"User" );
+ static constexpr OUString sUserProp( u"User"_ustr );
OUString sDataSourceName;
xRowSetProps->getPropertyValue("DataSourceName") >>= sDataSourceName;
OUString sURL;
@@ -425,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 );
}
@@ -453,7 +453,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet,
else
xRowSetProps->setPropertyValue(
"ActiveConnection",
- makeAny( xConnection.getTyped() )
+ Any( xConnection.getTyped() )
);
}
catch(Exception&)
@@ -683,7 +683,7 @@ Reference< XNameAccess > getFieldsByCommandDescriptor( const Reference< XConnect
try
{
if ( xStatementProps.is() )
- xStatementProps->setPropertyValue( "MaxRows", makeAny( sal_Int32( 0 ) ) );
+ xStatementProps->setPropertyValue( "MaxRows", Any( sal_Int32( 0 ) ) );
}
catch( const Exception& )
{
@@ -743,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
@@ -815,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 );
@@ -830,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
)
@@ -912,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);
@@ -944,20 +945,20 @@ try
const Sequence< Property> aOldProperties = xOldInfo->getProperties();
const Sequence< Property> aNewProperties = xNewInfo->getProperties();
- 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" );
+ 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)
{
@@ -1058,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)
@@ -1134,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
@@ -1713,7 +1714,7 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(std::move(aNewParameterSet),xParamsAsIndicies);
aRequest.Parameters = xWrappedParameters;
aRequest.Connection = _xConnection;
- rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aRequest));
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
pRequest->addContinuation(pAbort);
pRequest->addContinuation(pParams);
@@ -1731,15 +1732,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;
@@ -1749,12 +1749,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);
}
}
}
@@ -2016,8 +2016,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 a04015754374..5b486bed168e 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>
@@ -127,31 +127,39 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
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(sTypeName.subView(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);
+ if ( bTimed )
+ aSql.append(")");
+ else
+ nParenPos = sTypeName.indexOf(')',nParenPos);
aSql.append(sTypeName.subView(nParenPos));
}
}
@@ -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();
@@ -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();
@@ -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)
{
@@ -814,7 +814,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 );
@@ -843,22 +843,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;
@@ -945,33 +938,19 @@ 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, "org.openoffice.Office.DataAccess/ReportEngines", -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
if ( aReportEngines.isValid() )
{
OUString sDefaultReportEngineName;
- aReportEngines.getNodeValue(lcl_getDefaultReportEngine()) >>= sDefaultReportEngineName;
+ aReportEngines.getNodeValue("DefaultReportEngine") >>= sDefaultReportEngineName;
if ( !sDefaultReportEngineName.isEmpty() )
{
- ::utl::OConfigurationNode aReportEngineNames = aReportEngines.openNode(lcl_getReportEngineNames());
+ ::utl::OConfigurationNode aReportEngineNames = aReportEngines.openNode("ReportEngineNames");
if ( aReportEngineNames.isValid() )
{
::utl::OConfigurationNode aReportEngine = aReportEngineNames.openNode(sDefaultReportEngineName);
@@ -1018,7 +997,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 ee39aa87830e..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& )
diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx
index e290875236b1..32db3d7177c2 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>
@@ -126,7 +126,9 @@ namespace dbtools
{
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:
@@ -147,7 +149,7 @@ namespace dbtools
// get the format key of our bound field
Reference< XPropertySetInfo > xPSI( _rxColumn->getPropertySetInfo(), UNO_SET_THROW );
bool bHaveFieldFormat = false;
- static const OUStringLiteral sFormatKeyProperty( u"FormatKey" );
+ static constexpr OUString sFormatKeyProperty( u"FormatKey"_ustr );
if ( xPSI->hasPropertyByName( sFormatKeyProperty ) )
{
bHaveFieldFormat = ( _rxColumn->getPropertyValue( sFormatKeyProperty ) >>= _rData.m_nFormatKey );
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index 117282fbd7f3..0e577704de7f 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;
@@ -393,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
@@ -413,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
@@ -650,7 +645,7 @@ namespace dbtools
ParametersRequest aRequest;
aRequest.Parameters = m_pOuterParameters.get();
aRequest.Connection = _rxConnection;
- rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest( makeAny( aRequest ) );
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest( Any( aRequest ) );
// some knittings
pRequest->addContinuation( pAbort );
@@ -674,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() )
@@ -683,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
}
diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx
index 8616277c7ddf..e25a3e7b4905 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
@@ -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 ] ) );
+ 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,16 +323,13 @@ 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();
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index 047f9ccc7c94..cbeaf511a943 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>
@@ -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, u"''" );
- 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 );
}
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 28565fb46884..50c5968cd7d6 100644
--- a/connectivity/source/commontools/sqlerror.cxx
+++ b/connectivity/source/commontools/sqlerror.cxx
@@ -79,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;
}
diff --git a/connectivity/source/commontools/statementcomposer.cxx b/connectivity/source/commontools/statementcomposer.cxx
index 27c1c05f1472..8ebbd9ca8608 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>
@@ -166,7 +166,7 @@ namespace dbtools
xComposer->setElementaryQuery( sStatement );
// the sort order
- static const OUStringLiteral sPropOrder( u"Order" );
+ static constexpr OUString sPropOrder( u"Order"_ustr );
if ( ::comphelper::hasProperty( sPropOrder, xQuery ) )
{
OUString sOrder;
@@ -176,7 +176,7 @@ namespace dbtools
// the filter
bool bApplyFilter = true;
- static const OUStringLiteral sPropApply( u"ApplyFilter" );
+ static constexpr OUString sPropApply( u"ApplyFilter"_ustr );
if ( ::comphelper::hasProperty( sPropApply, xQuery ) )
{
OSL_VERIFY( xQuery->getPropertyValue( sPropApply ) >>= bApplyFilter );
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 cc90fa464e16..e9c447a0db58 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())
@@ -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(); )
{
@@ -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..8b1db6f2cd2f 100644
--- a/connectivity/source/cpool/ZConnectionWrapper.cxx
+++ b/connectivity/source/cpool/ZConnectionWrapper.cxx
@@ -23,7 +23,6 @@ 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)
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 1f5bd030203c..6044175480b8 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 );
{
@@ -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,7 +257,7 @@ OConnectionPool* OPoolCollection::getConnectionPool(const OUString& _sImplName,
{
Reference<XPropertySet> xProp(_xDriverNode,UNO_QUERY);
if(xProp.is())
- xProp->addPropertyChangeListener(getEnableNodeName(),this);
+ xProp->addPropertyChangeListener(ENABLE,this);
rtl::Reference<OConnectionPool> pConnectionPool = new OConnectionPool(_xDriver,_xDriverNode,m_xProxyFactory);
m_aPools.emplace(_sImplName,pConnectionPool);
pRet = pConnectionPool.get();
@@ -295,7 +272,7 @@ Reference< XInterface > OPoolCollection::createWithProvider(const Reference< XMu
const OUString& _rPath)
{
OSL_ASSERT(_rxConfProvider.is());
- Sequence< Any > args{ Any(NamedValue( "nodepath", makeAny(_rPath))) };
+ Sequence< Any > args{ Any(NamedValue( "nodepath", Any(_rPath))) };
Reference< XInterface > xInterface(
_rxConfProvider->createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationAccess",
@@ -371,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 )
@@ -391,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 )
@@ -425,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/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index e136e39f4e2b..8e4dd370a023 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -40,7 +40,7 @@ using namespace com::sun::star::sdbc;
void WpADOColumn::Create()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOCOLUMN_25, nullptr, CLSCTX_INPROC_SERVER);
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOCOLUMN_25, nullptr, CLSCTX_INPROC_SERVER);
}
OAdoColumn::OAdoColumn(bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn)
@@ -66,20 +66,6 @@ OAdoColumn::OAdoColumn(bool _bCase,OConnection* _pConnection)
}
-Sequence< sal_Int8 > OAdoColumn::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoColumn::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OColumn_ADO>{});
-}
-
void OAdoColumn::construct()
{
sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
@@ -155,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 229903502fa1..f56a6d8d007a 100644
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ b/connectivity/source/drivers/ado/AColumns.cxx
@@ -62,7 +62,7 @@ Reference< XPropertySet > OColumns::createDescriptor()
// XAppend
sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
{
- rtl::Reference<OAdoColumn> pColumn = getFromUnoTunnel<OAdoColumn>( descriptor );
+ rtl::Reference<OAdoColumn> pColumn = dynamic_cast<OAdoColumn*>( descriptor.get() );
Reference< XPropertySet > xColumn;
if ( !pColumn.is() )
{
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 5b44d9e6f4fb..600604e5eafb 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>
@@ -34,7 +35,9 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/servicehelper.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;
@@ -59,12 +62,12 @@ OConnection::OConnection(ODriver* _pDriver)
osl_atomic_increment( &m_refCount );
sal::systools::COMReference<IClassFactory2> pIUnknown;
- if (!FAILED(pIUnknown.TryCoGetClassObject(ADOS::CLSID_ADOCONNECTION_21, CLSCTX_INPROC_SERVER)))
+ if (!FAILED(pIUnknown.CoGetClassObject(ADOS::CLSID_ADOCONNECTION_21, CLSCTX_INPROC_SERVER)))
{
HRESULT hr = pIUnknown->CreateInstanceLic(nullptr,
nullptr,
ADOS::IID_ADOCONNECTION_21,
- ADOS::GetKeyStr().asBSTR(),
+ ADOS::GetKeyStr(),
reinterpret_cast<void**>(&m_aAdoConnection));
if( !FAILED( hr ) )
@@ -80,29 +83,27 @@ 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
{
@@ -118,9 +119,9 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
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();
}
@@ -181,7 +182,7 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& _sql )
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_aAdoConnection));
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
index b2a4f54b524e..65e0a80f52a8 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
@@ -896,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( )
@@ -907,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( )
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
index 42cf95a827ae..b7872070603f 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>
@@ -385,7 +388,7 @@ RightsEnum OAdoGroup::Map2Right(sal_Int32 _eNum)
void WpADOIndex::Create()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOINDEX_25, nullptr, CLSCTX_INPROC_SERVER);
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOINDEX_25, nullptr, CLSCTX_INPROC_SERVER);
}
void OAdoIndex::fillPropertyValues()
@@ -401,7 +404,7 @@ void OAdoIndex::fillPropertyValues()
void WpADOKey::Create()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOKEY_25, nullptr, CLSCTX_INPROC_SERVER);
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOKEY_25, nullptr, CLSCTX_INPROC_SERVER);
}
void OAdoKey::fillPropertyValues()
@@ -498,17 +501,17 @@ KeyTypeEnum OAdoKey::Map2KeyRule(sal_Int32 _eNum)
void WpADOTable::Create()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOTABLE_25, nullptr, CLSCTX_INPROC_SERVER);
+ 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;
+ sal::systools::BStr sStr1(_rName);
+ pInterface->GetObjectOwner(sStr1, _eNum, _rVar, &aBSTR);
+ return OUString(aBSTR);
}
void OAdoTable::fillPropertyValues()
@@ -533,7 +536,7 @@ void OAdoTable::fillPropertyValues()
void WpADOUser::Create()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOUSER_25, nullptr, CLSCTX_INPROC_SERVER);
+ 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 2b94f944656d..bb5bda634cfc 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
@@ -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,7 @@ void ODatabaseMetaDataResultSet::disposing()
::osl::MutexGuard aGuard(m_aMutex);
if(m_pRecordSet)
m_pRecordSet->Close();
- m_aStatement = nullptr;
+ m_aStatement.clear();
m_xMetaData.clear();
}
@@ -691,21 +690,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()
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx
index ad90d8d05556..6568f7a1ee84 100644
--- a/connectivity/source/drivers/ado/ADriver.cxx
+++ b/connectivity/source/drivers/ado/ADriver.cxx
@@ -230,7 +230,7 @@ void ADOS::ThrowException(ADOConnection* _pAdoCon,const Reference< XInterface >&
else
{
SQLException aTemp(aErr.GetDescription(),
- _xInterface,aErr.GetSQLState(),aErr.GetNumber(),makeAny(aException));
+ _xInterface,aErr.GetSQLState(),aErr.GetNumber(),Any(aException));
aTemp.NextException <<= aException;
aException = aTemp;
}
diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx
index 932cfc232de3..02cd239d7682 100644
--- a/connectivity/source/drivers/ado/AGroup.cxx
+++ b/connectivity/source/drivers/ado/AGroup.cxx
@@ -36,7 +36,7 @@ using namespace com::sun::star::sdbcx;
void WpADOGroup::Create()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOGROUP_25, nullptr, CLSCTX_INPROC_SERVER);
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOGROUP_25, nullptr, CLSCTX_INPROC_SERVER);
}
OAdoGroup::OAdoGroup(OCatalog* _pParent,bool _bCase, ADOGroup* _pGroup) : OGroup_ADO(_bCase),m_pCatalog(_pParent)
@@ -69,21 +69,6 @@ void OAdoGroup::refreshUsers()
m_pUsers.reset(new OUsers(m_pCatalog, m_aMutex, aVector, aUsers, isCaseSensitive()));
}
-Sequence< sal_Int8 > OAdoGroup::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoGroup::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OGroup_ADO>{});
-}
-
-
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 e3fb165b0a34..6f7c8b2da8d0 100644
--- a/connectivity/source/drivers/ado/AGroups.cxx
+++ b/connectivity/source/drivers/ado/AGroups.cxx
@@ -58,7 +58,7 @@ Reference< XPropertySet > OGroups::createDescriptor()
// XAppend
sdbcx::ObjectType OGroups::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OAdoGroup* pGroup = getFromUnoTunnel<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 af643a4368b0..b183d49c2435 100644
--- a/connectivity/source/drivers/ado/AIndex.cxx
+++ b/connectivity/source/drivers/ado/AIndex.cxx
@@ -70,20 +70,6 @@ void OAdoIndex::refreshColumns()
}
-Sequence< sal_Int8 > OAdoIndex::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoIndex::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<sdbcx::OIndex>{});
-}
-
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 621ddec60d79..1e427a2f0782 100644
--- a/connectivity/source/drivers/ado/AIndexes.cxx
+++ b/connectivity/source/drivers/ado/AIndexes.cxx
@@ -58,7 +58,7 @@ Reference< XPropertySet > OIndexes::createDescriptor()
// XAppend
sdbcx::ObjectType OIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OAdoIndex* pIndex = getFromUnoTunnel<OAdoIndex>(descriptor);
+ OAdoIndex* pIndex = dynamic_cast<OAdoIndex*>(descriptor.get());
if ( pIndex == nullptr )
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 b74103d830d6..9c2734ede8f1 100644
--- a/connectivity/source/drivers/ado/AKey.cxx
+++ b/connectivity/source/drivers/ado/AKey.cxx
@@ -66,20 +66,6 @@ void OAdoKey::refreshColumns()
m_pColumns.reset(new OColumns(*this, m_aMutex, aVector, aColumns, isCaseSensitive(), m_pConnection));
}
-Sequence< sal_Int8 > OAdoKey::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoKey::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OKey_ADO>{});
-}
-
void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if(m_aKey.IsValid())
diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx
index f0d938d397d6..32d02bc743e7 100644
--- a/connectivity/source/drivers/ado/AKeys.cxx
+++ b/connectivity/source/drivers/ado/AKeys.cxx
@@ -58,7 +58,7 @@ Reference< XPropertySet > OKeys::createDescriptor()
// XAppend
sdbcx::ObjectType OKeys::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
{
- OAdoKey* pKey = getFromUnoTunnel<OAdoKey>( descriptor );
+ OAdoKey* pKey = dynamic_cast<OAdoKey*>( descriptor.get() );
if ( pKey == nullptr)
m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx
index cf2339fdc951..9e17d71b0bed 100644
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ b/connectivity/source/drivers/ado/APreparedStatement.cxx
@@ -442,7 +442,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 799d85c04924..7e633130d95e 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -818,12 +818,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));
}
@@ -927,11 +927,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]);
}
@@ -1033,26 +1031,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()
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx
index 9d8851a4089f..c2a09385dee6 100644
--- a/connectivity/source/drivers/ado/AStatement.cxx
+++ b/connectivity/source/drivers/ado/AStatement.cxx
@@ -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 ::std;
OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex)
,OPropertySetHelper(OStatement_BASE::rBHelper)
@@ -470,7 +469,7 @@ Any SAL_CALL OStatement_Base::getWarnings( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return makeAny(m_aLastWarning);
+ return Any(m_aLastWarning);
}
@@ -641,31 +640,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
+ }
+ }
+ };
}
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
index f048f3ec09ba..47e22e125398 100644
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ b/connectivity/source/drivers/ado/ATable.cxx
@@ -127,20 +127,6 @@ void OAdoTable::refreshIndexes()
m_xIndexes.reset(new OIndexes(*this,m_aMutex,aVector,aIndexes,isCaseSensitive(),m_pCatalog->getConnection()));
}
-Sequence< sal_Int8 > OAdoTable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{});
-}
-
// XRename
void SAL_CALL OAdoTable::rename( const OUString& newName )
{
@@ -165,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::getFromUnoTunnel<OAdoColumn>(descriptor);
+ OAdoColumn* pColumn = dynamic_cast<OAdoColumn*>(descriptor.get());
if(pColumn != nullptr)
{
WpADOColumns aColumns = m_aTable.get_Columns();
diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx
index 3299181c5ef1..07910462fb17 100644
--- a/connectivity/source/drivers/ado/ATables.cxx
+++ b/connectivity/source/drivers/ado/ATables.cxx
@@ -65,7 +65,7 @@ Reference< XPropertySet > OTables::createDescriptor()
// XAppend
sdbcx::ObjectType OTables::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
{
- OAdoTable* pTable = getFromUnoTunnel<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) );
@@ -93,7 +93,7 @@ void OTables::appendNew(const OUString& _rsNewTable)
insertElement(_rsNewTable,nullptr);
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rsNewTable), Any(), Any());
OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
aListenerLoop.next()->elementInserted(aEvent);
diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx
index 42f7240f8729..eb7a5803f60c 100644
--- a/connectivity/source/drivers/ado/AUser.cxx
+++ b/connectivity/source/drivers/ado/AUser.cxx
@@ -65,21 +65,6 @@ void OAdoUser::refreshGroups()
m_pGroups.reset(new OGroups(m_pCatalog, m_aMutex, aVector, aGroups, isCaseSensitive()));
}
-Sequence< sal_Int8 > OAdoUser::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoUser::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OUser_TYPEDEF>{});
-}
-
-
void OAdoUser::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if(m_aUser.IsValid())
diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx
index 9d0dab6e8d4c..4b050d239237 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;
@@ -56,12 +57,12 @@ Reference< XPropertySet > OUsers::createDescriptor()
// XAppend
sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OUserExtend* pUser = getFromUnoTunnel<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 15f6a5cc9a6d..10a5524db95b 100644
--- a/connectivity/source/drivers/ado/AView.cxx
+++ b/connectivity/source/drivers/ado/AView.cxx
@@ -23,6 +23,8 @@
#include <ado/Awrapado.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
+#include <systools/win32/oleauto.hxx>
+
#include <TConnection.hxx>
@@ -40,21 +42,6 @@ OAdoView::OAdoView(bool _bCase,ADOView* _pView) : OView_ADO(_bCase,nullptr)
{
}
-Sequence< sal_Int8 > OAdoView::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OView_ADO>{});
-}
-
-
void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
{
if(m_aView.IsValid())
@@ -76,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 4764833c8829..943422289627 100644
--- a/connectivity/source/drivers/ado/AViews.cxx
+++ b/connectivity/source/drivers/ado/AViews.cxx
@@ -28,6 +28,8 @@
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
#include <rtl/ref.hxx>
+#include <systools/win32/oleauto.hxx>
+
#include <strings.hrc>
using namespace ::comphelper;
@@ -61,7 +63,7 @@ Reference< XPropertySet > OViews::createDescriptor()
// XAppend
sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- OAdoView* pView = getFromUnoTunnel<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) );
@@ -74,7 +76,7 @@ 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)))
+ 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());
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 2a9f66656956..fe2e7e344857 100644
--- a/connectivity/source/drivers/ado/Awrapado.cxx
+++ b/connectivity/source/drivers/ado/Awrapado.cxx
@@ -21,14 +21,16 @@
#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()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOCATALOG_25, nullptr, CLSCTX_INPROC_SERVER);
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOCATALOG_25, nullptr, CLSCTX_INPROC_SERVER);
}
@@ -42,16 +44,16 @@ WpADOProperties WpADOConnection::get_Properties() const
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()));
+ sal::systools::BStr bstr(aCon);
+ bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr));
return bErg;
}
@@ -93,8 +95,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)));
+ sal::systools::BStr sStr1(CommandText);
+ bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,reinterpret_cast<ADORecordset**>(ppiRset)));
return bErg;
}
@@ -120,10 +122,10 @@ 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));
+ sal::systools::BStr sStr1(ConnectionString);
+ sal::systools::BStr sStr2(UserID);
+ sal::systools::BStr sStr3(Password);
+ bool bErg = SUCCEEDED(pInterface->Open(sStr1, sStr2, sStr3, Options));
return bErg;
}
@@ -136,15 +138,15 @@ 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()));
+ sal::systools::BStr bstr(_bstr);
+ bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr));
return bErg;
}
@@ -208,15 +210,15 @@ 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()));
+ sal::systools::BStr bstr(_bstr);
+ return SUCCEEDED(pInterface->put_Provider(bstr));
}
sal_Int32 WpADOConnection::get_State() const
@@ -236,9 +238,9 @@ 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(const WpADOConnection& rCon)
@@ -256,14 +258,14 @@ void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
void WpADOCommand::Create()
{
sal::systools::COMReference<IClassFactory2> pInterface2;
- if (!FAILED(pInterface2.TryCoGetClassObject(ADOS::CLSID_ADOCOMMAND_21, CLSCTX_INPROC_SERVER)))
+ if (!FAILED(pInterface2.CoGetClassObject(ADOS::CLSID_ADOCOMMAND_21, CLSCTX_INPROC_SERVER)))
{
sal::systools::COMReference<ADOCommand> pCommand;
HRESULT hr = pInterface2->CreateInstanceLic(nullptr,
nullptr,
ADOS::IID_ADOCOMMAND_21,
- ADOS::GetKeyStr().asBSTR(),
+ ADOS::GetKeyStr(),
reinterpret_cast<void**>(&pCommand));
if( !FAILED( hr ) )
@@ -282,16 +284,16 @@ 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()));
+ sal::systools::BStr bstr(aCon);
+ bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr));
return bErg;
}
@@ -334,8 +336,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));
+ sal::systools::BStr bstr(_bstr);
+ bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr, Type, Direction, nSize, Value, &pPara));
return bErg ? pPara : nullptr;
}
@@ -366,16 +368,16 @@ 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()));
+ sal::systools::BStr bstr(Name);
+ bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
return bErg;
}
@@ -388,17 +390,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
@@ -412,9 +414,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
@@ -468,9 +470,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
@@ -620,9 +622,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
@@ -649,13 +651,13 @@ bool WpADOProperty::PutAttributes(sal_Int32 _nDefSize)
void WpADORecordset::Create()
{
sal::systools::COMReference<IClassFactory2> pInterface2;
- if (!FAILED(pInterface2.TryCoGetClassObject(ADOS::CLSID_ADORECORDSET_21, CLSCTX_INPROC_SERVER)))
+ if (!FAILED(pInterface2.CoGetClassObject(ADOS::CLSID_ADORECORDSET_21, CLSCTX_INPROC_SERVER)))
{
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 ) )
@@ -892,9 +894,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
@@ -976,30 +978,30 @@ 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());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
void WpADOColumn::put_RelatedColumn(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_RelatedColumn(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_RelatedColumn(bstr);
}
DataTypeEnum WpADOColumn::get_Type() const
@@ -1090,16 +1092,16 @@ WpADOProperties WpADOColumn::get_Properties() const
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());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
KeyTypeEnum WpADOKey::get_Type() const
@@ -1119,16 +1121,16 @@ 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());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_RelatedTable(bstr);
}
RuleEnum WpADOKey::get_DeleteRule() const
@@ -1170,16 +1172,16 @@ WpADOColumns WpADOKey::get_Columns() const
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());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
bool WpADOIndex::get_Clustered() const
@@ -1281,24 +1283,24 @@ 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());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
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
@@ -1344,9 +1346,9 @@ WpADOProperties WpADOTable::get_Properties() const
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
@@ -1363,15 +1365,15 @@ 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());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
RightsEnum WpADOGroup::GetPermissions(
@@ -1405,22 +1407,22 @@ WpADOUsers WpADOGroup::get_Users( )
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());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
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()));
+ sal::systools::BStr sStr1(_rPwd);
+ sal::systools::BStr sStr2(_rNewPwd);
+ bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1, sStr2));
return bErg;
}
@@ -1462,7 +1464,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;
@@ -1502,7 +1504,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;
@@ -1544,7 +1546,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;
@@ -1584,7 +1586,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;
@@ -1618,7 +1620,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;
@@ -1626,7 +1628,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;
@@ -1638,7 +1640,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
@@ -1672,7 +1674,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;
@@ -1713,7 +1715,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;
@@ -1721,7 +1723,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;
@@ -1733,7 +1735,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
@@ -1752,8 +1754,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];
@@ -1762,7 +1764,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;
@@ -1774,11 +1776,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
@@ -1797,7 +1799,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
@@ -1814,18 +1816,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();
@@ -1833,7 +1833,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;
@@ -1860,7 +1860,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
@@ -1870,7 +1870,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;
@@ -1882,7 +1882,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
@@ -1914,7 +1914,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;
@@ -1949,7 +1949,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;
diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx
index bd01f36fc684..0f0d022681ea 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()
+sal::systools::BStr& ADOS::GetKeyStr()
{
- static OLEString sKeyStr(u"gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz");
+ static sal::systools::BStr sKeyStr(u"gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz");
return sKeyStr;
}
diff --git a/connectivity/source/drivers/calc/CCatalog.cxx b/connectivity/source/drivers/calc/CCatalog.cxx
index 03c4358b9b65..3a8493ac290a 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;
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
index 8d4a0c01ebc1..5c746414ed96 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();
}
@@ -142,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;
}
diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
index 159349cacd6f..1b88ab05ff55 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;
@@ -135,27 +134,23 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables(
// 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 pResult;
// get the sheet names from the document
diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx
index b7b11cc29176..eccf97751c8f 100644
--- a/connectivity/source/drivers/calc/CDriver.cxx
+++ b/connectivity/source/drivers/calc/CDriver.cxx
@@ -53,7 +53,7 @@ connectivity_calc_ODriver(
}
if (ret)
ret->acquire();
- return static_cast<cppu::OWeakObject*>(ret.get());
+ return getXWeak(ret.get());
}
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 90e7c4e08bed..b480ee740f01 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -49,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;
@@ -71,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);
}
}
@@ -608,20 +603,6 @@ void SAL_CALL OCalcTable::disposing()
}
-Sequence< sal_Int8 > OCalcTable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OCalcTable_BASE>{});
-}
-
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 08e5d63e3abd..1f626f7b10d0 100644
--- a/connectivity/source/drivers/calc/CTables.cxx
+++ b/connectivity/source/drivers/calc/CTables.cxx
@@ -25,15 +25,10 @@
#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)
diff --git a/connectivity/source/drivers/component/CColumns.cxx b/connectivity/source/drivers/component/CColumns.cxx
index 9f802b6e4c57..7726d3a326d0 100644
--- a/connectivity/source/drivers/component/CColumns.cxx
+++ b/connectivity/source/drivers/component/CColumns.cxx
@@ -23,10 +23,6 @@
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)
diff --git a/connectivity/source/drivers/component/CDatabaseMetaData.cxx b/connectivity/source/drivers/component/CDatabaseMetaData.cxx
index b8bbae3d7499..49d83e36af12 100644
--- a/connectivity/source/drivers/component/CDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/component/CDatabaseMetaData.cxx
@@ -46,74 +46,69 @@ OComponentDatabaseMetaData::~OComponentDatabaseMetaData()
Reference< XResultSet > OComponentDatabaseMetaData::impl_getTypeInfo_throw( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
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
{
- aRows.reserve(6);
- ODatabaseMetaDataResultSet::ORow aRow
- {
- ODatabaseMetaDataResultSet::getEmptyValue(),
- new ORowSetValueDecorator(OUString("VARCHAR")),
- 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(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);
- }
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ new ORowSetValueDecorator(OUString("VARCHAR")),
+ 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(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(std::move(aRows));
return pResult;
diff --git a/connectivity/source/drivers/component/CPreparedStatement.cxx b/connectivity/source/drivers/component/CPreparedStatement.cxx
index 7c5c8e07f891..82935cbd747d 100644
--- a/connectivity/source/drivers/component/CPreparedStatement.cxx
+++ b/connectivity/source/drivers/component/CPreparedStatement.cxx
@@ -22,7 +22,6 @@
using namespace connectivity::component;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
rtl::Reference<OResultSet> OComponentPreparedStatement::createResultSet()
{
diff --git a/connectivity/source/drivers/component/CResultSet.cxx b/connectivity/source/drivers/component/CResultSet.cxx
index acf5d6a74df8..08e6e04aca70 100644
--- a/connectivity/source/drivers/component/CResultSet.cxx
+++ b/connectivity/source/drivers/component/CResultSet.cxx
@@ -77,7 +77,7 @@ Any SAL_CALL OComponentResultSet::getBookmark( )
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return makeAny((*m_aRow)[0]->getValue().getInt32());
+ return Any((*m_aRow)[0]->getValue().getInt32());
}
sal_Bool SAL_CALL OComponentResultSet::moveToBookmark( const Any& bookmark )
diff --git a/connectivity/source/drivers/component/CStatement.cxx b/connectivity/source/drivers/component/CStatement.cxx
index f3bd03e8b276..ff072ab5f548 100644
--- a/connectivity/source/drivers/component/CStatement.cxx
+++ b/connectivity/source/drivers/component/CStatement.cxx
@@ -22,7 +22,6 @@
using namespace connectivity::component;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
rtl::Reference<OResultSet> OComponentStatement::createResultSet()
{
diff --git a/connectivity/source/drivers/component/CTable.cxx b/connectivity/source/drivers/component/CTable.cxx
index 83dbf8a68830..1fe32c339faa 100644
--- a/connectivity/source/drivers/component/CTable.cxx
+++ b/connectivity/source/drivers/component/CTable.cxx
@@ -25,7 +25,6 @@ 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;
@@ -33,7 +32,6 @@ 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,
@@ -104,8 +102,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..79dce7ba2ce0 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;
diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx
index b997ec8d9087..402ec4e41c07 100644
--- a/connectivity/source/drivers/dbase/DColumns.cxx
+++ b/connectivity/source/drivers/dbase/DColumns.cxx
@@ -25,10 +25,6 @@ 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)
{
diff --git a/connectivity/source/drivers/dbase/DConnection.cxx b/connectivity/source/drivers/dbase/DConnection.cxx
index c9c7a93fa9f2..7498f23e4bf7 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)
{
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
index bdff15cafa82..5192b308d19d 100644
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
@@ -54,98 +54,93 @@ ODbaseDatabaseMetaData::~ODbaseDatabaseMetaData()
Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
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
{
- aRows.reserve(10);
- ODatabaseMetaDataResultSet::ORow aRow
- {
- ODatabaseMetaDataResultSet::getEmptyValue(),
- new ORowSetValueDecorator(OUString("VARCHAR")),
- new ORowSetValueDecorator(DataType::VARCHAR),
- new ORowSetValueDecorator(sal_Int32(254)),
- ODatabaseMetaDataResultSet::getQuoteValue(),
- ODatabaseMetaDataResultSet::getQuoteValue(),
- new ORowSetValueDecorator(OUString("length")),
- new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)),
- ODatabaseMetaDataResultSet::get1Value(),
- new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)),
- ODatabaseMetaDataResultSet::get1Value(),
- ODatabaseMetaDataResultSet::get0Value(),
- ODatabaseMetaDataResultSet::get0Value(),
- new ORowSetValueDecorator(OUString("C")),
- ODatabaseMetaDataResultSet::get0Value(),
- ODatabaseMetaDataResultSet::get0Value(),
- ODatabaseMetaDataResultSet::getEmptyValue(),
- ODatabaseMetaDataResultSet::getEmptyValue(),
- 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);
- }
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ new ORowSetValueDecorator(OUString("VARCHAR")),
+ new ORowSetValueDecorator(DataType::VARCHAR),
+ new ORowSetValueDecorator(sal_Int32(254)),
+ ODatabaseMetaDataResultSet::getQuoteValue(),
+ ODatabaseMetaDataResultSet::getQuoteValue(),
+ new ORowSetValueDecorator(OUString("length")),
+ new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)),
+ ODatabaseMetaDataResultSet::get1Value(),
+ new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)),
+ ODatabaseMetaDataResultSet::get1Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ new ORowSetValueDecorator(OUString("C")),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::get0Value(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ ODatabaseMetaDataResultSet::getEmptyValue(),
+ 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(ORowSetValue(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(ORowSetValue(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(std::move(aRows));
return pResult;
@@ -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))));
@@ -279,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::getFromUnoTunnel<ODbaseIndex>(xIndex);
+ auto pIndex = dynamic_cast<ODbaseIndex*>(xIndex.get());
if(pIndex)
{
aRow[11] = new ORowSetValueDecorator(static_cast<sal_Int32>(pIndex->getHeader().db_maxkeys));
@@ -303,14 +287,12 @@ 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);
}
}
diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx
index 8eae0013c940..ff0ec256e18a 100644
--- a/connectivity/source/drivers/dbase/DDriver.cxx
+++ b/connectivity/source/drivers/dbase/DDriver.cxx
@@ -51,7 +51,7 @@ connectivity_dbase_ODriver(
}
if (ret)
ret->acquire();
- return static_cast<cppu::OWeakObject*>(ret.get());
+ return getXWeak(ret.get());
}
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index 245c49b58e2f..a3ee4a2688df 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -41,13 +41,10 @@ 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");
@@ -99,20 +96,6 @@ void ODbaseIndex::refreshColumns()
m_pColumns.reset(new ODbaseIndexColumns(this,m_aMutex,aVector));
}
-Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// XUnoTunnel
-
-sal_Int64 ODbaseIndex::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<ODbaseIndex_BASE>{});
-}
-
ONDXPagePtr const & ODbaseIndex::getRoot()
{
openIndexFile();
@@ -401,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);
@@ -565,15 +547,13 @@ void ODbaseIndex::CreateImpl()
if(xSet->last())
{
- Reference< XUnoTunnel> xTunnel(xSet, UNO_QUERY_THROW);
- ODbaseResultSet* pDbaseRes = comphelper::getFromUnoTunnel<ODbaseResultSet>(xTunnel);
+ 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..8b20903fa1d3 100644
--- a/connectivity/source/drivers/dbase/DIndexColumns.cxx
+++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx
@@ -28,9 +28,7 @@ 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)
diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx
index 7f47085c6509..df630c531c3e 100644
--- a/connectivity/source/drivers/dbase/DIndexes.cxx
+++ b/connectivity/source/drivers/dbase/DIndexes.cxx
@@ -24,18 +24,12 @@
#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)
{
@@ -92,14 +86,9 @@ Reference< XPropertySet > ODbaseIndexes::createDescriptor()
// XAppend
sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
- {
- ODbaseIndex* pIndex = comphelper::getFromUnoTunnel<ODbaseIndex>(xTunnel);
- if(!pIndex)
- throw SQLException();
+ ODbaseIndex* pIndex = dynamic_cast<ODbaseIndex*>(descriptor.get());
+ if(pIndex)
pIndex->CreateImpl();
- }
return createObject( _rForName );
}
@@ -107,7 +96,7 @@ sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const
// XDrop
void ODbaseIndexes::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
{
- auto pIndex = comphelper::getFromUnoTunnel<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 9a2b54409bea..f349701e620b 100644
--- a/connectivity/source/drivers/dbase/DPreparedStatement.cxx
+++ b/connectivity/source/drivers/dbase/DPreparedStatement.cxx
@@ -22,7 +22,6 @@
using namespace connectivity::dbase;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
rtl::Reference<OResultSet> ODbasePreparedStatement::createResultSet()
{
diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx
index 3533477bb0cf..123a29b8b069 100644
--- a/connectivity/source/drivers/dbase/DResultSet.cxx
+++ b/connectivity/source/drivers/dbase/DResultSet.cxx
@@ -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((*m_aRow)[0]->getValue().getInt32());
+ return Any((*m_aRow)[0]->getValue().getInt32());
}
sal_Bool SAL_CALL ODbaseResultSet::moveToBookmark( const Any& bookmark )
@@ -155,7 +155,7 @@ Sequence< sal_Int32 > SAL_CALL ODbaseResultSet::deleteRows( const Sequence< An
bool ODbaseResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_xIndex)
{
- auto pIndex = comphelper::getFromUnoTunnel<dbase::ODbaseIndex>(_xIndex);
+ auto pIndex = dynamic_cast<dbase::ODbaseIndex*>(_xIndex.get());
if(pIndex)
{
std::unique_ptr<dbase::OIndexIterator> pIter = pIndex->createIterator();
diff --git a/connectivity/source/drivers/dbase/DStatement.cxx b/connectivity/source/drivers/dbase/DStatement.cxx
index d2537232778e..0da788f98e54 100644
--- a/connectivity/source/drivers/dbase/DStatement.cxx
+++ b/connectivity/source/drivers/dbase/DStatement.cxx
@@ -22,7 +22,6 @@
using namespace connectivity::dbase;
using namespace connectivity::file;
-using namespace com::sun::star::uno;
rtl::Reference<OResultSet> ODbaseStatement::createResultSet()
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 0f8f72328a0b..0caeb5be7c3f 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,8 +39,9 @@
#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 <unotools/configmgr.hxx>
+#include <comphelper/configuration.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/ucbhelper.hxx>
#include <comphelper/types.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;
@@ -164,8 +166,8 @@ void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,css::util::DateTi
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) / 30.6001);
- _rDateTime.Day = static_cast<sal_uInt16>(kb - kd - static_cast<sal_Int64>( static_cast<double>(ke) * 30.6001 ));
+ 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
@@ -737,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());
@@ -759,31 +759,17 @@ 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));
+ return aRet;
}
-Sequence< sal_Int8 > ODbaseTable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<ODbaseTable_BASE>{});
-}
-
bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool bRetrieveData)
{
if (!m_pBuffer)
return false;
// Read the data
- bool bIsCurRecordDeleted = static_cast<char>(m_pBuffer[0]) == '*';
+ bool bIsCurRecordDeleted = m_pBuffer[0] == '*';
// only read the bookmark
@@ -855,8 +841,8 @@ 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 )
@@ -940,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;
@@ -1014,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,
@@ -1395,7 +1381,7 @@ bool ODbaseTable::CreateFile(const INetURLObject& aFile, bool& bCreateMemo)
bool ODbaseTable::HasMemoFields() const
{
- return m_aHeader.type > dBaseIV && !utl::ConfigManager::IsFuzzing();
+ return m_aHeader.type > dBaseIV && !comphelper::IsFuzzing();
}
// creates in principle dBase III file format
@@ -1416,7 +1402,7 @@ bool ODbaseTable::CreateMemoFile(const INetURLObject& aFile)
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);
@@ -1453,7 +1439,7 @@ bool ODbaseTable::Drop_Static(const OUString& _sUrl, bool _bHasMemoFields, OColl
try
{
::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
- aDeleteContent.executeCommand( "delete", makeAny( true ) );
+ aDeleteContent.executeCommand( "delete", Any( true ) );
}
catch(const Exception&)
{
@@ -1595,9 +1581,7 @@ 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 = comphelper::getFromUnoTunnel<ODbaseIndex>(xTunnel);
+ 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(),
@@ -1646,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, '.', ',' );
}
@@ -1701,9 +1685,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
continue;
else
{
- Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
- OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
- ODbaseIndex* pIndex = comphelper::getFromUnoTunnel<ODbaseIndex>(xTunnel);
+ ODbaseIndex* pIndex = dynamic_cast<ODbaseIndex*>(xIndex.get());
assert(pIndex && "ODbaseTable::UpdateBuffer: No Index returned!");
if (pIndex->Find(0,*rRow[nPos]))
@@ -1809,9 +1791,7 @@ 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 = comphelper::getFromUnoTunnel<ODbaseIndex>(xTunnel);
+ ODbaseIndex* pIndex = dynamic_cast<ODbaseIndex*>(aIndexedCols[i].get());
assert(pIndex && "ODbaseTable::UpdateBuffer: No Index returned!");
// Update !!
if (pOrgRow.is() && !thisColIsNull)
@@ -2191,7 +2171,7 @@ void ODbaseTable::alterColumn(sal_Int32 index,
rtl::Reference<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));
+ 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!");
@@ -2333,7 +2313,7 @@ namespace
Any(sNewName),
css::beans::PropertyState_DIRECT_VALUE } };
Sequence< Any > aValues;
- aContent.executeCommand( "setPropertyValues",makeAny(aProps) ) >>= aValues;
+ aContent.executeCommand( "setPropertyValues",Any(aProps) ) >>= aValues;
if(aValues.hasElements() && aValues[0].hasValue())
throw Exception("setPropertyValues returned non-zero", nullptr);
}
@@ -2363,7 +2343,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();
@@ -2421,7 +2401,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();
@@ -2475,16 +2455,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()));
@@ -2681,7 +2659,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;
@@ -2715,7 +2693,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 a3bc953d93b4..3424801e3842 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,7 +39,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;
using namespace ::com::sun::star::container;
sdbcx::ObjectType ODbaseTables::createObject(const OUString& _rName)
@@ -65,10 +63,10 @@ Reference< XPropertySet > ODbaseTables::createDescriptor()
// XAppend
sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- auto pTable = comphelper::getFromUnoTunnel<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())
@@ -90,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);
@@ -103,7 +101,7 @@ void ODbaseTables::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
if ( xTunnel.is() )
{
- ODbaseTable* pTable = comphelper::getFromUnoTunnel<ODbaseTable>(xTunnel);
+ 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 422fef11ce20..d091335f5495 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))
{
}
@@ -482,7 +483,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())
diff --git a/connectivity/source/drivers/evoab2/EApi.cxx b/connectivity/source/drivers/evoab2/EApi.cxx
index 8f6a6f7083d0..9ec8e0d44e32 100644
--- a/connectivity/source/drivers/evoab2/EApi.cxx
+++ b/connectivity/source/drivers/evoab2/EApi.cxx
@@ -21,6 +21,7 @@
#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"
diff --git a/connectivity/source/drivers/evoab2/EApi.h b/connectivity/source/drivers/evoab2/EApi.h
index 9a2138eb2a26..a33bf9721de6 100644
--- a/connectivity/source/drivers/evoab2/EApi.h
+++ b/connectivity/source/drivers/evoab2/EApi.h
@@ -157,4 +157,6 @@ bool isSourceBackend(ESource *pSource, const char *backendname);
G_END_DECLS
+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 6b409ce66d65..d16a6377d1d1 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)
diff --git a/connectivity/source/drivers/evoab2/NColumns.cxx b/connectivity/source/drivers/evoab2/NColumns.cxx
index 5b2b64d5d58b..99fce8f3bf46 100644
--- a/connectivity/source/drivers/evoab2/NColumns.cxx
+++ b/connectivity/source/drivers/evoab2/NColumns.cxx
@@ -25,12 +25,8 @@
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;
diff --git a/connectivity/source/drivers/evoab2/NConnection.cxx b/connectivity/source/drivers/evoab2/NConnection.cxx
index 02e8d476dd6e..66fc7ecb6511 100644
--- a/connectivity/source/drivers/evoab2/NConnection.cxx
+++ b/connectivity/source/drivers/evoab2/NConnection.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;
OEvoabConnection::OEvoabConnection(OEvoabDriver const & _rDriver)
: m_rDriver(_rDriver)
diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx
index 4d6604f0975c..8dd8714bc2fe 100644
--- a/connectivity/source/drivers/evoab2/NConnection.hxx
+++ b/connectivity/source/drivers/evoab2/NConnection.hxx
@@ -60,7 +60,6 @@ namespace connectivity::evoab {
/// @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; }
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index b3a10c016bce..110d01feb213 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -34,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
{
@@ -300,7 +297,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
::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' ) )
{
@@ -310,7 +307,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
// 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 );
}
}
@@ -996,7 +993,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( )
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 = SAL_N_ELEMENTS(sTableTypes);
+ auto nNbTypes = std::size(sTableTypes);
ODatabaseMetaDataResultSet::ORows aRows;
for(std::size_t i=0;i < nNbTypes;++i)
{
@@ -1069,12 +1066,12 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
{
::osl::MutexGuard aGuard( m_aMutex );
- rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
+ 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 const OUStringLiteral aTable(u"TABLE");
+ static constexpr OUString aTable(u"TABLE"_ustr);
bool bTableFound = true;
sal_Int32 nLength = types.getLength();
@@ -1139,7 +1136,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
aRows.push_back(aRow);
}
- g_list_foreach (pSources, reinterpret_cast<GFunc>(g_object_unref), nullptr);
+ g_list_foreach (pSources, object_unref, nullptr);
g_list_free (pSources);
pResult->setRows(std::move(aRows));
diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx
index d1b7746f47c5..c72d9b1a189f 100644
--- a/connectivity/source/drivers/evoab2/NDriver.cxx
+++ b/connectivity/source/drivers/evoab2/NDriver.cxx
@@ -31,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) :
diff --git a/connectivity/source/drivers/evoab2/NDriver.hxx b/connectivity/source/drivers/evoab2/NDriver.hxx
index 9d3b57fa7988..b505bb9db5fd 100644
--- a/connectivity/source/drivers/evoab2/NDriver.hxx
+++ b/connectivity/source/drivers/evoab2/NDriver.hxx
@@ -28,7 +28,7 @@
#include <cppuhelper/compbase.hxx>
#include <connectivity/CommonTools.hxx>
-inline constexpr OUStringLiteral EVOAB_DRIVER_IMPL_NAME = u"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
{
diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
index 7b6172ac6cf9..2ed8b0f166b9 100644
--- a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
+++ b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
@@ -22,14 +22,13 @@
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include <rtl/ref.hxx>
-#include <tools/diagnose_ex.h>
+#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;
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
index e6a43dab7687..bc9656337097 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;
@@ -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;
@@ -402,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;
@@ -435,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 );
@@ -570,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() )
{
@@ -914,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);
}
diff --git a/connectivity/source/drivers/evoab2/NResultSet.hxx b/connectivity/source/drivers/evoab2/NResultSet.hxx
index 74a5e40dda1f..3eeeab244ab3 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.hxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.hxx
@@ -49,7 +49,7 @@ namespace connectivity::evoab
{
public:
virtual EBook* openBook(const char *abname) = 0;
- virtual void executeQuery (EBook* pBook, EBookQuery* pQuery, OString &rPassword) = 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;
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
index a2ce922ff193..a828b127fe68 100644
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
@@ -21,14 +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)
+OEvoabResultSetMetaData::OEvoabResultSetMetaData(OUString _aTableName)
+ : m_aTableName(std::move(_aTableName))
{
}
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
index 66fffb984e4f..e79d347b1c4d 100644
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
+++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
@@ -40,7 +40,7 @@ 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
diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx
index 1f3e21a2ef90..91ebdda56c70 100644
--- a/connectivity/source/drivers/evoab2/NStatement.cxx
+++ b/connectivity/source/drivers/evoab2/NStatement.cxx
@@ -38,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 {
@@ -49,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 {
@@ -549,7 +548,7 @@ Any SAL_CALL OCommonStatement::getWarnings( )
checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- return makeAny(SQLWarning());
+ return Any(SQLWarning());
}
@@ -614,7 +613,7 @@ Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryDa
pResult->construct( _rQueryData );
// done
- m_xResultSet = pResult;
+ m_xResultSet = Reference<XWeak>(pResult);
return pResult;
}
diff --git a/connectivity/source/drivers/evoab2/NTable.cxx b/connectivity/source/drivers/evoab2/NTable.cxx
index 208c52747768..631c27db244d 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,
diff --git a/connectivity/source/drivers/evoab2/NTables.cxx b/connectivity/source/drivers/evoab2/NTables.cxx
index 69b54ba70759..3be63e1e1049 100644
--- a/connectivity/source/drivers/evoab2/NTables.cxx
+++ b/connectivity/source/drivers/evoab2/NTables.cxx
@@ -29,12 +29,7 @@ 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)
{
diff --git a/connectivity/source/drivers/evoab2/NTables.hxx b/connectivity/source/drivers/evoab2/NTables.hxx
index 7e200ff6aee2..e5d454729431 100644
--- a/connectivity/source/drivers/evoab2/NTables.hxx
+++ b/connectivity/source/drivers/evoab2/NTables.hxx
@@ -20,6 +20,7 @@
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <utility>
namespace connectivity::evoab
{
@@ -30,11 +31,11 @@ namespace connectivity::evoab
virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
virtual void impl_refresh() override;
public:
- OEvoabTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,
+ 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(_rMetaData)
+ m_xMetaData(std::move(_xMetaData))
{}
virtual void disposing() override;
};
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx
index eedda26efba2..54ad24bf1d59 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;
diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx
index 1b90385bf9c0..97e9d0c23a2a 100644
--- a/connectivity/source/drivers/file/FColumns.cxx
+++ b/connectivity/source/drivers/file/FColumns.cxx
@@ -25,12 +25,8 @@
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)
{
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
index 283bee8fee45..38ce342cb5e2 100644
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ b/connectivity/source/drivers/file/FConnection.cxx
@@ -32,7 +32,7 @@
#include <com/sun/star/ucb/XContentIdentifier.hpp>
#include <tools/urlobj.hxx>
#include <file/FCatalog.hxx>
-#include <unotools/configmgr.hxx>
+#include <comphelper/configuration.hxx>
#include <unotools/pathoptions.hxx>
#include <ucbhelper/content.hxx>
#include <connectivity/dbcharset.hxx>
@@ -132,7 +132,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
OUString aFileName = aDSN;
INetURLObject aURL;
aURL.SetSmartProtocol(INetProtocol::File);
- if (!utl::ConfigManager::IsFuzzing())
+ if (!comphelper::IsFuzzing())
{
SvtPathOptions aPathOptions;
aFileName = aPathOptions.SubstituteVariable(aFileName);
@@ -405,7 +405,7 @@ sal_Int64 SAL_CALL OConnection::getSomething( const Sequence< sal_Int8 >& rId )
return comphelper::getSomethingImpl(rId, this);
}
-Sequence< sal_Int8 > OConnection::getUnoTunnelId()
+const Sequence< sal_Int8 > & OConnection::getUnoTunnelId()
{
static const comphelper::UnoIdInit implId;
return implId.getSeq();
@@ -413,17 +413,13 @@ Sequence< sal_Int8 > OConnection::getUnoTunnelId()
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, "S1000", 0, next);
throw aError;
}
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index 6d0a4f2fe0b1..6d157bb575da 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -30,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;
@@ -167,7 +166,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
// 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();
@@ -299,7 +298,7 @@ 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);
@@ -401,7 +400,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
xNames->getByName(*pBegin), css::uno::UNO_QUERY);
if(xTable.is())
{
- auto pTable = comphelper::getFromUnoTunnel<OFileTable>(xTable);
+ auto pTable = dynamic_cast<OFileTable*>(xTable.get());
if(pTable && !pTable->isReadOnly())
{
aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
@@ -618,14 +617,9 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( )
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes );
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
- {
- aRows.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(OUString("TABLE")) } );
- }
+ ODatabaseMetaDataResultSet::ORows aRows;
+ aRows.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(OUString("TABLE")) } );
pResult->setRows(std::move(aRows));
return pResult;
}
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index 4b6d45fe7420..b24c4e67a532 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -26,6 +26,7 @@
#include <connectivity/dbexception.hxx>
#include <strings.hrc>
#include <resource/sharedresources.hxx>
+#include <utility>
using namespace connectivity::file;
@@ -36,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))
{
}
diff --git a/connectivity/source/drivers/file/FNumericFunctions.cxx b/connectivity/source/drivers/file/FNumericFunctions.cxx
index 7de058dee06c..7c7fdc75425f 100644
--- a/connectivity/source/drivers/file/FNumericFunctions.cxx
+++ b/connectivity/source/drivers/file/FNumericFunctions.cxx
@@ -19,14 +19,13 @@
#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() )
@@ -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
@@ -227,7 +226,7 @@ ORowSetValue OOp_Degrees::operate(const ORowSetValue& lhs) const
return lhs;
double nLhs = lhs.getDouble();
- return nLhs*180*(1.0/fPi);
+ return basegfx::rad2deg(nLhs);
}
ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const
@@ -236,7 +235,7 @@ ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const
return lhs;
double nLhs = lhs.getDouble();
- return nLhs*fPi*(1.0/180.0);
+ return basegfx::deg2rad(nLhs);
}
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index 79c69b3ee62e..f2a8571b61e5 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>
@@ -100,7 +101,7 @@ rtl::Reference<OResultSet> OPreparedStatement::makeResultSet()
closeResultSet();
rtl::Reference<OResultSet> xResultSet(createResultSet());
- m_xResultSet = xResultSet;
+ m_xResultSet = uno::Reference<uno::XWeak>(xResultSet);
initializeResultSet(xResultSet.get());
initResultSet(xResultSet.get());
return xResultSet;
@@ -392,7 +393,7 @@ void SAL_CALL OPreparedStatement::release() noexcept
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 fdf3a4e47d84..5612c68feedf 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;
@@ -921,7 +922,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;
}
@@ -1380,19 +1381,6 @@ void OResultSet::OpenImpl()
m_nFilePos = 0;
}
-Sequence< sal_Int8 > OResultSet::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this);
-}
-
void OResultSet::setBoundedColumns(const OValueRefRow& _rRow,
const OValueRefRow& _rSelectRow,
const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
@@ -1527,8 +1515,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 = comphelper::getFromUnoTunnel<OFileTable>(xTunnel);
+ m_pTable = dynamic_cast<OFileTable*>(_xTable.get());
assert(m_pTable.is());
}
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 e0ea8bc59aef..4520abfeff1d 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -38,6 +38,7 @@
#include <connectivity/dbexception.hxx>
#include <strings.hrc>
#include <algorithm>
+#include <cstddef>
namespace connectivity::file
{
@@ -193,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( )
@@ -407,7 +408,7 @@ void OStatement_Base::construct(const OUString& sql)
}
// at this moment we support only one table per select statement
- m_pTable = comphelper::getFromUnoTunnel<OFileTable>(rTabs.begin()->second);
+ 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();
@@ -440,7 +441,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);
diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx
index 619c1a128dbf..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,7 +63,7 @@ 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)
@@ -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.getInt32();
- 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();
}
@@ -169,14 +167,7 @@ ORowSetValue OOp_Replace::operate(const std::vector<ORowSetValue>& lhs) const
OUString sStr = lhs[2].getString();
OUString sFrom = lhs[1].getString();
OUString sTo = lhs[0].getString();
- 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;
+ 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.getInt32();
+ 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.getString());
+ sRet.append(s);
}
return sRet.makeStringAndClear();
}
diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx
index af2d6de226f8..06dc187fa20e 100644
--- a/connectivity/source/drivers/file/FTable.cxx
+++ b/connectivity/source/drivers/file/FTable.cxx
@@ -118,20 +118,6 @@ void SAL_CALL OFileTable::disposing()
FileClose();
}
-Sequence< sal_Int8 > OFileTable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit s_Id;
- return s_Id.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{});
-}
-
void OFileTable::FileClose()
{
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx
index c063f4a890e6..eda988d9bb44 100644
--- a/connectivity/source/drivers/file/FTables.cxx
+++ b/connectivity/source/drivers/file/FTables.cxx
@@ -23,10 +23,8 @@
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*/)
{
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 d41d3e6077aa..ec56032c8491 100644
--- a/connectivity/source/drivers/file/fcode.cxx
+++ b/connectivity/source/drivers/file/fcode.cxx
@@ -24,7 +24,6 @@
#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;
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index 5a1646a20c70..45c9022340a9 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -29,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>
diff --git a/connectivity/source/drivers/firebird/Blob.cxx b/connectivity/source/drivers/firebird/Blob.cxx
index 33ab36b8d33e..26a5deaca0b4 100644
--- a/connectivity/source/drivers/firebird/Blob.cxx
+++ b/connectivity/source/drivers/firebird/Blob.cxx
@@ -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;
diff --git a/connectivity/source/drivers/firebird/Catalog.cxx b/connectivity/source/drivers/firebird/Catalog.cxx
index c743b42cc75f..2ef4f514b12a 100644
--- a/connectivity/source/drivers/firebird/Catalog.cxx
+++ b/connectivity/source/drivers/firebird/Catalog.cxx
@@ -10,6 +10,7 @@
#include "Catalog.hxx"
#include "Tables.hxx"
#include "Users.hxx"
+#include "Views.hxx"
#include <com/sun/star/sdbc/XRow.hpp>
@@ -53,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(), "%", "%", { "VIEW" });
+
+ 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 ---------------------------------------------------
diff --git a/connectivity/source/drivers/firebird/Catalog.hxx b/connectivity/source/drivers/firebird/Catalog.hxx
index 4a562e22a26e..3ffb9238eda7 100644
--- a/connectivity/source/drivers/firebird/Catalog.hxx
+++ b/connectivity/source/drivers/firebird/Catalog.hxx
@@ -30,6 +30,9 @@ namespace connectivity::firebird
// IRefreshableUsers
virtual void refreshUsers() override;
+
+ sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); }
+ sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); }
};
} // namespace connectivity::firebird
diff --git a/connectivity/source/drivers/firebird/Columns.cxx b/connectivity/source/drivers/firebird/Columns.cxx
index 200eec1fb57d..d36e25f9195b 100644
--- a/connectivity/source/drivers/firebird/Columns.cxx
+++ b/connectivity/source/drivers/firebird/Columns.cxx
@@ -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,
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 64a8495bfc3c..5a2be8872485 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -72,11 +72,11 @@ 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)
@@ -161,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";
@@ -196,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;
@@ -233,8 +233,8 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
if (m_bIsEmbedded || m_bIsFile)
{
- userName = "sysdba";
- userPassword = "masterkey";
+ userName = "sysdba"_ostr;
+ userPassword = "masterkey"_ostr;
}
else
{
@@ -339,12 +339,6 @@ 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")
@@ -358,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;
}
@@ -371,7 +365,7 @@ Reference< XClob> Connection::createClob(ISC_QUAD const * pBlobId)
&m_aTransactionHandle,
*pBlobId);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -383,7 +377,7 @@ sal_Int64 SAL_CALL Connection::getSomething(const css::uno::Sequence<sal_Int8>&
}
// static
-css::uno::Sequence<sal_Int8> Connection::getUnoTunnelId()
+const css::uno::Sequence<sal_Int8> & Connection::getUnoTunnelId()
{
static const comphelper::UnoIdInit implId;
return implId.getSeq();
@@ -402,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;
}
@@ -418,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;
}
@@ -440,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;
}
@@ -629,22 +622,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)
{
@@ -827,42 +816,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*/)
{
@@ -943,13 +899,43 @@ void Connection::disposing()
evaluateStatusVector(status, u"isc_detach_database", *this);
}
}
- // TODO: write to storage again?
+
+ storeDatabase();
cppu::WeakComponentImplHelperBase::disposing();
m_pDatabaseFileDir.reset();
}
+void Connection::storeDatabase()
+{
+ MutexGuard aGuard(m_aMutex);
+ if (m_bIsEmbedded && m_xEmbeddedStorage.is())
+ {
+ 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;
+ 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);
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index caf091146ae6..16ac0ffa278d 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -104,7 +104,7 @@ namespace connectivity::firebird
* The extracted .fbk is written in firebird.fbk, the temporary
* .fdb is stored as firebird.fdb.
*/
- std::unique_ptr< ::utl::TempFile > m_pDatabaseFileDir;
+ std::unique_ptr< ::utl::TempFileNamed > m_pDatabaseFileDir;
/**
* Path for our extracted .fbk file.
*
@@ -172,16 +172,6 @@ namespace connectivity::firebird
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.
@@ -203,6 +193,11 @@ namespace connectivity::firebird
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;
@@ -210,7 +205,7 @@ namespace connectivity::firebird
DECLARE_SERVICE_INFO();
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) override;
- static css::uno::Sequence<sal_Int8> getUnoTunnelId();
+ 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;
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 262b6112c5b8..37c2ffe72c3d 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -821,14 +821,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
@@ -842,7 +842,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[6] = new ORowSetValueDecorator(OUString("length")); // 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);
@@ -854,7 +854,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[6] = new ORowSetValueDecorator(OUString("length")); // 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);
@@ -888,7 +888,7 @@ 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(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);
@@ -904,7 +904,7 @@ 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
}
@@ -928,7 +928,7 @@ 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
@@ -972,7 +972,7 @@ 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(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);
@@ -984,7 +984,7 @@ 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(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);
@@ -996,7 +996,7 @@ 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(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);
@@ -1008,7 +1008,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
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);
@@ -1020,12 +1020,13 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
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;
}();
+ // [-loplugin:redundantfcast] false positive:
pResultSet->setRows(ODatabaseMetaDataResultSet::ORows(aResults));
return pResultSet;
}
@@ -1476,7 +1477,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool bIsImport, std::u16string_view table )
{
rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
- ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eImportedKeys);
+ ODatabaseMetaDataResultSet(bIsImport?ODatabaseMetaDataResultSet::eImportedKeys:ODatabaseMetaDataResultSet::eExportedKeys);
uno::Reference< XStatement > statement = m_pConnection->createStatement();
@@ -1679,7 +1680,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)));
@@ -1701,7 +1702,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
aResults.push_back(aCurrentRow);
}
rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new
- ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::ePrimaryKeys);
+ ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eIndexInfo);
pResultSet->setRows( std::move(aResults) );
return pResultSet;
@@ -1772,7 +1773,7 @@ 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);
}
diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index 3a1b80292adc..3aa903d48abf 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -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
};
@@ -66,10 +66,10 @@ FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentCo
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,
@@ -78,7 +78,7 @@ FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentCo
::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.
@@ -86,7 +86,7 @@ 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*/
}
@@ -105,13 +105,13 @@ void FirebirdDriver::disposing()
}
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*/
@@ -151,7 +151,7 @@ Reference< XConnection > SAL_CALL FirebirdDriver::connect(
rtl::Reference<Connection> pCon = new Connection();
pCon->construct(url, info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.emplace_back(*pCon);
return pCon;
}
diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx
index 06841d937e70..d884b5008d6a 100644
--- a/connectivity/source/drivers/firebird/Driver.hxx
+++ b/connectivity/source/drivers/firebird/Driver.hxx
@@ -45,8 +45,8 @@ namespace connectivity::firebird
{
private:
css::uno::Reference<css::uno::XComponentContext> m_aContext;
- ::utl::TempFile m_firebirdTMPDirectory;
- ::utl::TempFile m_firebirdLockDirectory;
+ ::utl::TempFileNamed m_firebirdTMPDirectory;
+ ::utl::TempFileNamed m_firebirdLockDirectory;
protected:
::osl::Mutex m_aMutex; // mutex is need to control member access
diff --git a/connectivity/source/drivers/firebird/Indexes.cxx b/connectivity/source/drivers/firebird/Indexes.cxx
index 10ec90dc5be0..7bf783c79c7b 100644
--- a/connectivity/source/drivers/firebird/Indexes.cxx
+++ b/connectivity/source/drivers/firebird/Indexes.cxx
@@ -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)
{
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index c665581f8c32..35847d021ea0 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -50,6 +50,8 @@ using namespace com::sun::star::util;
IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.firebird.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+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,
const OUString& sql)
@@ -207,7 +209,8 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex,
{
str = str.copy(0, max_varchar_len);
}
- const auto nLength = str.getLength();
+ const sal_uInt16 nLength = str.getLength();
+ static_assert(sizeof(nLength) == 2, "must match dest memcpy len");
memcpy(pVar->sqldata, &nLength, 2);
// Actual data
memcpy(pVar->sqldata + 2, str.getStr(), str.getLength());
@@ -331,9 +334,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.
}
@@ -379,7 +379,7 @@ sal_Int64 toNumericWithoutDecimalPlace(const OUString& sSource)
sBuffer.append(sNumber.subView(0, nDotIndex));
}
sBuffer.append(sNumber.subView(nDotIndex + 1));
- return sBuffer.makeStringAndClear().toInt64();
+ return o3tl::toInt64(sBuffer);
}
}
@@ -567,7 +567,7 @@ void OPreparedStatement::openBlobForWriting(isc_blob_handle& rBlobHandle, ISC_QU
if (aErr)
{
evaluateStatusVector(m_statusVector,
- OUStringConcatenation("setBlob failed on " + m_sSqlStatement),
+ Concat2View("setBlob failed on " + m_sSqlStatement),
*this);
assert(false);
}
@@ -609,9 +609,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(
@@ -660,10 +660,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.
@@ -782,7 +813,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
sBuffer.append(sValue);
if(sValue.indexOf('.') != -1) // there is a dot
{
- for(sal_Int32 i=sValue.copy(sValue.indexOf('.')+1).getLength(); i<scale;i++)
+ for(sal_Int32 i=sValue.subView(sValue.indexOf('.')+1).size(); i<scale;i++)
{
sBuffer.append('0');
}
@@ -908,7 +939,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
{
xBytesCopy.realloc( nMaxSize );
}
- const auto nSize = xBytesCopy.getLength();
+ const sal_uInt16 nSize = xBytesCopy.getLength();
// 8000 corresponds to value from lcl_addDefaultParameters
// in dbaccess/source/filter/hsqldb/createparser.cxx
if (nSize > 8000)
@@ -916,6 +947,7 @@ 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
@@ -923,9 +955,12 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
}
else if( dType == SQL_TEXT )
{
+ if (pVar->sqllen < xBytes.getLength())
+ dbtools::throwSQLException("Data too big for this field",
+ 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
diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index aa13dbd0b96c..ea3ac86ae762 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -452,7 +452,7 @@ T OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT nType)
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.
diff --git a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx
index 78d684a725a2..31a6796f5399 100644
--- a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx
+++ b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx
@@ -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();
@@ -128,9 +128,15 @@ 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;
}
@@ -191,8 +197,8 @@ sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement(sal_Int32 column)
OUString sSql = "SELECT RDB$IDENTITY_TYPE FROM RDB$RELATION_FIELDS "
"WHERE RDB$RELATION_NAME = '"
- + escapeWith(sTable, '\'', '\'') + "' AND "
- "RDB$FIELD_NAME = '"+ escapeWith(sColumnName, '\'', '\'') +"'";
+ + sTable.replaceAll("'", "''") + "' AND "
+ "RDB$FIELD_NAME = '"+ sColumnName.replaceAll("'", "''") +"'";
Reference<XStatement> xStmt =m_pConnection ->createStatement();
@@ -236,9 +242,9 @@ sal_Int32 SAL_CALL OResultSetMetaData::getPrecision(sal_Int32 column)
" 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 "
+ + getTableName(column).replaceAll("'", "''") + "' AND "
"RDB$RELATION_FIELDS.RDB$FIELD_NAME = '"
- + escapeWith(sColumnName, '\'', '\'') +"'";
+ + sColumnName.replaceAll("'", "''") +"'";
Reference<XStatement> xStmt= m_pConnection->createStatement();
Reference<XResultSet> xRes =
diff --git a/connectivity/source/drivers/firebird/Statement.cxx b/connectivity/source/drivers/firebird/Statement.cxx
index f4faebbf1a55..d135c4e4cda4 100644
--- a/connectivity/source/drivers/firebird/Statement.cxx
+++ b/connectivity/source/drivers/firebird/Statement.cxx
@@ -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&)
@@ -71,7 +70,8 @@ void SAL_CALL OStatement::release() noexcept
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;
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
index 1c03f73e154d..29ef5925657d 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -43,7 +43,6 @@ using namespace ::com::sun::star::util;
using namespace ::comphelper;
using namespace ::osl;
-using namespace ::std;
OStatementCommonBase::OStatementCommonBase(Connection* _pConnection)
: OStatementCommonBase_Base(m_aMutex),
@@ -242,31 +241,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
+ }
+ }
+ };
}
@@ -414,6 +453,7 @@ 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?
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index c32160b99979..871febcf5122 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -155,27 +155,14 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
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);
}
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index b686f66ecb9c..e3440137381a 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -9,6 +9,7 @@
#include "Table.hxx"
#include "Tables.hxx"
+#include "Views.hxx"
#include "Catalog.hxx"
#include <TConnection.hxx>
@@ -29,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;
@@ -89,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.
@@ -103,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)
@@ -148,8 +145,8 @@ 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);
@@ -165,8 +162,8 @@ 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();
@@ -202,6 +199,27 @@ void Tables::dropObject(sal_Int32 nPosition, const OUString& sName)
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);
+ }
}
+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 d7fe019ef2a6..ada1827097a5 100644
--- a/connectivity/source/drivers/firebird/Tables.hxx
+++ b/connectivity/source/drivers/firebird/Tables.hxx
@@ -13,6 +13,7 @@
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <connectivity/sdbcx/VCollection.hxx>
+#include <utility>
namespace connectivity::firebird
{
@@ -40,10 +41,10 @@ namespace connectivity::firebird
const css::uno::Reference< css::beans::XPropertySet >& rDescriptor) override;
public:
- Tables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData,
+ 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(rMetaData) {}
+ ::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.
@@ -51,6 +52,8 @@ namespace connectivity::firebird
// XDrop
virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override;
+ void appendNew(const OUString& _rsNewTable);
+
};
} // namespace connectivity::firebird
diff --git a/connectivity/source/drivers/firebird/Users.cxx b/connectivity/source/drivers/firebird/Users.cxx
index 50cfef84be8c..10912d6be0ab 100644
--- a/connectivity/source/drivers/firebird/Users.cxx
+++ b/connectivity/source/drivers/firebird/Users.cxx
@@ -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;
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index 344c0164ac66..3cee5dab6e0b 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -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,12 +23,12 @@ 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,
@@ -43,8 +44,8 @@ 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 (...)
@@ -410,22 +411,6 @@ 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, rtl::OUStringConcatenation(OUStringChar(aEscapeChar) + OUStringChar(aKey)) );
- aIndex += 2;
- }
-
- return sRet;
-}
-
sal_Int64 firebird::pow10Integer(int nDecimalCount)
{
sal_Int64 nRet = 1;
diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx
index 46fadebb1a20..db407ef98b38 100644
--- a/connectivity/source/drivers/firebird/Util.hxx
+++ b/connectivity/source/drivers/firebird/Util.hxx
@@ -14,6 +14,7 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/XInterface.hpp>
+#include <utility>
namespace connectivity::firebird
{
@@ -57,16 +58,16 @@ public:
*
*/
explicit ColumnTypeInfo( short aType, short aSubType = 0,
- short nScale = 0, const OUString& sCharset = OUString() )
+ short nScale = 0, OUString sCharset = OUString() )
: m_aType(aType)
, m_aSubType(aSubType)
, m_nScale(nScale)
- , m_sCharsetName(sCharset) {}
- explicit ColumnTypeInfo( short aType, const OUString& sCharset )
+ , m_sCharsetName(std::move(sCharset)) {}
+ explicit ColumnTypeInfo( short aType, OUString sCharset )
: m_aType(aType)
, m_aSubType(0)
, m_nScale(0)
- , m_sCharsetName(sCharset) {}
+ , m_sCharsetName(std::move(sCharset)) {}
short getType() const { return m_aType; }
short getSubType() const { return m_aSubType; }
short getScale() const { return m_nScale; }
@@ -86,7 +87,7 @@ public:
* 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);
+ OUString sanitizeIdentifier(std::u16string_view rIdentifier);
inline bool IndicatesError(const ISC_STATUS_ARRAY& rStatusVector)
{
@@ -118,7 +119,6 @@ public:
void freeSQLVAR(XSQLDA* pSqlda);
- OUString escapeWith( const OUString& sText, const char aKey, const char aEscapeChar);
sal_Int64 pow10Integer( int nDecimalCount );
}
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..2e5bec42adc3
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Views.cxx
@@ -0,0 +1,112 @@
+/* -*- 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)
+{
+}
+
+connectivity::sdbcx::ObjectType 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
+connectivity::sdbcx::ObjectType 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("DROP VIEW");
+
+ 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..6887bdc66ed0
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Views.hxx
@@ -0,0 +1,42 @@
+/* -*- 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 connectivity::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;
+
+ 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..72b470235a01 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;
diff --git a/connectivity/source/drivers/flat/EColumns.cxx b/connectivity/source/drivers/flat/EColumns.cxx
index a9e210321ba6..56585f1e8059 100644
--- a/connectivity/source/drivers/flat/EColumns.cxx
+++ b/connectivity/source/drivers/flat/EColumns.cxx
@@ -23,10 +23,6 @@
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)
diff --git a/connectivity/source/drivers/flat/EConnection.cxx b/connectivity/source/drivers/flat/EConnection.cxx
index 288a53fa649a..a65470caaad9 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)
diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
index b711645b591e..729b55ef9e2d 100644
--- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
@@ -47,8 +47,6 @@ OFlatDatabaseMetaData::~OFlatDatabaseMetaData()
Reference< XResultSet > OFlatDatabaseMetaData::impl_getTypeInfo_throw( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
static ODatabaseMetaDataResultSet::ORows aRows = []()
diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx
index 29492895510e..034e1b0b97f4 100644
--- a/connectivity/source/drivers/flat/EDriver.cxx
+++ b/connectivity/source/drivers/flat/EDriver.cxx
@@ -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 )
@@ -68,7 +68,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const S
rtl::Reference<OFlatConnection> pCon = new OFlatConnection(this);
pCon->construct(url,info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.emplace_back(*pCon);
return pCon;
}
diff --git a/connectivity/source/drivers/flat/EPreparedStatement.cxx b/connectivity/source/drivers/flat/EPreparedStatement.cxx
index f4095ac2c087..0ed4299258a2 100644
--- a/connectivity/source/drivers/flat/EPreparedStatement.cxx
+++ b/connectivity/source/drivers/flat/EPreparedStatement.cxx
@@ -22,7 +22,6 @@
using namespace connectivity::flat;
using namespace connectivity::file;
-using namespace ::com::sun::star::uno;
rtl::Reference<OResultSet> OFlatPreparedStatement::createResultSet()
{
diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx
index 2e8c2a391d97..9d1975c77e45 100644
--- a/connectivity/source/drivers/flat/EResultSet.cxx
+++ b/connectivity/source/drivers/flat/EResultSet.cxx
@@ -96,7 +96,7 @@ Any SAL_CALL OFlatResultSet::getBookmark( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return makeAny((*m_aRow)[0]->getValue().getInt32());
+ return Any((*m_aRow)[0]->getValue().getInt32());
}
sal_Bool SAL_CALL OFlatResultSet::moveToBookmark( const Any& bookmark )
diff --git a/connectivity/source/drivers/flat/EStatement.cxx b/connectivity/source/drivers/flat/EStatement.cxx
index dc801ac48653..df9fca5f58f2 100644
--- a/connectivity/source/drivers/flat/EStatement.cxx
+++ b/connectivity/source/drivers/flat/EStatement.cxx
@@ -22,7 +22,6 @@
using namespace connectivity::flat;
using namespace connectivity::file;
-using namespace css::uno;
rtl::Reference<OResultSet> OFlatStatement::createResultSet()
{
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 4c8c446dfeaa..9cab6b13da5a 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -265,8 +265,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?
@@ -545,24 +545,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 const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OFlatTable_BASE>{});
-}
-
bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool bRetrieveData)
{
*(*_rRow)[0] = m_nFilePos;
@@ -674,7 +660,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;
diff --git a/connectivity/source/drivers/flat/ETables.cxx b/connectivity/source/drivers/flat/ETables.cxx
index 2e4dd377ed83..3b0d039311fc 100644
--- a/connectivity/source/drivers/flat/ETables.cxx
+++ b/connectivity/source/drivers/flat/ETables.cxx
@@ -22,15 +22,8 @@
#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)
{
diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx
index 1074be53559c..c51c9d15a520 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)
diff --git a/connectivity/source/drivers/hsqldb/HColumns.cxx b/connectivity/source/drivers/hsqldb/HColumns.cxx
index 3f03c3616bc1..e37f9fbd3a5e 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
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
index 506bf5b075f9..28feb95fce9b 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -36,7 +36,7 @@
#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>
@@ -281,8 +281,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'" );
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 962e574879cf..234fc969db63 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -50,7 +50,8 @@
#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 <memory>
@@ -68,9 +69,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;
@@ -213,14 +213,12 @@ namespace connectivity
aProperties.put( "JavaDriverClass",
OUString( "org.hsqldb.jdbcDriver" ) );
aProperties.put( "JavaDriverClassPath",
- OUString(
#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 );
@@ -235,14 +233,14 @@ namespace connectivity
// security: permitted Java classes
NamedValue aPermittedClasses(
"hsqldb.method_class_names",
- makeAny( lcl_getPermittedJavaMethods_nothrow( m_xContext ) )
+ Any( lcl_getPermittedJavaMethods_nothrow( m_xContext ) )
);
aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) );
OUString sMessage;
try
{
- static const OUStringLiteral sProperties( u"properties" );
+ static constexpr OUString sProperties( u"properties"_ustr );
if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) )
{
Reference<XStream > xStream = xStorage->openStreamElement(sProperties,ElementModes::READ);
@@ -251,15 +249,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 +273,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 +288,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&)
{
@@ -357,8 +386,7 @@ namespace connectivity
Reference<XTransactionBroadcaster> xBroad(xStorage,UNO_QUERY);
if ( xBroad.is() )
{
- Reference<XTransactionListener> xListener(*this,UNO_QUERY);
- xBroad->addTransactionListener(xListener);
+ xBroad->addTransactionListener(Reference<XTransactionListener>(this));
}
}
}
@@ -833,8 +861,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 f4f67a8e394a..8d15d487372a 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -22,17 +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>
#include <algorithm>
-using namespace ::com::sun::star::container;
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) { \
@@ -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
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
index 63b5e0481c5c..01a9c3d34be3 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
{
@@ -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 9a23b6052468..63fe36a34a34 100644
--- a/connectivity/source/drivers/hsqldb/HTable.cxx
+++ b/connectivity/source/drivers/hsqldb/HTable.cxx
@@ -29,7 +29,7 @@
#include <hsqldb/HColumns.hxx>
#include <TConnection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::comphelper;
@@ -115,19 +115,6 @@ sdbcx::OCollection* OHSQLTable::createIndexes(const ::std::vector< OUString>& _r
return new OIndexesHelper(this,m_aMutex,_rNames);
}
-Sequence< sal_Int8 > OHSQLTable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OHSQLTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{});
-}
// XAlterTable
void SAL_CALL OHSQLTable::alterColumnByName( const OUString& colName, const Reference< XPropertySet >& descriptor )
@@ -259,7 +246,7 @@ void OHSQLTable::alterColumnType(sal_Int32 nNewType,const OUString& _rColName, c
rtl::Reference<OHSQLColumn> pColumn = new OHSQLColumn;
::comphelper::copyProperties(_xDescriptor,pColumn);
- pColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType));
+ pColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),Any(nNewType));
sSql += ::dbtools::createStandardColumnPart(pColumn,getConnection());
executeStatement(sSql);
diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx
index de818686b49d..002dfbf9a295 100644
--- a/connectivity/source/drivers/hsqldb/HTables.cxx
+++ b/connectivity/source/drivers/hsqldb/HTables.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 dbtools;
sdbcx::ObjectType OTables::createObject(const OUString& _rName)
@@ -160,7 +159,7 @@ void OTables::appendNew(const OUString& _rsNewTable)
insertElement(_rsNewTable,nullptr);
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rsNewTable), Any(), Any());
OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
aListenerLoop.next()->elementInserted(aEvent);
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/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx
index 2ed0c06262ff..f493e282a2b1 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();
}
diff --git a/connectivity/source/drivers/hsqldb/HUsers.cxx b/connectivity/source/drivers/hsqldb/HUsers.cxx
index 9fe31e58eb01..07a91e7cbed2 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,16 +31,14 @@ 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)
{
}
diff --git a/connectivity/source/drivers/hsqldb/HView.cxx b/connectivity/source/drivers/hsqldb/HView.cxx
index 29e5a4000a51..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>
@@ -146,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 1f4b807484e5..f80ec7716f09 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;
diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
index e352f78fbe5a..bb07d6673fb1 100644
--- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <hsqldb/HStorageMap.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno;
diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
index 4fcbbc5aa6cd..58d351673480 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;
/*****************************************************************************/
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/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
index 884de3d4ce10..ae521efba11a 100644
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx
@@ -33,7 +33,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;
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index bd2f8470a2a9..27c7ae01aec3 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 )
{
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 5553b1195d29..5844df568ba3 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());
}
@@ -436,7 +437,7 @@ Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( )
SDBThreadAttach t;
rtl::Reference<java_sql_Statement> pStatement = new java_sql_Statement( t.pEnv, *this );
Reference< XStatement > xStmt = pStatement;
- m_aStatements.push_back( WeakReferenceHelper( xStmt ) );
+ m_aStatements.emplace_back(xStmt);
m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xStmt;
@@ -452,7 +453,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement(
rtl::Reference<java_sql_PreparedStatement> pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xReturn( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xReturn;
@@ -468,7 +469,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const
rtl::Reference<java_sql_CallableStatement> pStatement = new java_sql_CallableStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xStmt( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xStmt));
+ m_aStatements.emplace_back(xStmt);
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, pStatement->getStatementObjectID() );
return xStmt;
@@ -523,14 +524,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();
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx
index df9d660f554c..1d5326ca6302 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>
@@ -378,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();
@@ -576,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
+ }
+ }
+ };
}
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index f05eced9df9a..65d6680d745e 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -31,9 +31,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;
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 33aadcbca840..fa3f7b40c982 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;
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index 4c7ec72c54f7..c274c521c33c 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -514,7 +514,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)));
}
@@ -873,25 +873,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()
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..1d1959717370 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)
{
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/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/MacabDatabaseMetaData.cxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
index b54b844c9b20..b0b04fc08f21 100644
--- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
@@ -923,7 +923,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
// 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();
@@ -958,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);
diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx
index 4667c690a8b1..9c68e48f12a7 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" ) );
+ 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/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 a230d237ab72..24b3fc7b0b9c 100644
--- a/connectivity/source/drivers/macab/MacabHeader.hxx
+++ b/connectivity/source/drivers/macab/MacabHeader.hxx
@@ -50,7 +50,6 @@ namespace connectivity::macab
public:
iterator& operator= (MacabHeader *_record);
iterator();
- ~iterator();
void operator++ ();
bool operator!= (const sal_Int32 i) const;
bool operator== (const sal_Int32 i) const;
diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx
index 4c2d4aed8fa1..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
@@ -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 004d10b1b6d2..8d0d5cf6f796 100644
--- a/connectivity/source/drivers/macab/MacabRecords.hxx
+++ b/connectivity/source/drivers/macab/MacabRecords.hxx
@@ -113,7 +113,6 @@ namespace connectivity::macab
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;
diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx
index ecb4ea79e417..4142fcb6cce0 100644
--- a/connectivity/source/drivers/macab/MacabResultSet.cxx
+++ b/connectivity/source/drivers/macab/MacabResultSet.cxx
@@ -885,7 +885,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) ));
}
}
}
@@ -981,28 +981,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/MacabStatement.cxx b/connectivity/source/drivers/macab/MacabStatement.cxx
index 6c8a02cd7391..95b922ce6bc7 100644
--- a/connectivity/source/drivers/macab/MacabStatement.cxx
+++ b/connectivity/source/drivers/macab/MacabStatement.cxx
@@ -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()
diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx
index cfe46f37f286..7e0f6b091085 100644
--- a/connectivity/source/drivers/macab/macabutilities.hxx
+++ b/connectivity/source/drivers/macab/macabutilities.hxx
@@ -19,6 +19,10 @@
#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>
@@ -47,15 +51,15 @@ namespace connectivity::macab
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';
- CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars);
+ CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars.get());
CFRelease(sOrig);
- return OUString(reinterpret_cast<sal_Unicode *>(unichars));
+ return OUString(reinterpret_cast<sal_Unicode *>(unichars.get()));
}
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
index faa2063b27b8..076a05d3b9dc 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
@@ -32,8 +32,6 @@ using namespace connectivity::mozab;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
MozillaBootstrap::MozillaBootstrap()
: OMozillaBootstrap_BASE(m_aMutex)
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
index ae775b6fca01..a146d0c09680 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
@@ -22,6 +22,7 @@
#include <osl/file.h>
#include <rtl/byteseq.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
IniParser::IniParser(OUString const & rIniName)
{
@@ -62,9 +63,9 @@ IniParser::IniParser(OUString const & rIniName)
ini_Section *aSection = &mAllSection[sectionName];
struct ini_NameValue nameValue;
nameValue.sName = OStringToOUString(
- line.copy(0,nIndex).trim(), RTL_TEXTENCODING_ASCII_US );
+ o3tl::trim(line.subView(0,nIndex)), RTL_TEXTENCODING_ASCII_US );
nameValue.sValue = OStringToOUString(
- line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 );
+ o3tl::trim(line.subView(nIndex+1)), RTL_TEXTENCODING_UTF8 );
aSection->vVector.push_back(nameValue);
@@ -76,7 +77,7 @@ IniParser::IniParser(OUString const & rIniName)
if ( nIndexEnd > nIndexStart && nIndexStart >=0)
{
sectionName = OStringToOUString(
- line.copy(nIndexStart + 1,nIndexEnd - nIndexStart -1).trim(), RTL_TEXTENCODING_ASCII_US );
+ o3tl::trim(line.subView(nIndexStart + 1,nIndexEnd - nIndexStart -1)), RTL_TEXTENCODING_ASCII_US );
if (sectionName.isEmpty())
sectionName = "no name section";
}
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
index 18d95cdbdb81..804c8ccc66d8 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
@@ -18,6 +18,8 @@
*/
+#include <utility>
+
#include "MNSProfileDiscover.hxx"
#include "MNSFolders.hxx"
#include "MNSINIParser.hxx"
@@ -28,10 +30,10 @@ namespace connectivity::mozab
{
}
- ProfileStruct::ProfileStruct(const OUString& aProfileName,
- const OUString& aProfilePath)
- : profileName(aProfileName)
- , profilePath(aProfilePath)
+ ProfileStruct::ProfileStruct(OUString aProfileName,
+ OUString aProfilePath)
+ : profileName(std::move(aProfileName))
+ , profilePath(std::move(aProfilePath))
{
}
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
index a5f271183b27..132ac06c003c 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
@@ -37,7 +37,7 @@ namespace connectivity::mozab
{
public:
ProfileStruct();
- ProfileStruct(const OUString& aProfileName, const OUString &aProfilePath);
+ ProfileStruct(OUString aProfileName, OUString aProfilePath);
const OUString& getProfileName() const { return profileName;}
const OUString& getProfilePath() const;
private:
diff --git a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
index 9c0afb55abd5..de9ffd7127d5 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)
diff --git a/connectivity/source/drivers/mysql_jdbc/YColumns.cxx b/connectivity/source/drivers/mysql_jdbc/YColumns.cxx
index 54beb77ca061..910b01e4fb11 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)
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index 7ee501d42e81..e4e338ee0b31 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -49,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",
+ OUString("com.mysql.jdbc.Driver"));
}
}
@@ -115,9 +115,9 @@ T_DRIVERTYPE lcl_getDriverType(std::u16string_view _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))
@@ -158,36 +158,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(OUString("com.mysql.jdbc.Driver")),
+ 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(OUString("SELECT LAST_INSERT_ID()")),
+ 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;
@@ -232,8 +226,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;
@@ -244,7 +238,7 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
OUString sAdd;
if (RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding())
{
- static constexpr OUStringLiteral s_sCharSetOp = u"useUnicode=true&";
+ static constexpr OUString s_sCharSetOp = u"useUnicode=true&"_ustr;
if (!sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp))
{
sAdd = s_sCharSetOp;
@@ -266,9 +260,9 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
auto pMetaConnection = comphelper::getFromUnoTunnel<OMetaConnection>(xConnection);
if (pMetaConnection)
pMetaConnection->setURL(url);
- m_aConnections.push_back(
- TWeakPair(WeakReferenceHelper(xConnection),
- TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection)));
+ m_aConnections.emplace_back(
+ WeakReferenceHelper(xConnection),
+ TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection));
}
}
}
@@ -300,18 +294,17 @@ ODriverDelegator::getPropertyInfo(const OUString& url, const Sequence<PropertyVa
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());
diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
index b5b02fefc1bc..b79b3f231bbf 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
@@ -116,20 +116,6 @@ sdbcx::OCollection* OMySQLTable::createIndexes(const ::std::vector<OUString>& _r
return new OIndexesHelper(this, m_aMutex, _rNames);
}
-Sequence<sal_Int8> OMySQLTable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OMySQLTable::getSomething(const Sequence<sal_Int8>& rId)
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{});
-}
-
// XAlterTable
void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
const Reference<XPropertySet>& descriptor)
@@ -198,7 +184,7 @@ void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
{
sTypeName += OUString::Concat(" ") + s_sAutoIncrement;
descriptor->setPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME),
- makeAny(sTypeName));
+ Any(sTypeName));
}
}
else
@@ -210,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));
}
}
}
@@ -269,7 +255,7 @@ void OMySQLTable::alterColumnType(sal_Int32 nNewType, const OUString& _rColName,
rtl::Reference<OColumn> pColumn = new OColumn(true);
::comphelper::copyProperties(_xDescriptor, pColumn);
pColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),
- makeAny(nNewType));
+ Any(nNewType));
sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(
pColumn, getConnection(), static_cast<OTables*>(m_pTables), getTypeCreatePattern()));
diff --git a/connectivity/source/drivers/mysql_jdbc/YTables.cxx b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
index f1ab3ee1e7b3..aa527cf0cc30 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTables.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTables.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 dbtools;
sdbcx::ObjectType OTables::createObject(const OUString& _rName)
@@ -153,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(),
- rtl::OUStringConcatenation(sNewUnsigned + s_sUNSIGNED));
+ rtl::Concat2View(sNewUnsigned + s_sUNSIGNED));
nIndex = sSQL.indexOf(s_sUNSIGNED, nIndex + strlen(s_sUNSIGNED) + sNewUnsigned.getLength());
}
return sSQL;
@@ -178,7 +177,7 @@ void OTables::appendNew(const OUString& _rsNewTable)
insertElement(_rsNewTable, nullptr);
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rsNewTable), Any(), Any());
OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
aListenerLoop.next()->elementInserted(aEvent);
diff --git a/connectivity/source/drivers/mysql_jdbc/YUser.cxx b/connectivity/source/drivers/mysql_jdbc/YUser.cxx
index b683fe2b2757..ec3a6265967f 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();
}
diff --git a/connectivity/source/drivers/mysql_jdbc/YUsers.cxx b/connectivity/source/drivers/mysql_jdbc/YUsers.cxx
index ed33cb0e2d7c..b096310acd4c 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,15 +31,13 @@ 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)
{
}
diff --git a/connectivity/source/drivers/mysql_jdbc/YViews.cxx b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
index 3dba721c0c86..e9531df6950f 100644
--- a/connectivity/source/drivers/mysql_jdbc/YViews.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
@@ -32,10 +32,7 @@ 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;
diff --git a/connectivity/source/drivers/mysqlc/DataAccess.xcu b/connectivity/source/drivers/mysqlc/DataAccess.xcu
deleted file mode 100644
index 2b652ec87649..000000000000
--- a/connectivity/source/drivers/mysqlc/DataAccess.xcu
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- * 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 .
- -->
-<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>
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx b/connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx
index 035c7761f5e3..d72ab1f65d72 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_catalog.cxx
@@ -11,24 +11,21 @@
#include "mysqlc_tables.hxx"
#include "mysqlc_views.hxx"
#include "mysqlc_users.hxx"
-
#include <com/sun/star/sdbc/XRow.hpp>
+#include <comphelper/types.hxx>
-using namespace ::connectivity::mysqlc;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::uno;
-
-Catalog::Catalog(const uno::Reference<XConnection>& rConnection)
+connectivity::mysqlc::Catalog::Catalog(
+ const css::uno::Reference<css::sdbc::XConnection>& rConnection)
: OCatalog(rConnection)
, m_xConnection(rConnection)
{
}
//----- OCatalog -------------------------------------------------------------
-void Catalog::refreshTables()
+void connectivity::mysqlc::Catalog::refreshTables()
{
- uno::Reference<XResultSet> xTables = m_xMetaData->getTables(Any(), "%", "%", {});
+ css::uno::Reference<css::sdbc::XResultSet> xTables
+ = m_xMetaData->getTables(css::uno::Any(), "%", "%", {});
if (!xTables.is())
return;
@@ -43,9 +40,10 @@ void Catalog::refreshTables()
m_pTables->reFill(aTableNames);
}
-void Catalog::refreshViews()
+void connectivity::mysqlc::Catalog::refreshViews()
{
- uno::Reference<XResultSet> xViews = m_xMetaData->getTables(Any(), "%", "%", { "VIEW" });
+ css::uno::Reference<css::sdbc::XResultSet> xViews
+ = m_xMetaData->getTables(css::uno::Any(), "%", "%", { "VIEW" });
if (!xViews.is())
return;
@@ -61,15 +59,35 @@ void Catalog::refreshViews()
}
//----- IRefreshableGroups ---------------------------------------------------
-void Catalog::refreshGroups()
+void connectivity::mysqlc::Catalog::refreshGroups()
{
// TODO: implement me
}
//----- IRefreshableUsers ----------------------------------------------------
-void Catalog::refreshUsers()
+void connectivity::mysqlc::Catalog::refreshUsers()
{
- // TODO: implement me
+ css::uno::Reference<css::sdbc::XStatement> statement = m_xConnection->createStatement();
+ css::uno::Reference<css::sdbc::XResultSet> xUsers = statement->executeQuery(
+ "SELECT grantee FROM information_schema.user_privileges GROUP BY grantee");
+
+ 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
index 288367f38e33..1bea18c7667b 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_catalog.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_catalog.hxx
@@ -29,6 +29,8 @@ public:
// IRefreshableUsers
virtual void refreshUsers() override;
+
+ sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); }
};
} // namespace connectivity::mysqlc
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_column.cxx b/connectivity/source/drivers/mysqlc/mysqlc_column.cxx
index 960f0ff97526..ceb7437386e6 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_column.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_column.cxx
@@ -11,17 +11,13 @@
#include <TConnection.hxx>
-using namespace connectivity;
-using namespace connectivity::mysqlc;
-using namespace connectivity::sdbcx;
-
-Column::Column()
+connectivity::mysqlc::Column::Column()
: OColumn(true) // case sensitive
{
construct();
}
-void Column::construct()
+void connectivity::mysqlc::Column::construct()
{
m_sAutoIncrement = "auto_increment";
registerProperty(
@@ -30,17 +26,18 @@ void Column::construct()
cppu::UnoType<decltype(m_sAutoIncrement)>::get());
}
-::cppu::IPropertyArrayHelper* Column::createArrayHelper(sal_Int32 /*_nId*/) const
+::cppu::IPropertyArrayHelper*
+ connectivity::mysqlc::Column::createArrayHelper(sal_Int32 /*_nId*/) const
{
return doCreateArrayHelper();
}
-::cppu::IPropertyArrayHelper& SAL_CALL Column::getInfoHelper()
+::cppu::IPropertyArrayHelper& SAL_CALL connectivity::mysqlc::Column::getInfoHelper()
{
return *Column_PROP::getArrayHelper(isNew() ? 1 : 0);
}
-css::uno::Sequence<OUString> SAL_CALL Column::getSupportedServiceNames()
+css::uno::Sequence<OUString> SAL_CALL connectivity::mysqlc::Column::getSupportedServiceNames()
{
return { "com.sun.star.sdbcx.Column" };
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_columns.cxx b/connectivity/source/drivers/mysqlc/mysqlc_columns.cxx
index 6f1837ba2e8c..b34b36b45cbe 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_columns.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_columns.cxx
@@ -10,18 +10,8 @@
#include "mysqlc_columns.hxx"
#include "mysqlc_column.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::sdbc;
-using namespace ::com::sun::star::uno;
-
-Columns::Columns(Table& rTable, Mutex& rMutex, const ::std::vector<OUString>& rVector)
+connectivity::mysqlc::Columns::Columns(Table& rTable, osl::Mutex& rMutex,
+ const ::std::vector<OUString>& rVector)
: OColumnsHelper(rTable,
true, // case sensitivity
rMutex, rVector,
@@ -30,6 +20,9 @@ Columns::Columns(Table& rTable, Mutex& rMutex, const ::std::vector<OUString>& rV
OColumnsHelper::setParent(&rTable);
}
-Reference<css::beans::XPropertySet> Columns::createDescriptor() { return new Column; }
+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_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 1c654c3e24ed..269113383d8d 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -29,25 +29,17 @@
#include <com/sun/star/beans/NamedValue.hpp>
-#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
-#include <comphelper/storagehelper.hxx>
-
-#include <osl/diagnose.h>
-#include <cppuhelper/supportsservice.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)
@@ -81,7 +73,7 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
mysql_library_init(0, nullptr, nullptr);
mysql_init(&m_mysql);
- OString charset_name{ "utf8mb4" };
+ OString charset_name{ "utf8mb4"_ostr };
mysql_options(&m_mysql, MYSQL_SET_CHARSET_NAME, charset_name.getStr());
sal_Int32 nIndex;
@@ -95,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;
}
@@ -200,9 +192,8 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>&
*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()
@@ -265,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();
@@ -473,7 +462,7 @@ OUString OConnection::transFormPreparedStatement(const OUString& _sSQL)
try
{
Reference<XConnection> xCon = this;
- Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection", makeAny(xCon))) };
+ Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection", Any(xCon))) };
m_xParameterSubstitution.set(
m_xDriver->getFactory()->createInstanceWithArguments(
@@ -505,7 +494,7 @@ sal_Int64 SAL_CALL OConnection::getSomething(const css::uno::Sequence<sal_Int8>&
}
// static
-Sequence<sal_Int8> OConnection::getUnoTunnelId()
+const Sequence<sal_Int8>& OConnection::getUnoTunnelId()
{
static const comphelper::UnoIdInit implId;
return implId.getSeq();
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
index 5280ecde78f1..3a0ccf36b4ed 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
@@ -24,12 +24,9 @@
#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>
@@ -39,8 +36,6 @@
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <rtl/string.hxx>
#include <rtl/ref.hxx>
#include <mysql.h>
@@ -59,10 +54,6 @@ class ODatabaseMetaData;
namespace mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
-using ::com::sun::star::sdbc::SQLWarning;
-using ::com::sun::star::uno::RuntimeException;
-
typedef ::cppu::WeakComponentImplHelper<css::sdbc::XConnection, css::sdbc::XWarningsSupplier,
css::lang::XUnoTunnel, css::lang::XServiceInfo>
OMetaConnection_BASE;
@@ -136,7 +127,7 @@ public:
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) override;
- static css::uno::Sequence<sal_Int8> getUnoTunnelId();
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
// XConnection
css::uno::Reference<css::sdbc::XStatement> SAL_CALL createStatement() override;
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index 57856804c793..6d171b661815 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("%");
@@ -564,7 +564,7 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTableTypes()
if (m_rConnection.getMysqlVersion() >= requiredVersion[i])
{
rRows.push_back(
- { { Any(), makeAny(mysqlc_sdbc_driver::convert(table_types[i], encoding)) } });
+ { { Any(), Any(mysqlc_sdbc_driver::convert(table_types[i], encoding)) } });
}
}
lcl_setRows_throw(xResultSet, 5, rRows);
@@ -584,17 +584,17 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTypeInfo()
while (mysqlc_types[i].typeName)
{
rRows.push_back(
- { { Any(), makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].typeName, encoding)),
- makeAny(mysqlc_types[i].dataType), makeAny(mysqlc_types[i].precision),
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalPrefix, encoding)),
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalSuffix, encoding)),
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].createParams, encoding)),
- makeAny(mysqlc_types[i].nullable), makeAny(mysqlc_types[i].caseSensitive),
- makeAny(mysqlc_types[i].searchable), makeAny(mysqlc_types[i].isUnsigned),
- makeAny(mysqlc_types[i].fixedPrecScale), makeAny(mysqlc_types[i].autoIncrement),
- makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].localTypeName, encoding)),
- makeAny(mysqlc_types[i].minScale), makeAny(mysqlc_types[i].maxScale),
- makeAny(sal_Int32(0)), makeAny(sal_Int32(0)), makeAny(sal_Int32(10)) } });
+ { { 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)) } });
i++;
}
@@ -622,7 +622,7 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getSchemas()
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");
+ 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();
@@ -635,7 +635,7 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getSchemas()
for (sal_uInt32 i = 1; i <= columns; i++)
{
OUString columnStringValue = xRow->getString(i);
- aRow.push_back(makeAny(columnStringValue));
+ aRow.push_back(Any(columnStringValue));
}
rRows.push_back(aRow);
}
@@ -732,25 +732,25 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getColumns(const Any& /*catalo
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"))
@@ -762,34 +762,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);
@@ -811,20 +811,14 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getTables(const Any& /*catalog
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(")");
}
@@ -928,34 +922,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);
@@ -1016,11 +1010,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("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='?'");
+ 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(
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
index 37a14e822aff..79a514a57898 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
@@ -18,6 +18,8 @@
*/
#include "mysqlc_driver.hxx"
#include "mysqlc_connection.hxx"
+#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/servicehelper.hxx>
using namespace css::uno;
using namespace css::lang;
@@ -26,9 +28,6 @@ using namespace css::sdbc;
using namespace css::sdbcx;
using namespace connectivity::mysqlc;
-#include <cppuhelper/supportsservice.hxx>
-#include <comphelper/servicehelper.hxx>
-
MysqlCDriver::MysqlCDriver(const Reference<XMultiServiceFactory>& _rxFactory)
: ODriver_BASE(m_aMutex)
, m_xFactory(_rxFactory)
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx
index 64fff2e7704b..a29040892577 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx
@@ -21,19 +21,13 @@
#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 <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/compbase2.hxx>
-#include <osl/module.h>
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>
@@ -53,10 +47,6 @@ protected:
OWeakRefArray 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);
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
index 17b118c531a9..bc57770413f5 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>
@@ -192,50 +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("year"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"smallint")
+ || o3tl::equalsIgnoreAsciiCase(sType, u"year"))
return css::sdbc::DataType::SMALLINT;
- if (sType.equalsIgnoreAsciiCase("int") || sType.equalsIgnoreAsciiCase("mediumint"))
+ 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")
- || sType.equalsIgnoreAsciiCase("tinyblob") || sType.equalsIgnoreAsciiCase("mediumblob"))
+ 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("tinytext"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"tinytext"))
return css::sdbc::DataType::VARCHAR;
- if (sType.equalsIgnoreAsciiCase("text"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"text"))
return css::sdbc::DataType::LONGVARCHAR;
- if (sType.equalsIgnoreAsciiCase("mediumtext") || sType.equalsIgnoreAsciiCase("longtext"))
+ 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"))
+ if (o3tl::equalsIgnoreAsciiCase(sType, u"bit"))
return css::sdbc::DataType::BIT;
- if (sType.equalsIgnoreAsciiCase("bool") || sType.equalsIgnoreAsciiCase("boolean"))
+ 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;
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx
index 2a78c7628879..16236e1530ed 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx
@@ -108,7 +108,7 @@ 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);
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx b/connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx
index 3aa2542db9dc..c496f9c21cde 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_indexes.cxx
@@ -9,21 +9,15 @@
#include "mysqlc_indexes.hxx"
-using namespace ::connectivity;
-using namespace ::connectivity::mysqlc;
-
-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)
+connectivity::mysqlc::Indexes::Indexes(Table* pTable, osl::Mutex& rMutex,
+ const std::vector<OUString>& rVector)
: OIndexesHelper(pTable, rMutex, rVector)
-/* , m_pTable(pTable) */ {}
+{
+}
// XDrop
-void Indexes::dropObject(sal_Int32 /*nPosition*/, const OUString& /* sIndexName */)
+void connectivity::mysqlc::Indexes::dropObject(sal_Int32 /*nPosition*/,
+ const OUString& /* sIndexName */)
{
// TODO: implement
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_keys.cxx b/connectivity/source/drivers/mysqlc/mysqlc_keys.cxx
index d5d97f892fc7..7706844f238c 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_keys.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_keys.cxx
@@ -10,19 +10,8 @@
#include "mysqlc_keys.hxx"
#include "mysqlc_table.hxx"
-#include <connectivity/dbtools.hxx>
-
-using namespace ::connectivity;
-using namespace ::connectivity::mysqlc;
-
-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;
-
-Keys::Keys(Table* pTable, Mutex& rMutex, const ::std::vector<OUString>& rNames)
+connectivity::mysqlc::Keys::Keys(Table* pTable, osl::Mutex& rMutex,
+ const ::std::vector<OUString>& rNames)
: OKeysHelper(pTable, rMutex, rNames)
{
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 14fdab939bc7..e11476dc9805 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,11 +46,8 @@ 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)
@@ -183,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_aStatement(css::uno::Reference(cppu::getXWeak(pStmt)))
, m_pStmt(pMyStmt)
, m_encoding(rConn.getConnectionEncoding())
, m_nColumnCount(mysql_stmt_field_count(pMyStmt))
@@ -201,7 +198,7 @@ void OPreparedResultSet::disposing()
MutexGuard aGuard(m_aMutex);
- m_aStatement = nullptr;
+ m_aStatement.clear();
m_xMetaData = nullptr;
}
@@ -1030,21 +1027,16 @@ 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{
+ { { "FetchDirection", PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "IsBookmarkable", PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(),
+ PropertyAttribute::READONLY },
+ { "ResultSetConcurrency", PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY },
+ { "ResultSetType", PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY } }
+ };
}
IPropertyArrayHelper& OPreparedResultSet::getInfoHelper() { return *getArrayHelper(); }
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
index 0be8e2ab347a..40912c5534a7 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx
@@ -41,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,
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
index a50b14bbb3b4..2e7be0894040 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;
@@ -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,
@@ -492,9 +491,10 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 parameter, const Sequence<s
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,
@@ -569,7 +569,7 @@ 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());
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
index d280bd935ae3..e1743d91dbc4 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
@@ -30,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
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx
index 7a11020ea8e0..397ea7cbab64 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);
@@ -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(css::uno::Reference(cppu::getXWeak(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;
}
@@ -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,8 +509,7 @@ 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), ':');
@@ -1007,21 +1009,16 @@ 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{
+ { { "FetchDirection", PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "IsBookmarkable", PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(),
+ PropertyAttribute::READONLY },
+ { "ResultSetConcurrency", PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY },
+ { "ResultSetType", PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(),
+ PropertyAttribute::READONLY } }
+ };
}
IPropertyArrayHelper& OResultSet::getInfoHelper() { return *getArrayHelper(); }
@@ -1097,7 +1094,7 @@ 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());
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx
index 8114cddc9681..3e43853d364e 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx
@@ -40,9 +40,7 @@
namespace connectivity::mysqlc
{
-using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::RuntimeException;
/*
** OResultSet
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
index 6fc531fa943d..21dd0fafc686 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx
@@ -22,10 +22,10 @@
#include <com/sun/star/sdbc/XRow.hpp>
#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)
@@ -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 c2e5db5f3375..aa84ac05586c 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx
@@ -30,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;
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx
index 6e14d9ec60bc..bcb6d3a6cafc 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;
@@ -282,7 +280,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 +295,19 @@ 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{
+ { { "CursorName", PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0 },
+ { "EscapeProcessing", PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0 },
+ { "FetchDirection", PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "MaxFieldSize", PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "MaxRows", PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "QueryTimeOut", PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "ResultSetConcurrency", PROPERTY_ID_RESULTSETCONCURRENCY,
+ cppu::UnoType<sal_Int32>::get(), 0 },
+ { "ResultSetType", PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { "UseBookmarks", PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0 } }
+ };
}
::cppu::IPropertyArrayHelper& OCommonStatement::getInfoHelper() { return *getArrayHelper(); }
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx
index 464051b7239f..c710b0b46a6d 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx
@@ -36,10 +36,8 @@
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;
typedef ::cppu::WeakComponentImplHelper3<css::sdbc::XWarningsSupplier, css::util::XCancellable,
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_table.cxx b/connectivity/source/drivers/mysqlc/mysqlc_table.cxx
index a85618aa3605..eedcb35d6164 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_table.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_table.cxx
@@ -14,29 +14,15 @@
#include <TConnection.hxx>
-#include <sal/log.hxx>
-#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-using namespace ::connectivity;
-using namespace ::connectivity::mysqlc;
-using namespace ::connectivity::sdbcx;
-
-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::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::uno;
-
-Table::Table(Tables* pTables, Mutex& rMutex, const uno::Reference<XConnection>& rConnection)
+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)
@@ -44,9 +30,11 @@ Table::Table(Tables* pTables, Mutex& rMutex, const uno::Reference<XConnection>&
construct();
}
-Table::Table(Tables* pTables, Mutex& rMutex, const uno::Reference<XConnection>& rConnection,
- const OUString& rCatalog, const OUString& rSchema, const OUString& rName,
- const OUString& rType, const OUString& rDescription)
+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)
@@ -54,44 +42,49 @@ Table::Table(Tables* pTables, Mutex& rMutex, const uno::Reference<XConnection>&
construct();
}
-void Table::construct()
+void connectivity::mysqlc::Table::construct()
{
OTableHelper::construct();
if (isNew())
return;
// TODO: get privileges when in non-embedded mode.
- m_nPrivileges = Privilege::DROP | Privilege::REFERENCE | Privilege::ALTER | Privilege::CREATE
- | Privilege::READ | Privilege::DELETE | Privilege::UPDATE | Privilege::INSERT
- | Privilege::SELECT;
+ 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, PropertyAttribute::READONLY, &m_nPrivileges,
- cppu::UnoType<decltype(m_nPrivileges)>::get());
+ PROPERTY_ID_PRIVILEGES, css::beans::PropertyAttribute::READONLY,
+ &m_nPrivileges, cppu::UnoType<decltype(m_nPrivileges)>::get());
}
//----- OTableHelper ---------------------------------------------------------
-OCollection* Table::createColumns(const ::std::vector<OUString>& rNames)
+connectivity::sdbcx::OCollection*
+connectivity::mysqlc::Table::createColumns(const ::std::vector<OUString>& rNames)
{
return new Columns(*this, m_rMutex, rNames);
}
-OCollection* Table::createKeys(const ::std::vector<OUString>& rNames)
+connectivity::sdbcx::OCollection*
+connectivity::mysqlc::Table::createKeys(const ::std::vector<OUString>& rNames)
{
return new Keys(this, m_rMutex, rNames);
}
-OCollection* Table::createIndexes(const ::std::vector<OUString>& rNames)
+connectivity::sdbcx::OCollection*
+connectivity::mysqlc::Table::createIndexes(const ::std::vector<OUString>& rNames)
{
return new Indexes(this, m_rMutex, rNames);
}
//----- XAlterTable -----------------------------------------------------------
-void SAL_CALL Table::alterColumnByName(const OUString& rColName,
- const uno::Reference<XPropertySet>& rDescriptor)
+void SAL_CALL connectivity::mysqlc::Table::alterColumnByName(
+ const OUString& rColName, const css::uno::Reference<XPropertySet>& rDescriptor)
{
- MutexGuard aGuard(m_rMutex);
+ osl::MutexGuard aGuard(m_rMutex);
checkDisposed(WeakComponentImplHelperBase::rBHelper.bDisposed);
- uno::Reference<XPropertySet> xColumn(m_xColumns->getByName(rColName), UNO_QUERY);
+ css::uno::Reference<XPropertySet> xColumn(m_xColumns->getByName(rColName), css::uno::UNO_QUERY);
// sdbcx::Descriptor
const bool bNameChanged
@@ -123,7 +116,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
// precision, otherwise an exception is thrown -- however the base
// gui then offers to delete and recreate the column.
OUStringBuffer sSql(300);
- sSql.append("ALTER TABLE `" + getTableName() + "` MODIFY COLUMN `" + rColName + "` "
+ sSql.append(getAlterTableColumnPart() + " MODIFY COLUMN `" + rColName + "` "
+ ::dbtools::createStandardTypePart(rDescriptor, getConnection()));
if (comphelper::getBOOL(rDescriptor->getPropertyValue("IsAutoIncrement")))
@@ -136,15 +129,13 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
sSql.append(" NOT NULL");
getConnection()->createStatement()->execute(sSql.makeStringAndClear());
- // TODO: could cause errors e.g. if incompatible types, deal with them here as appropriate.
- // possibly we have to wrap things in Util::evaluateStatusVector.
}
if (bNameChanged)
{
OUString sNewColName;
rDescriptor->getPropertyValue("Name") >>= sNewColName;
- OUString sSql("ALTER TABLE `" + getName() + "` RENAME COLUMN `" + rColName + "` TO `"
+ OUString sSql(getAlterTableColumnPart() + " RENAME COLUMN `" + rColName + "` TO `"
+ sNewColName + "`");
getConnection()->createStatement()->execute(sSql);
@@ -153,16 +144,24 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
m_xColumns->refresh();
}
-void SAL_CALL Table::alterColumnByIndex(
+void SAL_CALL connectivity::mysqlc::Table::alterColumnByIndex(
sal_Int32 index, const css::uno::Reference<css::beans::XPropertySet>& descriptor)
{
- MutexGuard aGuard(m_rMutex);
- uno::Reference<XPropertySet> xColumn(m_xColumns->getByIndex(index), UNO_QUERY_THROW);
+ 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 Table::getRenameStart() const { return "RENAME TABLE "; }
+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 "RENAME TABLE "; }
/* 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
index 31cdc055911b..7487f1bc7b34 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_table.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_table.hxx
@@ -9,10 +9,6 @@
#pragma once
-#include <sal/config.h>
-
-#include <string_view>
-
#include "mysqlc_tables.hxx"
#include <connectivity/TTableHelper.hxx>
@@ -62,6 +58,10 @@ public:
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
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_tables.cxx b/connectivity/source/drivers/mysqlc/mysqlc_tables.cxx
index f30c5316036f..81498978d3a5 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_tables.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_tables.cxx
@@ -54,8 +54,8 @@ connectivity::sdbcx::ObjectType connectivity::mysqlc::Tables::createObject(const
css::uno::Any aCatalog;
if (!sCatalog.isEmpty())
{
- aCatalog <<= sCatalog;
lcl_unescape(sCatalog);
+ aCatalog <<= sCatalog;
}
lcl_unescape(sSchema);
@@ -87,63 +87,6 @@ connectivity::sdbcx::ObjectType connectivity::mysqlc::Tables::createObject(const
return xRet;
}
-OUString connectivity::mysqlc::Tables::createStandardColumnPart(
- const css::uno::Reference<css::beans::XPropertySet>& xColProp,
- const css::uno::Reference<css::sdbc::XConnection>& _xConnection)
-{
- css::uno::Reference<css::sdbc::XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
-
- ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
-
- bool bIsAutoIncrement = false;
- 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)))));
-
- // check if the user enter a specific string to create autoincrement values
- OUString sAutoIncrementValue;
- css::uno::Reference<css::beans::XPropertySetInfo> xPropInfo = xColProp->getPropertySetInfo();
-
- 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));
- // 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.
- if (xPropInfo.is() && xPropInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)))
- {
- sal_Int32 aType = 0;
- xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= aType;
- if (aType == css::sdbc::DataType::BINARY || aType == css::sdbc::DataType::VARBINARY)
- {
- aSql.append(" ");
- aSql.append("CHARACTER SET OCTETS");
- }
- }
-
- if (bIsAutoIncrement && !sAutoIncrementValue.isEmpty())
- {
- aSql.append(" ");
- aSql.append(sAutoIncrementValue);
- }
- // AutoIncrement "IDENTITY" is implicitly "NOT NULL"
- else if (::comphelper::getINT32(
- xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISNULLABLE)))
- == css::sdbc::ColumnValue::NO_NULLS)
- aSql.append(" NOT NULL");
-
- return aSql.makeStringAndClear();
-}
-
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
@@ -153,28 +96,48 @@ css::uno::Reference<css::beans::XPropertySet> connectivity::mysqlc::Tables::crea
}
//----- XAppend ---------------------------------------------------------------
-connectivity::sdbcx::ObjectType connectivity::mysqlc::Tables::appendObject(
- const OUString& /* rName */, const css::uno::Reference<css::beans::XPropertySet>& rDescriptor)
+void connectivity::mysqlc::Tables::createTable(
+ const css::uno::Reference<css::beans::XPropertySet>& descriptor)
{
- OUString sSql(
- ::dbtools::createSqlCreateTableStatement(rDescriptor, m_xMetaData->getConnection()));
- OUString sCatalog, sSchema, sComposedName, sTable;
- const css::uno::Reference<css::sdbc::XConnection>& xConnection = m_xMetaData->getConnection();
+ const css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
+ OUString aSql = ::dbtools::createSqlCreateTableStatement(descriptor, xConnection);
- ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
-
- rDescriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)) >>= sCatalog;
- rDescriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema;
- rDescriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= sTable;
+ css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
+ if (xStmt.is())
+ {
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
+ }
+}
- sComposedName = ::dbtools::composeTableName(m_xMetaData, sCatalog, sSchema, sTable, true,
- ::dbtools::EComposeRule::InTableDefinitions);
- if (sComposedName.isEmpty())
- ::dbtools::throwFunctionSequenceException(xConnection);
+// XAppend
+connectivity::sdbcx::ObjectType connectivity::mysqlc::Tables::appendObject(
+ const OUString& _rForName, const css::uno::Reference<css::beans::XPropertySet>& descriptor)
+{
+ createTable(descriptor);
+ return createObject(_rForName);
+}
- m_xMetaData->getConnection()->createStatement()->execute(sSql);
+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);
+}
- return createObject(sComposedName);
+OUString
+connectivity::mysqlc::Tables::getNameForObject(const connectivity::sdbcx::ObjectType& _xObject)
+{
+ OSL_ENSURE(_xObject.is(), "OTables::getNameForObject: Object is NULL!");
+ return ::dbtools::composeTableName(m_xMetaData, _xObject,
+ ::dbtools::EComposeRule::InDataManipulation, false)
+ .replaceAll(u"`", u"Ì€ `");
}
//----- XDrop -----------------------------------------------------------------
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_tables.hxx b/connectivity/source/drivers/mysqlc/mysqlc_tables.hxx
index a49138be31bf..8b05c5afaf9f 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_tables.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_tables.hxx
@@ -9,10 +9,10 @@
#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::mysqlc
{
@@ -25,10 +25,6 @@ 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;
@@ -37,20 +33,23 @@ protected:
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 sdbcx::ObjectType& _xObject) override;
+ // XDrop
+ virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override;
+
public:
- Tables(const css::uno::Reference<css::sdbc::XDatabaseMetaData>& rMetaData,
+ 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(rMetaData)
+ , m_xMetaData(std::move(xMetaData))
{
}
+ void appendNew(const OUString& _rsNewTable);
// TODO: should we also implement XDataDescriptorFactory, XRefreshable,
// XAppend, etc. ?
-
- // XDrop
- virtual void dropObject(sal_Int32 nPosition, const OUString& rName) override;
};
} // namespace connectivity::mysqlc
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_user.cxx b/connectivity/source/drivers/mysqlc/mysqlc_user.cxx
index 65470be59b86..6e8c3d734a67 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_user.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_user.cxx
@@ -7,7 +7,15 @@
* 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;
@@ -15,35 +23,183 @@ using namespace ::connectivity::sdbcx;
using namespace ::com::sun::star;
using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
-User::User(const css::uno::Reference<css::sdbc::XConnection>& rConnection)
+User::User(css::uno::Reference<css::sdbc::XConnection> xConnection)
: OUser(true) // Case Sensitive
- , m_xConnection(rConnection)
+ , m_xConnection(std::move(xConnection))
{
}
-User::User(const css::uno::Reference<css::sdbc::XConnection>& rConnection, const OUString& rName)
+User::User(css::uno::Reference<css::sdbc::XConnection> xConnection, const OUString& rName)
: OUser(rName,
true) // Case Sensitive
- , m_xConnection(rConnection)
+ , m_xConnection(std::move(xConnection))
{
}
-void User::changePassword(const OUString&, const OUString& /* newPassword */)
+OUserExtend::OUserExtend(const css::uno::Reference<css::sdbc::XConnection>& xConnection,
+ const OUString& rName)
+ : User(xConnection, rName)
{
- // TODO: implement
+ construct();
}
-sal_Int32 User::getPrivileges(const OUString&, sal_Int32)
+void OUserExtend::construct()
{
- // TODO: implement.
- return 0;
+ 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());
}
-sal_Int32 User::getGrantablePrivileges(const OUString&, sal_Int32)
+void User::changePassword(const OUString& /* oldPassword */, const OUString& newPassword)
{
- // TODO: implement.
- return 0;
+ 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, "%");
+ }
+ 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 ----------------------------------------------------
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_user.hxx b/connectivity/source/drivers/mysqlc/mysqlc_user.hxx
index e9e37e3fac47..6bebbaa64a11 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_user.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_user.hxx
@@ -25,21 +25,47 @@ public:
/**
* Create a "new" descriptor, which isn't yet in the database.
*/
- User(const css::uno::Reference<css::sdbc::XConnection>& rConnection);
+ User(css::uno::Reference<css::sdbc::XConnection> xConnection);
/**
* For a user that already exists in the db.
*/
- User(const css::uno::Reference<css::sdbc::XConnection>& rConnection, const OUString& rName);
+ 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
index 41fce5c395cd..296377c1be94 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_users.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_users.cxx
@@ -7,8 +7,13 @@
* 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;
@@ -17,8 +22,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;
@@ -37,7 +40,7 @@ void Users::impl_refresh()
ObjectType Users::createObject(const OUString& rName)
{
- return new User(m_xMetaData->getConnection(), rName);
+ return new OUserExtend(m_xMetaData->getConnection(), rName);
}
uno::Reference<XPropertySet> Users::createDescriptor()
@@ -45,26 +48,45 @@ 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 User(m_xMetaData->getConnection());
+ return new OUserExtend(m_xMetaData->getConnection(), "");
}
//----- XAppend ---------------------------------------------------------------
-ObjectType Users::appendObject(const OUString& rName, const uno::Reference<XPropertySet>&)
+ObjectType Users::appendObject(const OUString& rName,
+ const uno::Reference<XPropertySet>& descriptor)
{
- // TODO: set sSql as appropriate
- m_xMetaData->getConnection()->createStatement()->execute(OUString());
+ OUString aSql("GRANT USAGE ON * TO ");
+ 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&)
+void Users::dropObject(sal_Int32 nPosition, const OUString& rName)
{
uno::Reference<XPropertySet> xUser(getObject(nPosition));
if (!ODescriptor::isNew(xUser))
{
- // TODO: drop me
+ Reference<XStatement> statement = m_xMetaData->getConnection()->createStatement();
+ if (statement.is())
+ {
+ statement->execute("DROP USER " + rName);
+ ::comphelper::disposeComponent(statement);
+ }
}
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_users.hxx b/connectivity/source/drivers/mysqlc/mysqlc_users.hxx
index 15b5cf6b43f7..d4c4d3558e42 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_users.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_users.hxx
@@ -14,9 +14,6 @@
namespace connectivity::mysqlc
{
-/**
-* This implements com.sun.star.sdbcx.Container.
-*/
class Users : public ::connectivity::sdbcx::OCollection
{
css::uno::Reference<css::sdbc::XDatabaseMetaData> m_xMetaData;
@@ -41,7 +38,6 @@ public:
// 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
index a586e20a9a13..86837381d2bc 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_view.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_view.cxx
@@ -21,26 +21,11 @@
#include <propertyids.hxx>
-#include <com/sun/star/lang/WrappedTargetException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/SQLException.hpp>
namespace connectivity::mysqlc
{
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::sdbc::SQLException;
-using ::com::sun::star::sdbc::XConnection;
-using ::com::sun::star::lang::WrappedTargetException;
-using ::com::sun::star::sdbc::XResultSet;
-using ::com::sun::star::sdbc::XStatement;
-using ::com::sun::star::lang::DisposedException;
-using ::com::sun::star::sdbc::XRow;
-
-View::View(const Reference<XConnection>& _rxConnection, bool _bCaseSensitive,
+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())
@@ -76,7 +61,7 @@ void SAL_CALL View::alterCommand(const OUString& _rNewCommand)
m_xMetaData->getConnection()->createStatement()->execute(aCommand);
}
-void SAL_CALL View::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
+void SAL_CALL View::getFastPropertyValue(css::uno::Any& _rValue, sal_Int32 _nHandle) const
{
if (_nHandle == PROPERTY_ID_COMMAND)
{
@@ -94,7 +79,7 @@ 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 );
- Reference<XResultSet> xResult(
+ css::uno::Reference<css::sdbc::XResultSet> xResult(
m_xMetaData->getConnection()->createStatement()->executeQuery(aCommand),
css::uno::UNO_SET_THROW);
if (!xResult->next())
@@ -104,7 +89,7 @@ OUString View::impl_getCommand() const
std::abort();
}
- Reference<XRow> xRow(xResult, UNO_QUERY_THROW);
+ css::uno::Reference<css::sdbc::XRow> xRow(xResult, css::uno::UNO_QUERY_THROW);
return xRow->getString(1);
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_views.cxx b/connectivity/source/drivers/mysqlc/mysqlc_views.cxx
index 5db17db83c85..1c79c9225d44 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_views.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_views.cxx
@@ -25,29 +25,16 @@
#include <comphelper/types.hxx>
#include <TConnection.hxx>
-using namespace ::comphelper;
-
-using namespace ::cppu;
-using namespace connectivity;
-using namespace connectivity::mysqlc;
-using namespace css::uno;
-using namespace css::beans;
-using namespace css::sdbcx;
-using namespace css::sdbc;
-using namespace css::container;
-using namespace css::lang;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-Views::Views(const Reference<XConnection>& _rxConnection, ::cppu::OWeakObject& _rParent,
- ::osl::Mutex& _rMutex, const ::std::vector<OUString>& _rVector)
+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())
- , m_bInDrop(false)
{
}
-sdbcx::ObjectType Views::createObject(const OUString& _rName)
+connectivity::sdbcx::ObjectType connectivity::mysqlc::Views::createObject(const OUString& _rName)
{
OUString sCatalog, sSchema, sTable;
::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable,
@@ -55,60 +42,48 @@ sdbcx::ObjectType Views::createObject(const OUString& _rName)
return new View(m_xConnection, isCaseSensitive(), sSchema, sTable);
}
-void Views::impl_refresh() { static_cast<Catalog&>(m_rParent).refreshViews(); }
-
-void Views::disposing()
+void connectivity::mysqlc::Views::impl_refresh()
{
- m_xMetaData.clear();
- OCollection::disposing();
+ static_cast<Catalog&>(m_rParent).refreshViews();
}
-Reference<XPropertySet> Views::createDescriptor()
+css::uno::Reference<css::beans::XPropertySet> connectivity::mysqlc::Views::createDescriptor()
{
return new connectivity::sdbcx::OView(true, m_xMetaData);
}
// XAppend
-sdbcx::ObjectType Views::appendObject(const OUString& _rForName,
- const Reference<XPropertySet>& descriptor)
+connectivity::sdbcx::ObjectType connectivity::mysqlc::Views::appendObject(
+ const OUString& _rForName, const css::uno::Reference<css::beans::XPropertySet>& descriptor)
{
createView(descriptor);
return createObject(_rForName);
}
// XDrop
-void Views::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
+void connectivity::mysqlc::Views::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
{
- if (m_bInDrop)
- return;
-
- Reference<XInterface> xObject(getObject(_nPos));
+ css::uno::Reference<XInterface> xObject(getObject(_nPos));
bool bIsNew = connectivity::sdbcx::ODescriptor::isNew(xObject);
if (!bIsNew)
{
OUString aSql("DROP VIEW");
- Reference<XPropertySet> xProp(xObject, UNO_QUERY);
+ css::uno::Reference<css::beans::XPropertySet> xProp(xObject, css::uno::UNO_QUERY);
aSql += ::dbtools::composeTableName(m_xMetaData, xProp,
::dbtools::EComposeRule::InTableDefinitions, true);
- Reference<XConnection> xConnection = m_xMetaData->getConnection();
- Reference<XStatement> xStmt = xConnection->createStatement();
+ 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 Views::dropByNameImpl(const OUString& elementName)
-{
- m_bInDrop = true;
- OCollection_TYPE::dropByName(elementName);
- m_bInDrop = false;
-}
-
-void Views::createView(const Reference<XPropertySet>& descriptor)
+void connectivity::mysqlc::Views::createView(
+ const css::uno::Reference<css::beans::XPropertySet>& descriptor)
{
- Reference<XConnection> xConnection = m_xMetaData->getConnection();
+ css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
OUString sCommand;
descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))
@@ -119,21 +94,20 @@ void Views::createView(const Reference<XPropertySet>& descriptor)
::dbtools::EComposeRule::InTableDefinitions, true)
+ " AS " + sCommand;
- Reference<XStatement> xStmt = xConnection->createStatement();
+ css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
if (xStmt.is())
{
xStmt->execute(aSql);
::comphelper::disposeComponent(xStmt);
}
- /* TODO find a way to refresh view to make the new one appear right away
- // insert the new view also in the tables collection
- Tables* pTables = static_cast<Tables*>(static_cast<Catalog&>(m_rParent).getPrivateTables());
- if ( pTables)
+ 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 );
+ 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
index 708e1b24eec5..14570fc8d9a9 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_views.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_views.hxx
@@ -22,19 +22,18 @@
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
namespace connectivity::mysqlc
{
-class Views final : public sdbcx::OCollection
+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;
- virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ // OCollection
+ virtual connectivity::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;
void createView(const css::uno::Reference<css::beans::XPropertySet>& descriptor);
@@ -43,10 +42,8 @@ public:
::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::std::vector<OUString>& _rVector);
- // only the name is identical to ::cppu::OComponentHelper
- virtual void disposing() override;
-
- void dropByNameImpl(const OUString& elementName);
+ // XDrop
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
};
}
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx
index 7ae8c46802e2..b483165212b4 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;
@@ -98,7 +97,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTi
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);
+ N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(nTimeOut)),SQL_IS_UINTEGER);
#else
(void)nTimeOut; /* WaE */
#endif
@@ -312,10 +311,10 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
+ const sal_IntPtr nAutocommit = autoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF;
OTools::ThrowException(this,N3SQLSetConnectAttr(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);
}
@@ -423,7 +422,7 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level )
OTools::ThrowException(this,N3SQLSetConnectAttr(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);
}
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
index 957142027182..bd721d60a617 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)
@@ -1241,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 &)
{
@@ -1277,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 ae6eeb4fddeb..5fbe8bf8f460 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
@@ -47,7 +47,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 +83,7 @@ void ODatabaseMetaDataResultSet::disposing()
m_pConnection->freeStatementHandle(m_aStatementHandle);
- m_aStatement = nullptr;
+ m_aStatement.clear();
m_xMetaData.clear();
m_pConnection.clear();
}
@@ -698,21 +697,41 @@ OUString ODatabaseMetaDataResultSet::getCursorName()
::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()
diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx
index df7b3fd206b8..cf3c5596aad4 100644
--- a/connectivity/source/drivers/odbc/ODriver.cxx
+++ b/connectivity/source/drivers/odbc/ODriver.cxx
@@ -24,6 +24,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <strings.hrc>
#include <resource/sharedresources.hxx>
+#include <utility>
using namespace connectivity::odbc;
using namespace com::sun::star::uno;
@@ -31,9 +32,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_xContext(std::move(_xContext))
,m_pDriverHandle(SQL_NULL_HANDLE)
{
}
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index 507a52d872a2..21baa12e45c1 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -40,9 +40,7 @@ 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;
@@ -909,7 +907,7 @@ void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
));
SQLException aNext(sError,*this, OUString(),0,Any());
- ::dbtools::throwInvalidIndexException(*this,makeAny(aNext));
+ ::dbtools::throwInvalidIndexException(*this,Any(aNext));
}
}
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index b38d81b3a4eb..9e68cd1763c2 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -891,7 +891,7 @@ void SAL_CALL OResultSet::insertRow( )
if(m_pSkipDeletedSet)
{
- if(moveToBookmark(makeAny(aBookmark)))
+ if(moveToBookmark(Any(aBookmark)))
{
sal_Int32 nRowPos = getDriverPos();
if ( -1 == m_nRowPos )
@@ -1403,28 +1403,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()
@@ -1667,7 +1686,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;
diff --git a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx
index 21b95c6a7b29..f71e77d19c81 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;
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx
index d44f86e58469..d8b5d6ce75de 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 )
@@ -477,8 +475,8 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( )
for (auto const& elem : m_aBatchVector)
{
- aBatchSql.append(OUStringToOString(elem,getOwnConnection()->getTextEncoding()));
- aBatchSql.append(";");
+ aBatchSql.append(OUStringToOString(elem,getOwnConnection()->getTextEncoding())
+ + ";");
}
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
@@ -615,7 +613,7 @@ Any SAL_CALL OStatement_Base::getWarnings( )
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return makeAny(m_aLastWarning);
+ return Any(m_aLastWarning);
}
@@ -859,31 +857,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
+ }
+ }
+ };
}
diff --git a/connectivity/source/drivers/postgresql/pq_array.hxx b/connectivity/source/drivers/postgresql/pq_array.hxx
index b847d646a913..589fe063d234 100644
--- a/connectivity/source/drivers/postgresql/pq_array.hxx
+++ b/connectivity/source/drivers/postgresql/pq_array.hxx
@@ -39,6 +39,7 @@
#include <com/sun/star/sdbc/XArray.hpp>
#include "pq_connection.hxx"
+#include <utility>
#include <vector>
namespace pq_sdbc_driver
@@ -53,14 +54,14 @@ class Array : public cppu::WeakImplHelper< css::sdbc::XArray >
public:
Array(
- const rtl::Reference< comphelper::RefCountedMutex > & mutex,
+ rtl::Reference< comphelper::RefCountedMutex > mutex,
std::vector< css::uno::Any > && data,
- const css::uno::Reference< css::uno::XInterface > & owner,
- const css::uno::Reference< css::script::XTypeConverter > &tc) :
+ css::uno::Reference< css::uno::XInterface > owner,
+ css::uno::Reference< css::script::XTypeConverter > tc) :
m_data( std::move(data) ),
- m_owner( owner ),
- m_tc( tc ),
- m_xMutex( mutex )
+ m_owner(std::move( owner )),
+ m_tc(std::move( tc )),
+ m_xMutex(std::move( mutex ))
{}
public: // XArray
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 6661a97d5669..091479f87f95 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>
@@ -96,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 ))
{
}
@@ -115,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 )
{
}
@@ -330,7 +331,15 @@ class cstr_vector
std::vector<char*> values;
std::vector<bool> acquired;
public:
+#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");
diff --git a/connectivity/source/drivers/postgresql/pq_connection.hxx b/connectivity/source/drivers/postgresql/pq_connection.hxx
index f30483f70938..2bba070a7273 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.hxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.hxx
@@ -134,7 +134,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;
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index c3280e07bf15..1fbcb1aa69f5 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -84,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;
@@ -114,12 +115,12 @@ 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_origin(std::move( origin )),
m_getIntSetting_stmt ( m_origin->prepareStatement("SELECT setting FROM pg_catalog.pg_settings WHERE name=?") )
{
init_getReferences_stmt();
@@ -210,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;
}
@@ -310,8 +311,8 @@ OUString DatabaseMetaData::getSQLKeywords( )
}
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???
@@ -1185,30 +1186,30 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTables(
namespace
{
// sort no schema first, then "public", then normal schemas, then internal schemas
- int compare_schema(const OUString &nsA, std::u16string_view nsB)
+ int compare_schema(std::u16string_view nsA, std::u16string_view nsB)
{
- if (nsA.isEmpty())
+ if (nsA.empty())
{
return nsB.empty() ? 0 : -1;
}
else if (nsB.empty())
{
- assert(!nsA.isEmpty());
+ assert(!nsA.empty());
return 1;
}
- else if(nsA == "public")
+ else if(nsA == u"public")
{
return (nsB == u"public") ? 0 : -1;
}
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(o3tl::starts_with(nsB, u"pg_"))
- return nsA.compareTo(nsB);
+ return nsA.compare(nsB);
else
return 1;
}
@@ -1218,7 +1219,7 @@ namespace
}
else
{
- return nsA.compareTo(nsB);
+ return nsA.compare(nsB);
}
}
@@ -1364,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 ),
@@ -1405,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 ++;
}
}
@@ -2086,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;
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
index 134f72cf0186..4e8b717a96b2 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
@@ -74,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
);
diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx
index 09fe61ab2824..8e07123a2b0f 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;
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 c2907aeb0290..44e7dc9bcf13 100644
--- a/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx
@@ -61,7 +61,7 @@ public:
PGresult *result,
const OUString &schema,
const OUString &table,
- const OUString &aReason );
+ OUString aReason );
public: // XInterface
virtual void SAL_CALL acquire() noexcept override { ResultSet::acquire(); }
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index d7a73289b077..e616e9b22966 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -40,6 +40,7 @@
#include "pq_statics.hxx"
#include "pq_statement.hxx"
+#include <o3tl/safeint.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -56,6 +57,7 @@
#include <string_view>
#include <connectivity/dbconversion.hxx>
+#include <utility>
using osl::MutexGuard;
@@ -148,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)
@@ -197,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 "
@@ -261,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();
@@ -389,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(
@@ -398,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;
}
@@ -408,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 )
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx
index 4755efbe0368..ed81420cec7d 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx
@@ -98,7 +98,7 @@ 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
diff --git a/connectivity/source/drivers/postgresql/pq_resultset.cxx b/connectivity/source/drivers/postgresql/pq_resultset.cxx
index 556bae92d5be..0058041c87b5 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;
@@ -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?
diff --git a/connectivity/source/drivers/postgresql/pq_resultset.hxx b/connectivity/source/drivers/postgresql/pq_resultset.hxx
index 340e34b70c3b..cf2888bf5b93 100644
--- a/connectivity/source/drivers/postgresql/pq_resultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_resultset.hxx
@@ -72,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
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 67e34d44d257..71c98190ba2b 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
@@ -89,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
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 7db4b20536e2..648faa69811b 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -59,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>
@@ -252,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() );
@@ -429,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,
@@ -441,7 +442,7 @@ 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(
@@ -589,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;
@@ -598,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 " );
@@ -606,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;
@@ -699,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 fae6568bb505..816d2a55afaa 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.hxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.hxx
@@ -189,7 +189,7 @@ 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 );
diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx
index 3ae01b8b267c..f69556202240 100644
--- a/connectivity/source/drivers/postgresql/pq_statics.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statics.cxx
@@ -37,6 +37,7 @@
#include "pq_statics.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;
@@ -68,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;
};
@@ -196,7 +197,7 @@ 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";
@@ -210,7 +211,7 @@ 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";
@@ -232,7 +233,7 @@ 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";
@@ -255,7 +256,7 @@ 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";
@@ -271,7 +272,7 @@ 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
@@ -287,7 +288,7 @@ 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
@@ -310,7 +311,7 @@ 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 =
@@ -323,7 +324,7 @@ Statics & getStatics()
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";
@@ -337,13 +338,13 @@ 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 = { "com.sun.star.sdbcx.ViewDescriptor" };
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 = { "com.sun.star.sdbcx.User" };
@@ -352,7 +353,7 @@ Statics & getStatics()
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 =
@@ -364,7 +365,7 @@ Statics & getStatics()
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";
@@ -379,14 +380,14 @@ 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 = { "com.sun.star.sdbcx.IndexDescriptor" };
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";
@@ -408,7 +409,7 @@ 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 =
@@ -421,7 +422,7 @@ Statics & getStatics()
PropertyDef( statics.NAME , tString )
};
statics.refl.indexColumnDescriptor.pProps = createPropertyArrayHelper(
- indexColumnDescDef, SAL_N_ELEMENTS(indexColumnDescDef), 0 );
+ indexColumnDescDef, std::size(indexColumnDescDef), 0 );
// databasemetadata
statics.tablesRowNames = std::vector< OUString > ( 5 );
diff --git a/connectivity/source/drivers/postgresql/pq_statics.hxx b/connectivity/source/drivers/postgresql/pq_statics.hxx
index b5a868d6c691..4e745e4086ee 100644
--- a/connectivity/source/drivers/postgresql/pq_statics.hxx
+++ b/connectivity/source/drivers/postgresql/pq_statics.hxx
@@ -37,6 +37,7 @@
#pragma once
#include <unordered_map>
+#include <utility>
#include <vector>
#include <com/sun/star/uno/Any.hxx>
@@ -50,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 ),
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 9b75d69ba46c..fb42f864f97e 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;
@@ -125,7 +125,7 @@ void bufferEscapeConstant( OUStringBuffer & buf, std::u16string_view value, Conn
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 )
@@ -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 ) )
{
@@ -840,17 +840,17 @@ OUString getColExprForDefaultSettingVal(ConnectionSettings const *settings)
OUString("pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid, true)");
}
-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;
@@ -943,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 1f9356ed41d3..c5f9174111ca 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.hxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.hxx
@@ -106,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);
@@ -115,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 );
@@ -131,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 );
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index 5c1b23e82175..49eb65cd9fbf 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -296,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;
@@ -342,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() );
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
index 1beeadc31e98..52cb513a5856 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
@@ -44,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
{
@@ -78,13 +79,13 @@ private:
std::vector< OUString >&& colNames,
std::vector< std::vector< css::uno::Any > >&& data,
ConnectionSettings **ppSettings,
- const OUString &schema,
- const OUString &table,
+ 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_schema(std::move( schema )),
+ m_table(std::move( table )),
m_primaryKey( std::move(primaryKey) ),
m_insertRow( false )
{
diff --git a/connectivity/source/drivers/postgresql/pq_xbase.cxx b/connectivity/source/drivers/postgresql/pq_xbase.cxx
index 5dbe6e98b5ab..001046aa52fa 100644
--- a/connectivity/source/drivers/postgresql/pq_xbase.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xbase.cxx
@@ -36,6 +36,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
+#include <utility>
#include "pq_statics.hxx"
#include "pq_tools.hxx"
@@ -56,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() )
diff --git a/connectivity/source/drivers/postgresql/pq_xbase.hxx b/connectivity/source/drivers/postgresql/pq_xbase.hxx
index 3cd16bc70ee2..e4ca16fd5e6a 100644
--- a/connectivity/source/drivers/postgresql/pq_xbase.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xbase.hxx
@@ -65,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 !*/ );
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index 82d595628db3..2902879c49b0 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -38,6 +38,7 @@
#include <string_view>
+#include <o3tl/safeint.hxx>
#include <o3tl/string_view.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
@@ -49,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"
@@ -61,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;
@@ -75,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 )
@@ -109,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)
+ OUString schemaName,
+ OUString tableName)
: Container( refMutex, origin, pSettings, "COLUMN" ),
- m_schemaName( schemaName ),
- m_tableName( tableName )
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName ))
{}
Columns::~Columns()
@@ -185,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 ) ) );
@@ -213,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
@@ -316,7 +317,7 @@ void Columns::refresh()
// name ) );
{
- m_values.push_back( makeAny( prop ) );
+ m_values.emplace_back(prop);
map[ name ] = columnIndex;
++columnIndex;
}
@@ -405,11 +406,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() );
}
@@ -461,7 +461,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 );
@@ -493,7 +493,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 "
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx
index aa91a9754218..8ff8fcfbd95c 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx
@@ -80,8 +80,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 ~Columns() override;
diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
index d2bcf941a68d..131148c3e192 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,7 +158,7 @@ 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 ];
}
@@ -189,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 )
@@ -299,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 "
@@ -350,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(
@@ -391,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 fd9d432bfad3..4b6c190b0a59 100644
--- a/connectivity/source/drivers/postgresql/pq_xcontainer.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xcontainer.hxx
@@ -117,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
diff --git a/connectivity/source/drivers/postgresql/pq_xindex.cxx b/connectivity/source/drivers/postgresql/pq_xindex.cxx
index 5a96eeeb119d..4753b5fd4e3c 100644
--- a/connectivity/source/drivers/postgresql/pq_xindex.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindex.cxx
@@ -37,6 +37,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <rtl/ref.hxx>
+#include <utility>
#include "pq_xindex.hxx"
#include "pq_xindexcolumns.hxx"
@@ -58,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,
@@ -67,8 +68,8 @@ 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( )
diff --git a/connectivity/source/drivers/postgresql/pq_xindex.hxx b/connectivity/source/drivers/postgresql/pq_xindex.hxx
index 46275ad3aafa..8ccf45660467 100644
--- a/connectivity/source/drivers/postgresql/pq_xindex.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xindex.hxx
@@ -61,8 +61,8 @@ 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() noexcept override { ReflectionBase::acquire(); }
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
index 1e0039ecc6e1..2bca00e13b77 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
@@ -37,6 +37,7 @@
#include <sal/log.hxx>
#include <string_view>
+#include <utility>
#include <vector>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -56,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;
@@ -73,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 ),
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName )),
+ m_indexName(std::move( indexName )),
m_columns( columns )
{}
@@ -131,7 +131,7 @@ void IndexColumns::refresh()
columnMetaData2SDBCX( pIndexColumn.get(), xRow );
pIndexColumn->setPropertyValue_NoBroadcast_public(
- st.IS_ASCENDING , makeAny( false ) );
+ st.IS_ASCENDING , Any( false ) );
m_values[ index ] <<= prop;
m_name2index[ columnName ] = index;
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx b/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx
index eaaa709e671a..a838d5d66908 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx
@@ -63,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;
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index 332a9a9e5311..bff96216c568 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -43,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"
@@ -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;
@@ -78,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 ))
{
}
@@ -149,7 +150,7 @@ 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());
@@ -160,10 +161,10 @@ void Indexes::refresh()
}
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(prop);
map[ currentIndexName ] = index;
++index;
}
@@ -235,7 +236,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 "
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.hxx b/connectivity/source/drivers/postgresql/pq_xindexes.hxx
index c2e81f61751f..536d17b96198 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.hxx
@@ -58,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;
diff --git a/connectivity/source/drivers/postgresql/pq_xkey.cxx b/connectivity/source/drivers/postgresql/pq_xkey.cxx
index e2777824568f..81d1f7a86eb6 100644
--- a/connectivity/source/drivers/postgresql/pq_xkey.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkey.cxx
@@ -37,6 +37,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <rtl/ref.hxx>
+#include <utility>
#include "pq_xkey.hxx"
#include "pq_xkeycolumns.hxx"
@@ -57,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,
@@ -66,8 +67,8 @@ 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( )
diff --git a/connectivity/source/drivers/postgresql/pq_xkey.hxx b/connectivity/source/drivers/postgresql/pq_xkey.hxx
index d231e1e89945..68f05fd27d4e 100644
--- a/connectivity/source/drivers/postgresql/pq_xkey.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xkey.hxx
@@ -61,8 +61,8 @@ 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() noexcept override { ReflectionBase::acquire(); }
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
index 6dcbe07d4117..89f63ceb5a65 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
@@ -40,6 +40,7 @@
#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"
@@ -52,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;
@@ -69,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 ),
+ m_schemaName(std::move( schemaName )),
+ m_tableName(std::move( tableName )),
m_columnNames( columnNames ),
m_foreignColumnNames( foreignColumnNames )
{}
@@ -126,11 +126,11 @@ void KeyColumns::refresh()
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(prop);
map[ name ] = columnIndex;
++columnIndex;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx b/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx
index 0c56fd189e9a..60bbd0c0de36 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx
@@ -63,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);
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
index 84507202fa9a..0758be630e04 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
@@ -49,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"
@@ -60,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;
@@ -78,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()
@@ -156,16 +158,16 @@ void Keys::refresh()
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 ) ) ) ) );
@@ -174,13 +176,13 @@ void Keys::refresh()
{
OUString buf = xRow->getString( 6 ) + "." + xRow->getString( 5 );
pKey->setPropertyValue_NoBroadcast_public(
- st.REFERENCED_TABLE, makeAny( buf ) );
+ 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 +191,7 @@ void Keys::refresh()
{
map[ xRow->getString( 1 ) ] = keyIndex;
- m_values.push_back( makeAny( prop ) );
+ m_values.push_back( Any( prop ) );
++keyIndex;
}
}
@@ -226,7 +228,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)
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.hxx b/connectivity/source/drivers/postgresql/pq_xkeys.hxx
index fe1afef35a4b..ef6376d4d780 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.hxx
@@ -58,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;
diff --git a/connectivity/source/drivers/postgresql/pq_xtable.cxx b/connectivity/source/drivers/postgresql/pq_xtable.cxx
index 9ac52f1df0ff..de8196f9fecd 100644
--- a/connectivity/source/drivers/postgresql/pq_xtable.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtable.cxx
@@ -60,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;
@@ -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() )
{
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 47606669dd40..423ec81f2166 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -43,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"
@@ -55,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;
@@ -111,16 +111,16 @@ void Tables::refresh()
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 |
@@ -131,7 +131,7 @@ void Tables::refresh()
css::sdbcx::Privilege::DROP ) ) );
{
- m_values.push_back( makeAny( prop ) );
+ m_values.push_back( Any( prop ) );
map[ schema + "." + name ] = tableIndex;
++tableIndex;
}
@@ -311,7 +311,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)
diff --git a/connectivity/source/drivers/postgresql/pq_xusers.cxx b/connectivity/source/drivers/postgresql/pq_xusers.cxx
index bc8b62b1d5b4..08cdf2d1c135 100644
--- a/connectivity/source/drivers/postgresql/pq_xusers.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xusers.cxx
@@ -41,6 +41,7 @@
#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"
@@ -51,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;
@@ -98,10 +99,10 @@ void Users::refresh()
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( prop ) );
map[ name ] = tableIndex;
++tableIndex;
}
@@ -151,7 +152,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 "
diff --git a/connectivity/source/drivers/postgresql/pq_xview.cxx b/connectivity/source/drivers/postgresql/pq_xview.cxx
index 3652cdee634f..c2e936e9a314 100644
--- a/connectivity/source/drivers/postgresql/pq_xview.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xview.cxx
@@ -52,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;
@@ -121,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;
}
@@ -142,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 !
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index d71219fa6420..1f5b6c4fa52c 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -41,6 +41,7 @@
#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"
@@ -52,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;
@@ -110,12 +111,12 @@ void Views::refresh()
rtl::Reference<View> pView = new View (m_xMutex, m_origin, m_pSettings );
Reference< css::beans::XPropertySet > prop = pView;
- 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( prop ) );
map[ schema + "." + table ] = viewIndex;
++viewIndex;
}
@@ -175,7 +176,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)
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx
index 385692951518..c9900a4e5544 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);
{
@@ -214,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;
}
@@ -227,7 +226,7 @@ uno::Reference<sdbc::XPreparedStatement>
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;
}
diff --git a/connectivity/source/drivers/writer/WDatabaseMetaData.cxx b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
index f944d86a7fa9..1eed92ddcf07 100644
--- a/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
@@ -93,11 +93,12 @@ uno::Reference<sdbc::XResultSet> SAL_CALL OWriterDatabaseMetaData::getTables(
const OUString& rName = aTableNames[nTable];
if (match(tableNamePattern, rName, '\0'))
{
- ODatabaseMetaDataResultSet::ORow aRow{ nullptr, nullptr, nullptr };
- aRow.reserve(6);
- aRow.push_back(new ORowSetValueDecorator(rName));
- 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);
}
}
diff --git a/connectivity/source/drivers/writer/WDriver.cxx b/connectivity/source/drivers/writer/WDriver.cxx
index fa3a3dcf685a..bbd0f71838c1 100644
--- a/connectivity/source/drivers/writer/WDriver.cxx
+++ b/connectivity/source/drivers/writer/WDriver.cxx
@@ -38,17 +38,14 @@ 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>
@@ -63,7 +60,7 @@ uno::Reference<sdbc::XConnection>
rtl::Reference<OWriterConnection> pCon = new OWriterConnection(this);
pCon->construct(url, info);
- m_xConnections.push_back(uno::WeakReferenceHelper(*pCon));
+ m_xConnections.emplace_back(*pCon);
return pCon;
}
diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx
index 2f76fc4a09d0..2f0f44855d86 100644
--- a/connectivity/source/drivers/writer/WTable.cxx
+++ b/connectivity/source/drivers/writer/WTable.cxx
@@ -30,7 +30,6 @@
#include <writer/WConnection.hxx>
#include <connectivity/sdbcx/VColumn.hxx>
#include <sal/log.hxx>
-#include <comphelper/servicehelper.hxx>
namespace com::sun::star::text
{
@@ -171,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)
{
}
@@ -210,18 +206,6 @@ void SAL_CALL OWriterTable::disposing()
m_pWriterConnection = nullptr;
}
-uno::Sequence<sal_Int8> OWriterTable::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
-sal_Int64 OWriterTable::getSomething(const uno::Sequence<sal_Int8>& rId)
-{
- return comphelper::getSomethingImpl(rId, this,
- comphelper::FallbackToGetSomethingOf<OWriterTable_BASE>{});
-}
-
bool OWriterTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData)
{
// read the bookmark
diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
index c469f06716a7..f0a3fef76d00 100644
--- a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
@@ -32,16 +32,15 @@
#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,
+ typedef ::comphelper::WeakComponentImplHelper< css::sdbc::XResultSet,
css::sdbc::XRow,
css::sdbc::XResultSetMetaDataSupplier,
css::util::XCancellable,
@@ -54,11 +53,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:
@@ -118,8 +116,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 +129,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() noexcept override;
- virtual void SAL_CALL release() noexcept 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(ORows&& _rRows);
+ OOO_DLLPUBLIC_DBTOOLS void setRows(ORows&& _rRows);
// XServiceInfo
@@ -153,14 +156,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 +241,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 57addead1235..2131b3e15254 100644
--- a/connectivity/source/inc/OColumn.hxx
+++ b/connectivity/source/inc/OColumn.hxx
@@ -22,6 +22,7 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <connectivity/dbtoolsdllapi.hxx>
+#include <utility>
namespace connectivity
{
@@ -64,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(),
diff --git a/connectivity/source/inc/ParameterSubstitution.hxx b/connectivity/source/inc/ParameterSubstitution.hxx
index 11ac90982ca9..a76bd09398fa 100644
--- a/connectivity/source/inc/ParameterSubstitution.hxx
+++ b/connectivity/source/inc/ParameterSubstitution.hxx
@@ -41,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
diff --git a/connectivity/source/inc/TConnection.hxx b/connectivity/source/inc/TConnection.hxx
index 246e968b8a32..2dbe2ef6a756 100644
--- a/connectivity/source/inc/TConnection.hxx
+++ b/connectivity/source/inc/TConnection.hxx
@@ -73,7 +73,7 @@ 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();
};
}
diff --git a/connectivity/source/inc/TPrivilegesResultSet.hxx b/connectivity/source/inc/TPrivilegesResultSet.hxx
index b7206b7de476..8c4070fce97a 100644
--- a/connectivity/source/inc/TPrivilegesResultSet.hxx
+++ b/connectivity/source/inc/TPrivilegesResultSet.hxx
@@ -36,8 +36,8 @@ 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;
};
diff --git a/connectivity/source/inc/ado/AColumn.hxx b/connectivity/source/inc/ado/AColumn.hxx
index fdb0afc74d24..f297964820dc 100644
--- a/connectivity/source/inc/ado/AColumn.hxx
+++ b/connectivity/source/inc/ado/AColumn.hxx
@@ -44,9 +44,6 @@ namespace connectivity::ado
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();
WpADOColumn getColumnImpl() const;
};
diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx
index 3e7581ec6d03..c2c82100363d 100644
--- a/connectivity/source/inc/ado/AConnection.hxx
+++ b/connectivity/source/inc/ado/AConnection.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <map>
+#include <string_view>
#include <connectivity/CommonTools.hxx>
#include <OTypeInfo.hxx>
#include <TConnection.hxx>
@@ -71,7 +72,7 @@ namespace connectivity::ado
OConnection(ODriver* _pDriver);
// OConnection(const SQLHANDLE _pConnectionHandle);
~OConnection() override;
- void construct(const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info);
+ 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;
diff --git a/connectivity/source/inc/ado/AGroup.hxx b/connectivity/source/inc/ado/AGroup.hxx
index f46577d0fd55..00207a5fa23a 100644
--- a/connectivity/source/inc/ado/AGroup.hxx
+++ b/connectivity/source/inc/ado/AGroup.hxx
@@ -45,10 +45,6 @@ namespace connectivity::ado
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;
diff --git a/connectivity/source/inc/ado/AIndex.hxx b/connectivity/source/inc/ado/AIndex.hxx
index 7bc54f788aec..98c3a77d1ceb 100644
--- a/connectivity/source/inc/ado/AIndex.hxx
+++ b/connectivity/source/inc/ado/AIndex.hxx
@@ -38,9 +38,6 @@ namespace connectivity::ado
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();
WpADOIndex getImpl() const { return m_aIndex;}
};
diff --git a/connectivity/source/inc/ado/AKey.hxx b/connectivity/source/inc/ado/AKey.hxx
index 67e05b86d5f9..5ec3fa972b12 100644
--- a/connectivity/source/inc/ado/AKey.hxx
+++ b/connectivity/source/inc/ado/AKey.hxx
@@ -41,10 +41,6 @@ namespace connectivity::ado
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);
diff --git a/connectivity/source/inc/ado/ATable.hxx b/connectivity/source/inc/ado/ATable.hxx
index 07a16ae6ae4f..827485a6b480 100644
--- a/connectivity/source/inc/ado/ATable.hxx
+++ b/connectivity/source/inc/ado/ATable.hxx
@@ -53,9 +53,6 @@ namespace connectivity::ado
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();
// XRename
virtual void SAL_CALL rename( const OUString& newName ) override;
diff --git a/connectivity/source/inc/ado/AUser.hxx b/connectivity/source/inc/ado/AUser.hxx
index 849c3a98a5eb..8d0c0f7321b6 100644
--- a/connectivity/source/inc/ado/AUser.hxx
+++ b/connectivity/source/inc/ado/AUser.hxx
@@ -48,9 +48,6 @@ namespace connectivity::ado
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
diff --git a/connectivity/source/inc/ado/AView.hxx b/connectivity/source/inc/ado/AView.hxx
index 6f8d7a337494..db81c4e70bb5 100644
--- a/connectivity/source/inc/ado/AView.hxx
+++ b/connectivity/source/inc/ado/AView.hxx
@@ -40,10 +40,6 @@ namespace connectivity::ado
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;}
};
}
diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx
index 256be7dd6c0d..ba0653156a94 100644
--- a/connectivity/source/inc/ado/Aolevariant.hxx
+++ b/connectivity/source/inc/ado/Aolevariant.hxx
@@ -33,27 +33,6 @@ namespace com::sun::star::util
namespace connectivity::ado
{
- class OLEString
- {
- 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:
diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx
index 8bc8cffb2ecd..507b85522674 100644
--- a/connectivity/source/inc/ado/Awrapado.hxx
+++ b/connectivity/source/inc/ado/Awrapado.hxx
@@ -106,7 +106,7 @@ namespace connectivity::ado
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 );
+ std::u16string_view tableNamePattern );
ADORecordset* getCrossReference( const css::uno::Any& primaryCatalog,
const OUString& primarySchema,
std::u16string_view primaryTable,
@@ -115,18 +115,18 @@ namespace connectivity::ado
std::u16string_view foreignTable);
ADORecordset* getProcedures( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& procedureNamePattern );
+ std::u16string_view procedureNamePattern );
ADORecordset* getProcedureColumns( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& procedureNamePattern,
- const OUString& columnNamePattern );
+ std::u16string_view procedureNamePattern,
+ std::u16string_view columnNamePattern );
ADORecordset* getTables( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern,
+ std::u16string_view tableNamePattern,
const css::uno::Sequence< OUString >& types );
ADORecordset* getColumns( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern,
+ std::u16string_view tableNamePattern,
std::u16string_view columnNamePattern );
ADORecordset* getColumnPrivileges( const css::uno::Any& catalog,
const OUString& schemaPattern,
diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx
index 58e268d9c68a..60c6fd313d77 100644
--- a/connectivity/source/inc/ado/adoimp.hxx
+++ b/connectivity/source/inc/ado/adoimp.hxx
@@ -24,16 +24,17 @@
struct ADOConnection;
+namespace sal::systools { class BStr; };
+
namespace connectivity::ado
{
class WpADOField;
- class OLEString;
class ADOS
{
public:
// Also here: Free BSTR with SysFreeString()!
- static OLEString& GetKeyStr();
+ static sal::systools::BStr& GetKeyStr();
static const CLSID CLSID_ADOCATALOG_25;
static const IID IID_ADOCATALOG_25;
diff --git a/connectivity/source/inc/calc/CTable.hxx b/connectivity/source/inc/calc/CTable.hxx
index a8f49b661bc4..b4751fd876d7 100644
--- a/connectivity/source/inc/calc/CTable.hxx
+++ b/connectivity/source/inc/calc/CTable.hxx
@@ -64,10 +64,6 @@ namespace connectivity::calc
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();
-
void construct() override;
};
diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx
index a75ce918ff6c..3cc7da9ad1d3 100644
--- a/connectivity/source/inc/dbase/DIndex.hxx
+++ b/connectivity/source/inc/dbase/DIndex.hxx
@@ -23,7 +23,7 @@
#include <dbase/DTable.hxx>
#include <dbase/dindexnode.hxx>
-inline constexpr OStringLiteral dBASE_III_GROUP = "dBase III";
+inline constexpr OString dBASE_III_GROUP = "dBase III"_ostr;
namespace connectivity::dbase
{
@@ -91,10 +91,6 @@ namespace connectivity::dbase
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();
diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx
index 6e7b2e184c32..bb0b6baa5fa2 100644
--- a/connectivity/source/inc/dbase/DTable.hxx
+++ b/connectivity/source/inc/dbase/DTable.hxx
@@ -161,9 +161,6 @@ namespace connectivity::dbase
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;
@@ -182,7 +179,7 @@ namespace connectivity::dbase
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 bool Drop_Static(std::u16string_view _sUrl, bool _bHasMemoFields, sdbcx::OCollection* _pIndexes );
virtual void refreshHeader() override;
diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx
index 6000c36224cf..c1db23f76b60 100644
--- a/connectivity/source/inc/dbase/dindexnode.hxx
+++ b/connectivity/source/inc/dbase/dindexnode.hxx
@@ -44,7 +44,7 @@ namespace connectivity::dbase
public:
ONDXKey();
- ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, sal_uInt32 nRec);
+ ONDXKey(ORowSetValue aVal, sal_Int32 eType, sal_uInt32 nRec);
ONDXKey(const OUString& aStr, sal_uInt32 nRec);
ONDXKey(double aVal, sal_uInt32 nRec);
@@ -163,8 +163,8 @@ namespace connectivity::dbase
const ODbaseIndex& GetIndex() const {return rIndex;}
// Setting the child, via reference to retain the PagePos
- void SetChild(ONDXPagePtr aCh);
- void SetParent(ONDXPagePtr aPa);
+ void SetChild(const ONDXPagePtr& rCh);
+ void SetParent(const ONDXPagePtr& rPa);
sal_uInt16 Search(const ONDXKey& rSearch);
sal_uInt16 Search(const ONDXPage* pPage);
@@ -209,14 +209,14 @@ namespace connectivity::dbase
inline bool ONDXPage::HasParent() const {return aParent.Is();}
inline const ONDXPagePtr& ONDXPage::GetParent() const {return aParent;}
- inline void ONDXPage::SetParent(ONDXPagePtr aPa = ONDXPagePtr())
+ inline void ONDXPage::SetParent(const ONDXPagePtr& rPa = ONDXPagePtr())
{
- aParent = aPa;
+ aParent = rPa;
}
- inline void ONDXPage::SetChild(ONDXPagePtr aCh = ONDXPagePtr())
+ inline void ONDXPage::SetChild(const ONDXPagePtr& rCh = ONDXPagePtr())
{
- aChild = aCh;
+ aChild = rCh;
if (aChild.Is())
aChild->SetParent(this);
}
@@ -246,7 +246,7 @@ namespace connectivity::dbase
ONDXKey& GetKey() { return aKey;}
// Setting the child, via reference to retain the PagePos
- void SetChild(ONDXPagePtr aCh = ONDXPagePtr(), ONDXPage* = nullptr);
+ void SetChild(const ONDXPagePtr& rCh = ONDXPagePtr(), ONDXPage* = nullptr);
void Write(SvStream &rStream, const ONDXPage& rPage) const;
void Read(SvStream &rStream, ODbaseIndex const &);
@@ -293,9 +293,9 @@ namespace connectivity::dbase
return !operator > (rKey);
}
- inline void ONDXNode::SetChild(ONDXPagePtr aCh, ONDXPage* pParent)
+ inline void ONDXNode::SetChild(const ONDXPagePtr& rCh, ONDXPage* pParent)
{
- aChild = aCh;
+ aChild = rCh;
if (aChild.Is())
aChild->SetParent(pParent);
}
diff --git a/connectivity/source/inc/file/FColumns.hxx b/connectivity/source/inc/file/FColumns.hxx
index f5fce16b6f6a..056934f88c65 100644
--- a/connectivity/source/inc/file/FColumns.hxx
+++ b/connectivity/source/inc/file/FColumns.hxx
@@ -26,7 +26,7 @@
namespace connectivity::file
{
- class OOO_DLLPUBLIC_FILE OColumns : public sdbcx::OCollection
+ class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OColumns : public sdbcx::OCollection
{
protected:
OFileTable* m_pTable;
diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx
index 36b095e70427..e6412992ab77 100644
--- a/connectivity/source/inc/file/FConnection.hxx
+++ b/connectivity/source/inc/file/FConnection.hxx
@@ -98,7 +98,7 @@ namespace connectivity::file
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();
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
// no interface methods
css::uno::Reference< css::ucb::XDynamicResultSet > getDir() const;
diff --git a/connectivity/source/inc/file/FDriver.hxx b/connectivity/source/inc/file/FDriver.hxx
index 9d289d618a3d..0351c59ca27a 100644
--- a/connectivity/source/inc/file/FDriver.hxx
+++ b/connectivity/source/inc/file/FDriver.hxx
@@ -42,7 +42,7 @@ namespace connectivity::file
// for this Driver
css::uno::Reference< css::uno::XComponentContext > m_xContext;
public:
- OFileDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ OFileDriver(css::uno::Reference< css::uno::XComponentContext > _xContext);
// OComponentHelper
virtual void SAL_CALL disposing() override;
diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx
index 71d222d82030..0870593e6388 100644
--- a/connectivity/source/inc/file/FResultSet.hxx
+++ b/connectivity/source/inc/file/FResultSet.hxx
@@ -40,6 +40,7 @@
#include <TSortIndex.hxx>
#include <TSkipDeletedSet.hxx>
#include <com/sun/star/lang/XEventListener.hpp>
+#include <o3tl/safeint.hxx>
namespace connectivity::file
{
@@ -53,10 +54,9 @@ namespace connectivity::file
css::sdbc::XCloseable,
css::sdbc::XColumnLocate,
css::lang::XServiceInfo,
- css::lang::XEventListener,
- css::lang::XUnoTunnel> OResultSet_BASE;
+ css::lang::XEventListener> OResultSet_BASE;
- class OOO_DLLPUBLIC_FILE OResultSet :
+ class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_FILE) OResultSet :
public cppu::BaseMutex,
public ::connectivity::IResultSetHelper,
public OResultSet_BASE,
@@ -245,9 +245,6 @@ namespace connectivity::file
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;
@@ -292,7 +289,7 @@ namespace connectivity::file
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())))
+ if ((column > 0) && (o3tl::make_unsigned(column) < m_aColMapping.size()))
map = m_aColMapping[column];
return map;
diff --git a/connectivity/source/inc/file/FResultSetMetaData.hxx b/connectivity/source/inc/file/FResultSetMetaData.hxx
index 65fc0bb3c83e..dee656a915f4 100644
--- a/connectivity/source/inc/file/FResultSetMetaData.hxx
+++ b/connectivity/source/inc/file/FResultSetMetaData.hxx
@@ -46,7 +46,7 @@ namespace connectivity::file
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);
+ 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;
diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx
index 80c662ba4d38..d8bbd92d6c85 100644
--- a/connectivity/source/inc/file/FTable.hxx
+++ b/connectivity/source/inc/file/FTable.hxx
@@ -83,10 +83,6 @@ namespace connectivity::file
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; }
diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx
index c78461743c27..541377c7dd5f 100644
--- a/connectivity/source/inc/file/fcode.hxx
+++ b/connectivity/source/inc/file/fcode.hxx
@@ -19,12 +19,14 @@
#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
{
@@ -35,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
@@ -107,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){}
@@ -243,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;
diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx
index ebdb0679e452..72afcdb0a84e 100644
--- a/connectivity/source/inc/file/fcomp.hxx
+++ b/connectivity/source/inc/file/fcomp.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <file/fcode.hxx>
+#include <utility>
namespace connectivity
{
@@ -86,7 +87,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);
diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
index 2e15040d74d1..99359edfddaa 100644
--- a/connectivity/source/inc/flat/ETable.hxx
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -92,10 +92,6 @@ namespace connectivity::flat
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();
-
OUString getEntry() const;
};
diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx
index ee4590864016..1186c680ac07 100644
--- a/connectivity/source/inc/hsqldb/HStorageMap.hxx
+++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx
@@ -86,7 +86,7 @@ namespace connectivity::hsqldb
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 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);
};
diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx
index bc345d775c28..d6ac5ced7646 100644
--- a/connectivity/source/inc/hsqldb/HTable.hxx
+++ b/connectivity/source/inc/hsqldb/HTable.hxx
@@ -85,9 +85,6 @@ namespace connectivity::hsqldb
// 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
diff --git a/connectivity/source/inc/hsqldb/HTables.hxx b/connectivity/source/inc/hsqldb/HTables.hxx
index a421be35e1b4..bff5e0e6421a 100644
--- a/connectivity/source/inc/hsqldb/HTables.hxx
+++ b/connectivity/source/inc/hsqldb/HTables.hxx
@@ -20,6 +20,7 @@
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <utility>
namespace connectivity::hsqldb
{
class OTables final : public sdbcx::OCollection
@@ -35,9 +36,9 @@ namespace connectivity::hsqldb
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,
+ 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(_rMetaData)
+ ,m_xMetaData(std::move(_xMetaData))
{}
// only the name is identical to ::cppu::OComponentHelper
diff --git a/connectivity/source/inc/hsqldb/HUser.hxx b/connectivity/source/inc/hsqldb/HUser.hxx
index dc69c636eb00..67c44e185bd2 100644
--- a/connectivity/source/inc/hsqldb/HUser.hxx
+++ b/connectivity/source/inc/hsqldb/HUser.hxx
@@ -38,8 +38,8 @@ namespace connectivity::hsqldb
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);
+ 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;
diff --git a/connectivity/source/inc/hsqldb/HUsers.hxx b/connectivity/source/inc/hsqldb/HUsers.hxx
index 5f72bceb7b9b..a5a099e9927e 100644
--- a/connectivity/source/inc/hsqldb/HUsers.hxx
+++ b/connectivity/source/inc/hsqldb/HUsers.hxx
@@ -43,7 +43,7 @@ namespace connectivity
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);
};
}
diff --git a/connectivity/source/inc/mysql/YDriver.hxx b/connectivity/source/inc/mysql/YDriver.hxx
index 7bdb499718fd..84fad1af1c99 100644
--- a/connectivity/source/inc/mysql/YDriver.hxx
+++ b/connectivity/source/inc/mysql/YDriver.hxx
@@ -72,7 +72,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
diff --git a/connectivity/source/inc/mysql/YTable.hxx b/connectivity/source/inc/mysql/YTable.hxx
index 534c2319accb..c891b7d7d95e 100644
--- a/connectivity/source/inc/mysql/YTable.hxx
+++ b/connectivity/source/inc/mysql/YTable.hxx
@@ -92,9 +92,6 @@ namespace connectivity::mysql
// 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;
diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx
index 11d76812399c..3e3283ca96da 100644
--- a/connectivity/source/inc/mysql/YTables.hxx
+++ b/connectivity/source/inc/mysql/YTables.hxx
@@ -21,6 +21,7 @@
#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,
@@ -37,9 +38,9 @@ namespace connectivity::mysql
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,
+ 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(_rMetaData)
+ ,m_xMetaData(std::move(_xMetaData))
{}
// only the name is identical to ::cppu::OComponentHelper
diff --git a/connectivity/source/inc/mysql/YUser.hxx b/connectivity/source/inc/mysql/YUser.hxx
index ecb93fa21118..1713f63bfb64 100644
--- a/connectivity/source/inc/mysql/YUser.hxx
+++ b/connectivity/source/inc/mysql/YUser.hxx
@@ -38,8 +38,8 @@ namespace connectivity::mysql
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);
+ 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;
diff --git a/connectivity/source/inc/mysql/YUsers.hxx b/connectivity/source/inc/mysql/YUsers.hxx
index d27244775c07..e4b35c12e718 100644
--- a/connectivity/source/inc/mysql/YUsers.hxx
+++ b/connectivity/source/inc/mysql/YUsers.hxx
@@ -43,7 +43,7 @@ namespace connectivity
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);
};
}
diff --git a/connectivity/source/inc/mysql/YViews.hxx b/connectivity/source/inc/mysql/YViews.hxx
index 22a1f605b657..2e9a1b25162a 100644
--- a/connectivity/source/inc/mysql/YViews.hxx
+++ b/connectivity/source/inc/mysql/YViews.hxx
@@ -20,6 +20,7 @@
#include <connectivity/sdbcx/VCollection.hxx>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <utility>
namespace connectivity::mysql
{
class OViews final : public sdbcx::OCollection
@@ -34,9 +35,9 @@ namespace connectivity::mysql
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,
+ 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(_rMetaData)
+ ,m_xMetaData(std::move(_xMetaData))
,m_bInDrop(false)
{}
diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx
index b08544b859bd..93875c66193c 100644
--- a/connectivity/source/inc/odbc/OConnection.hxx
+++ b/connectivity/source/inc/odbc/OConnection.hxx
@@ -41,7 +41,7 @@ namespace connectivity::odbc
typedef connectivity::OMetaConnection OConnection_BASE;
typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
- class OOO_DLLPUBLIC_ODBCBASE OConnection final :
+ class OConnection final :
public OConnection_BASE,
public OAutoRetrievingBase
{
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
index b0b4a6552a37..457d1e684206 100644
--- a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
+++ b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx
@@ -29,7 +29,7 @@ namespace connectivity::odbc
//************ Class: ODatabaseMetaData
- class OOO_DLLPUBLIC_ODBCBASE ODatabaseMetaData final :
+ class ODatabaseMetaData final :
public ODatabaseMetaDataBase
{
SQLHANDLE m_aConnectionHandle;
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
index 5d6982807d48..dc011f37802c 100644
--- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
@@ -53,7 +53,7 @@ namespace connectivity::odbc
css::sdbc::XCloseable,
css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE;
- class OOO_DLLPUBLIC_ODBCBASE ODatabaseMetaDataResultSet :
+ class ODatabaseMetaDataResultSet :
public cppu::BaseMutex,
public ODatabaseMetaDataResultSet_BASE,
public ::cppu::OPropertySetHelper,
diff --git a/connectivity/source/inc/odbc/ODriver.hxx b/connectivity/source/inc/odbc/ODriver.hxx
index 0152346b2473..6cba90648d6e 100644
--- a/connectivity/source/inc/odbc/ODriver.hxx
+++ b/connectivity/source/inc/odbc/ODriver.hxx
@@ -49,7 +49,7 @@ namespace connectivity::odbc
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;
diff --git a/connectivity/source/inc/odbc/OFunctions.hxx b/connectivity/source/inc/odbc/OFunctions.hxx
index da3545c9ad79..a44fe5a15031 100644
--- a/connectivity/source/inc/odbc/OFunctions.hxx
+++ b/connectivity/source/inc/odbc/OFunctions.hxx
@@ -523,7 +523,7 @@ bool LoadLibrary_ODBC3(OUString &_rPath);
#define N3SQLGetCursorName(a,b,c,d) (*reinterpret_cast<T3SQLGetCursorName>(getOdbcFunction(ODBC3SQLFunctionId::GetCursorName)))(a,b,c,d)
- typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHSTMT ConnectionHandle,
+ typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHDBC ConnectionHandle,
SQLCHAR * InStatementText,
SQLINTEGER TextLength1,
SQLCHAR * OutStatementText,
diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx
index 37e29db9c5a2..aa5e895bfc79 100644
--- a/connectivity/source/inc/odbc/OPreparedStatement.hxx
+++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx
@@ -38,7 +38,7 @@ namespace connectivity::odbc
css::sdbc::XResultSetMetaDataSupplier,
css::lang::XServiceInfo> OPreparedStatement_BASE;
- class OOO_DLLPUBLIC_ODBCBASE OPreparedStatement final :
+ class OPreparedStatement final :
public OStatement_BASE2,
public OPreparedStatement_BASE
{
diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx
index 6de7adc28174..719c6be14da8 100644
--- a/connectivity/source/inc/odbc/OResultSet.hxx
+++ b/connectivity/source/inc/odbc/OResultSet.hxx
@@ -102,12 +102,12 @@ namespace connectivity::odbc
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>
+ class OResultSet :
+ public cppu::BaseMutex,
+ public ::connectivity::IResultSetHelper,
+ public OResultSet_BASE,
+ public ::cppu::OPropertySetHelper,
+ public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
{
protected:
TBookmarkPosMap m_aPosToBookmarks;
diff --git a/connectivity/source/inc/odbc/OResultSetMetaData.hxx b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
index 6c1acc13bfb9..76abe6eecd06 100644
--- a/connectivity/source/inc/odbc/OResultSetMetaData.hxx
+++ b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
@@ -33,7 +33,7 @@ namespace connectivity::odbc
typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
- class OOO_DLLPUBLIC_ODBCBASE OResultSetMetaData final :
+ class OResultSetMetaData final :
public OResultSetMetaData_BASE
{
std::vector<sal_Int32> m_vMapping; // when not every column is needed
@@ -62,7 +62,7 @@ namespace connectivity::odbc
:m_vMapping(std::move(_vMapping))
,m_aStatementHandle( _pStmt )
,m_pConnection(_pConnection)
- ,m_nColCount(_vMapping.size()-1)
+ ,m_nColCount(m_vMapping.size()-1)
,m_bUseODBC2Types(false)
{}
virtual ~OResultSetMetaData() override;
diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx
index 1e483108732d..2f0d0d814fea 100644
--- a/connectivity/source/inc/odbc/OStatement.hxx
+++ b/connectivity/source/inc/odbc/OStatement.hxx
@@ -52,11 +52,11 @@ namespace connectivity::odbc
//************ Class: java.sql.Statement
- class OOO_DLLPUBLIC_ODBCBASE OStatement_Base :
- public cppu::BaseMutex,
- public OStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
+ class OStatement_Base :
+ public cppu::BaseMutex,
+ public OStatement_BASE,
+ public ::cppu::OPropertySetHelper,
+ public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
{
css::sdbc::SQLWarning m_aLastWarning;
@@ -218,10 +218,10 @@ namespace connectivity::odbc
virtual void SAL_CALL disposing() override;
};
- class OOO_DLLPUBLIC_ODBCBASE OStatement :
- public OStatement_BASE2,
- public css::sdbc::XBatchExecution,
- public css::lang::XServiceInfo
+ class OStatement :
+ public OStatement_BASE2,
+ public css::sdbc::XBatchExecution,
+ public css::lang::XServiceInfo
{
protected:
virtual ~OStatement() override {}
diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx
index 1a9e3720f963..b10b4f008e64 100644
--- a/connectivity/source/inc/propertyids.hxx
+++ b/connectivity/source/inc/propertyids.hxx
@@ -36,74 +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,
+
+ // 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_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
+ 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_COMMAND 31
-#define PROPERTY_ID_CHECKOPTION 32
-#define PROPERTY_ID_PASSWORD 33
-#define PROPERTY_ID_RELATEDCOLUMN 34
+ PROPERTY_ID_COMMAND = 31,
+ PROPERTY_ID_CHECKOPTION = 32,
+ PROPERTY_ID_PASSWORD = 33,
+ PROPERTY_ID_RELATEDCOLUMN = 34,
-#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_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_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_HY010 = 41,
+ PROPERTY_ID_LABEL = 42,
+ PROPERTY_ID_DELIMITER = 43,
+ PROPERTY_ID_FORMATKEY = 44,
+ PROPERTY_ID_LOCALE = 45,
-#define PROPERTY_ID_AUTOINCREMENTCREATION 49
+ PROPERTY_ID_AUTOINCREMENTCREATION = 46,
-#define PROPERTY_ID_PRIVILEGES 50
-#define PROPERTY_ID_HAVINGCLAUSE 51
+ PROPERTY_ID_PRIVILEGES = 47,
+ PROPERTY_ID_HAVINGCLAUSE = 48,
-#define PROPERTY_ID_ISSIGNED 52
-#define PROPERTY_ID_AGGREGATEFUNCTION 53
-#define PROPERTY_ID_ISSEARCHABLE 54
+ PROPERTY_ID_ISSIGNED = 49,
+ PROPERTY_ID_AGGREGATEFUNCTION = 50,
+ PROPERTY_ID_ISSEARCHABLE = 51,
-#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_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/writer/WConnection.hxx b/connectivity/source/inc/writer/WConnection.hxx
index 768518a97c93..5ae8b2818e0f 100644
--- a/connectivity/source/inc/writer/WConnection.hxx
+++ b/connectivity/source/inc/writer/WConnection.hxx
@@ -40,11 +40,11 @@ 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>
diff --git a/connectivity/source/inc/writer/WTable.hxx b/connectivity/source/inc/writer/WTable.hxx
index e19872df531d..46ee5412e0a6 100644
--- a/connectivity/source/inc/writer/WTable.hxx
+++ b/connectivity/source/inc/writer/WTable.hxx
@@ -40,9 +40,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();
@@ -54,10 +54,6 @@ 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;
};
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index c605573b703e..ed09cc3c816e 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -27,7 +27,7 @@
#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>
@@ -35,6 +35,7 @@
#include <algorithm>
#include <iterator>
+#include <utility>
#include <vector>
namespace drivermanager
@@ -50,12 +51,6 @@ using namespace ::osl;
constexpr OUStringLiteral SERVICE_SDBC_DRIVER = u"com.sun.star.sdbc.Driver";
-/// @throws NoSuchElementException
-static void throwNoSuchElementException()
-{
- throw NoSuchElementException();
-}
-
class ODriverEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
{
friend class OSDBCDriverManager;
@@ -97,9 +92,9 @@ 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
@@ -157,22 +152,11 @@ namespace
};
// predicate for checking whether or not a driver accepts a given URL
- class AcceptsURL
+ bool AcceptsURL( const OUString& _rURL, const Reference<XDriver>& _rDriver )
{
- 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 );
- }
- };
+ // ask the driver
+ return _rDriver.is() && _rDriver->acceptsURL( _rURL );
+ }
#if !ENABLE_FUZZERS
sal_Int32 lcl_getDriverPrecedence( const Reference<XComponentContext>& _rContext, Sequence< OUString >& _rPrecedence )
@@ -186,7 +170,7 @@ namespace
// one argument for creating the node access: the path to the configuration node
Sequence< Any > aCreationArgs{ Any(NamedValue(
- "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) )) };
+ "nodepath", Any( OUString("org.openoffice.Office.DataAccess/DriverManager") ) )) };
// create the node access
Reference< XNameAccess > xDriverManagerNode(
@@ -225,7 +209,7 @@ namespace
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)
{
@@ -359,7 +343,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;
@@ -528,7 +512,7 @@ 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;
}
@@ -570,7 +554,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 +591,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 +601,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__ <= 14
+#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__ <= 14
+#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 +633,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 )
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index c4be0bc00bd0..23de1cb772ab 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
@@ -157,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
@@ -219,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
@@ -233,12 +233,12 @@ using namespace connectivity;
%type <pParseNode> datetime_primary datetime_value_fct time_zone time_zone_specifier /*interval_term*/ interval_qualifier
%type <pParseNode> start_field non_second_datetime_field end_field single_datetime_field extract_field datetime_field time_zone_field
%type <pParseNode> char_length_exp octet_length_exp bit_length_exp select_sublist string_value_exp
-%type <pParseNode> char_value_exp concatenation char_factor char_primary string_value_fct char_substring_fct fold
+%type <pParseNode> char_value_exp concatenation char_factor char_primary string_value_fct char_substring_fct
%type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist
%type <pParseNode> /*bit_concatenation*/ bit_value_exp bit_factor bit_primary collate_clause char_value_fct unique_spec value_exp_commalist in_predicate_value unique_test update_source
%type <pParseNode> function_arg_commalist3 string_function_3Argument function_arg_commalist4 string_function_4Argument function_arg_commalist2 string_function_1Argument string_function_2Argument
%type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument
-%type <pParseNode> all query_primary sql_not for_length upper_lower comparison column_val cross_union /*opt_schema_element_list*/
+%type <pParseNode> all query_primary sql_not for_length comparison column_val cross_union /*opt_schema_element_list*/
%type <pParseNode> /*op_authorization op_schema*/ nil_fkt schema_element base_table_def base_table_element base_table_element_commalist
%type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement
%type <pParseNode> op_odbc_call_parameter odbc_parameter_commalist odbc_parameter function_args_commalist function_arg
@@ -324,7 +324,7 @@ schema:
opt_schema_element_list:
{$$ = SQL_NEW_RULE;}
- | schema_glement_list
+ | schema_element_list
;
schema_element_list:
@@ -1929,10 +1929,12 @@ string_function_1Argument:
SQL_TOKEN_LENGTH
| SQL_TOKEN_ASCII
| SQL_TOKEN_LCASE
+ | SQL_TOKEN_LOWER
| SQL_TOKEN_LTRIM
| SQL_TOKEN_RTRIM
| SQL_TOKEN_SPACE
| SQL_TOKEN_UCASE
+ | SQL_TOKEN_UPPER
;
string_function_2Argument:
@@ -1979,6 +1981,7 @@ date_function_1Argument:
date_function:
SQL_TOKEN_TIMESTAMPADD
| SQL_TOKEN_TIMESTAMPDIFF
+ | SQL_TOKEN_DATEADD
;
numeric_function_0Argument:
SQL_TOKEN_PI
@@ -2958,11 +2961,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
{
@@ -3094,6 +3113,13 @@ function_args_commalist:
else
YYERROR;
}
+ | datetime_unit ',' function_arg ',' function_arg
+ {
+ $$ = SQL_NEW_COMMALISTRULE;
+ $$->append($1);
+ $$->append($3);
+ $$->append($5);
+ }
;
value_exp:
@@ -3225,7 +3251,6 @@ bit_primary:
;
char_value_fct:
char_substring_fct
- | fold
| form_conversion
{
$$ = SQL_NEW_RULE;
@@ -3272,20 +3297,6 @@ char_substring_fct:
$$->append(newNode(")", SQLNodeType::Punctuation));
}
;
-upper_lower:
- SQL_TOKEN_UPPER
- | SQL_TOKEN_LOWER
- ;
-fold:
- upper_lower '(' value_exp ')'
- {
- $$ = SQL_NEW_RULE;
- $$->append($1);
- $$->append(newNode("(", SQLNodeType::Punctuation));
- $$->append($3);
- $$->append(newNode(")", SQLNodeType::Punctuation));
- }
- ;
form_conversion:
SQL_TOKEN_CONVERT '(' string_value_exp SQL_TOKEN_USING table_node ')'
{
@@ -4382,7 +4393,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,
@@ -4392,15 +4403,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;
}
@@ -4495,7 +4505,7 @@ 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;
+vcl::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> OSQLParser::s_xLocaleData(vcl::DeleteOnDeinitFlag::Empty);
void setParser(OSQLParser* _pParser)
{
@@ -4504,7 +4514,6 @@ void setParser(OSQLParser* _pParser)
void OSQLParser::setParseTree(OSQLParseNode* pNewParseTree)
{
- ::osl::MutexGuard aGuard(getMutex());
m_pParseTree.reset(pNewParseTree);
}
@@ -4576,7 +4585,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);
@@ -4605,7 +4614,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
@@ -4651,6 +4661,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);
@@ -4669,7 +4680,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
@@ -4679,8 +4690,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;
@@ -4749,8 +4760,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;
}
@@ -4808,12 +4818,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 662a000870b7..f190d5dbfc97 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;
@@ -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,7 +266,7 @@ 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 { "VIEW", "TABLE", s_sWildcard }; // this last one just to be sure to include anything else...
@@ -274,7 +276,7 @@ namespace
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() )
@@ -523,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);
}
}
}
@@ -823,7 +825,6 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo
pColumn->setFunction(false);
pColumn->setRealName(aColumnName);
- Reference< XPropertySet> xCol = pColumn;
m_aCreateColumns->push_back(pColumn);
}
}
@@ -1215,10 +1216,10 @@ 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!");
@@ -1532,18 +1533,14 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS
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(aSelectColumnNames, *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())
{
rtl::Reference<OParseColumn> pColumn = new OParseColumn(aName
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
@@ -1561,13 +1558,13 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))));
pColumn->setTableName(_rTableAlias);
- pColumn->setRealName(*pBegin);
+ 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);
}
}
@@ -1759,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 ) );
}
@@ -1780,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()));
}
@@ -2108,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 a5d711d9da16..ad8f6c9edeff 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, std::u16string_view 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)
@@ -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,7 +198,7 @@ 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());
@@ -234,7 +222,7 @@ OUString OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rPara
}
-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());
@@ -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, ".", 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!" );
@@ -313,7 +301,7 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
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& )
@@ -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();
@@ -374,7 +362,7 @@ bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, cons
{
constexpr char SELECT_KEYWORD[] = "SELECT";
sBuffer.insert(sBuffer.indexOf(SELECT_KEYWORD) + strlen(SELECT_KEYWORD),
- OUStringConcatenation(" FIRST " + sLimitValue));
+ Concat2View(" FIRST " + sLimitValue));
}
_out_rString = sBuffer.makeStringAndClear();
@@ -757,7 +745,7 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( OUStringBuffer& rString, c
{
OUString aStr = ConvertLikeToken(pParaNode, pEscNode, rParam.bInternational);
rString.append(" ");
- rString.append(SetQuotation(aStr, "\'", u"\'\'"));
+ rString.append(SetQuotation(aStr, u"\'", u"\'\'"));
}
else
pParaNode->impl_parseNodeToString_throw( rString, aNewParam, false );
@@ -815,7 +803,7 @@ void OSQLParser::killThousandSeparator(OSQLParseNode* pLiteral)
{
if ( pLiteral )
{
- if ( s_xLocaleData->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
+ if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
{
pLiteral->m_aNodeValue = pLiteral->m_aNodeValue.replace('.', sal_Unicode());
// and replace decimal
@@ -1130,7 +1118,7 @@ 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() )
+ if( s_xLocaleData.get() )
{
try
{
@@ -1141,7 +1129,8 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale)
sal_Int32 nPos = aValue.lastIndexOf('.');
if((nPos+_nScale) < aValue.getLength())
aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale, u"");
- aValue = aValue.replaceAt(aValue.lastIndexOf('.'),1,s_xLocaleData->getLocaleItem(m_pData->aLocale).decimalSeparator);
+ OUString sDecimalSeparator = s_xLocaleData.get()->get()->getLocaleItem(m_pData->aLocale).decimalSeparator;
+ aValue = aValue.replaceAt(aValue.lastIndexOf('.'), 1, sDecimalSeparator);
return aValue;
}
}
@@ -1153,9 +1142,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 +1155,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);
@@ -1259,7 +1248,7 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
s_pScanner->SetRule(OSQLScanner::GetSTRINGRule());
break;
default:
- if ( s_xLocaleData->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
+ if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
s_pScanner->SetRule(OSQLScanner::GetGERRule());
else
s_pScanner->SetRule(OSQLScanner::GetENGRule());
@@ -1294,7 +1283,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 +1306,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 +1326,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 +1334,8 @@ 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);
+ 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 +1347,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");
@@ -1483,7 +1476,7 @@ OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >&
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,8 +1486,6 @@ 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().swap(s_aReverseRuleIDLookup);
}
@@ -1510,7 +1501,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);
@@ -1611,11 +1602,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)
{
@@ -1843,10 +1834,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);
@@ -1862,10 +1854,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
@@ -1873,9 +1866,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));
}
}
@@ -1962,8 +1955,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
{
@@ -1992,8 +1984,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);
}
}
@@ -2015,8 +2006,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))
{
@@ -2026,8 +2016,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);
}
}
@@ -2363,7 +2352,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
@@ -2375,7 +2364,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);
@@ -2388,27 +2377,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
@@ -2428,7 +2414,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet
case SQLNodeType::String:
if (!rString.isEmpty())
rString.append(" ");
- rString.append(SetQuotation(m_aNodeValue, "\'", u"\'\'"));
+ rString.append(SetQuotation(m_aNodeValue, u"\'", u"\'\'"));
break;
case SQLNodeType::Name:
if (!rString.isEmpty())
@@ -2472,7 +2458,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet
case SQLNodeType::ApproxNum:
{
OUString aTmp = m_aNodeValue;
- static constexpr OUStringLiteral strPoint(u".");
+ static constexpr OUString strPoint(u"."_ustr);
if (rParam.bInternational && rParam.bPredicate && rParam.sDecSep != strPoint)
aTmp = aTmp.replaceAll(strPoint, rParam.sDecSep);
@@ -2510,7 +2496,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;
@@ -2747,13 +2733,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);
@@ -2764,13 +2750,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() )
{
@@ -2779,7 +2765,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 0f8bccefd96b..cc6f65e64541 100644
--- a/connectivity/source/resource/sharedresources.cxx
+++ b/connectivity/source/resource/sharedresources.cxx
@@ -100,20 +100,13 @@ namespace connectivity
namespace
{
- size_t lcl_substitute( OUString& _inout_rString,
+ 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;
}
}
diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx
index 8ab9072f004c..0fa6cace50e0 100644
--- a/connectivity/source/sdbcx/VCollection.cxx
+++ b/connectivity/source/sdbcx/VCollection.cxx
@@ -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( )
@@ -374,7 +374,7 @@ void SAL_CALL OCollection::appendByDescriptor( const Reference< XPropertySet >&
if ( !xNewlyCreated.is() )
throw RuntimeException();
- ODescriptor* pDescriptor = comphelper::getFromUnoTunnel<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,7 +423,7 @@ 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
OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
@@ -517,7 +517,7 @@ 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
OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx
index 398d64b49f57..ad9a52ed12ed 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;
@@ -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;
@@ -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( )
diff --git a/connectivity/source/sdbcx/VDescriptor.cxx b/connectivity/source/sdbcx/VDescriptor.cxx
index 7800aaf075be..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,12 +43,6 @@ namespace connectivity::sdbcx
// css::lang::XUnoTunnel
- sal_Int64 SAL_CALL ODescriptor::getSomething( const Sequence< sal_Int8 >& rId )
- {
- return comphelper::getSomethingImpl(rId, this);
- }
-
-
namespace
{
struct ResetROAttribute
@@ -86,25 +79,11 @@ namespace connectivity::sdbcx
bool ODescriptor::isNew( const Reference< XInterface >& _rxDescriptor )
{
- ODescriptor* pImplementation = comphelper::getFromUnoTunnel<ODescriptor>( _rxDescriptor );
+ ODescriptor* pImplementation = dynamic_cast<ODescriptor*>( _rxDescriptor.get() );
return pImplementation && pImplementation->isNew();
}
- Sequence< sal_Int8 > ODescriptor::getUnoTunnelId()
- {
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
- }
-
-
- 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;
@@ -115,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 73f6aa79c5ab..7a37ea3e523d 100644
--- a/connectivity/source/sdbcx/VGroup.cxx
+++ b/connectivity/source/sdbcx/VGroup.cxx
@@ -26,7 +26,6 @@
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;
diff --git a/connectivity/source/sdbcx/VIndex.cxx b/connectivity/source/sdbcx/VIndex.cxx
index e04cf2527791..48e26ae1140e 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;
@@ -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)
diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx
index f267db161504..140bd6160709 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;
@@ -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;
}
diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx
index b6f69e65c9de..e22620fb599d 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;
@@ -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 7a28bc5f4289..f569d01baef3 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;
@@ -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;
diff --git a/connectivity/source/sdbcx/VUser.cxx b/connectivity/source/sdbcx/VUser.cxx
index a09d82183682..85d09523c864 100644
--- a/connectivity/source/sdbcx/VUser.cxx
+++ b/connectivity/source/sdbcx/VUser.cxx
@@ -22,11 +22,11 @@
#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;
@@ -113,15 +113,12 @@ 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;
+ O3TL_UNREACHABLE;
}
sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
@@ -129,12 +126,9 @@ sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const OUString& /*objName*/, s
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OUser_BASE::rBHelper.bDisposed);
::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::getGrantablePrivileges", *this );
- return 0;
+ O3TL_UNREACHABLE;
}
-SAL_WNOUNREACHABLE_CODE_POP
-
-
void SAL_CALL OUser::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
{
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/connectivity/source/sdbcx/VView.cxx b/connectivity/source/sdbcx/VView.cxx
index b36817a40f3d..41828b5758cb 100644
--- a/connectivity/source/sdbcx/VView.cxx
+++ b/connectivity/source/sdbcx/VView.cxx
@@ -22,13 +22,13 @@
#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;
@@ -36,24 +36,24 @@ IMPLEMENT_SERVICE_INFO(OView,"com.sun.star.sdbcx.VView","com.sun.star.sdbcx.View
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();
}